ForHosting KIT · Math

Solve a 2×2 system of linear equations

The lines 2x + y equals 5 and x + 3y equals 7 cross at (1.6, 1.8): the solver finds the single intersection of two linear equations by Cramer's rule or elimination, and shows the determinant, here 5. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
A11
2
A12
1
A21
1
A22
3
B1
5
B2
7
You get
X
1.6
Y
1.8
Determinant
5
Det x
8

A two-by-two linear system is the smallest useful model of simultaneous equations: two unknowns constrained by two independent lines. Students meet it when graphing intersections, engineers meet it when balancing two forces or two circuit loops, and data pipelines meet it when recovering two parameters from two independent observations. This capability solves a11 x plus a12 y equals b1 and a21 x plus a22 y equals b2, returning the unique pair x and y when the coefficient determinant is nonzero. You may choose Cramer's rule, which builds three two-by-two determinants, or Gaussian elimination with partial pivoting, which reduces the augmented matrix.

What a 2×2 linear system is and when it has a unique solution

Write the system in matrix form as A times the column vector of unknowns equals the column vector of constants. The coefficient matrix A holds a11 and a12 on the first row and a21 and a22 on the second. Its determinant, a11 times a22 minus a12 times a21, is a single number that decides the geometry of the two lines in the plane.

When the determinant is nonzero the lines are not parallel: they cross at exactly one point, and that intersection is the unique solution (x, y). When the determinant is zero the rows of A are linearly dependent, so either the lines are parallel and never meet (no solution) or they are the same line written twice (infinitely many solutions). Elimination reaches the same pair by clearing the lower-left entry and back-substituting.

Either method is exact for ordinary floating-point coefficients within machine precision, and both are cheap enough to run entirely in the browser with no remote solver.

Practical use, pricing, limits, and delivery

Use the browser tool when you want an immediate exact intersection while checking homework, preparing a lecture slide, or debugging two-equation constraints without installing a computer-algebra system. There is no language model, no external linear-algebra service, and no randomness, so the capability is safe to pin in continuous-integration checks and reproducible lesson materials. Results are fully deterministic: the same coefficients and method always yield the same x, y, and determinant.

Prefer Cramer's rule when you want intermediate determinants for explanation; prefer elimination when you are teaching row operations and want the path that generalizes to larger systems. Keep coefficients within ordinary floating-range magnitudes so cancellation does not dominate; for classroom integers and typical engineering scales the solver is exact within double precision. Source inputs and outputs follow the same retention rules as other KIT parse items, and a failed task is never charged after validation.

Homework and tutoring verification

Students and graders confirm (x, y) for two linear equations, including singular cases that correctly fail, without a local CAS install.

Two-parameter recovery in pipelines

Scripts that fit two unknowns from two independent linear constraints call a deterministic 2×2 oracle instead of reimplementing determinants in every language.

What is the difference between Cramer's rule and elimination?

Elimination reduces the augmented matrix with partial pivoting. Both return the same unique (x, y) when the system is non-singular.

Is the 2×2 system solver free?

The browser tool runs free on your device.

Can it solve larger systems like 3×3?

No. This capacity is limited to two equations in two unknowns. Larger systems need a different capability or a general linear-algebra library.

What happens if the determinant is zero?

Then the two lines are parallel or are the same line written twice, so there is no single solution. The solver says the system is singular instead of inventing one pair of values.

How does Cramer's rule solve a 2×2 system?

Replace one column of coefficients with the constants and divide that determinant by the main one. In the example the determinants are 8 and 9 over a main determinant of 5, which gives 1.6 and 1.8.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/algebra/system-2x2

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/algebra/system-2x2 \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a11":2,"a12":1,"a21":1,"a22":3,"b1":5,"b2":7}'
{
  "a11": 2,
  "a12": 1,
  "a21": 1,
  "a22": 3,
  "b1": 5,
  "b2": 7
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.system_2x2",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Singular systems — parallel or coincident lines with determinant zero — are rejected with invalid_input instead of inventing a false unique root.

What a 2×2 linear system is and when it has a unique solution

In both singular cases this API refuses to invent a unique pair and fails with invalid_input, matching the promise in the product description. Cramer's rule exploits the nonzero-determinant case directly: replace the first column of A with the constants to get det_x, replace the second column to get det_y, then set x equal to det_x over det and y equal to det_y over det.

How to call the solver and read the response

Optionally set method to cramer (the default) or elimination. On success the response always includes x, y, determinant, method, a unique flag set to true, and an equations object with display strings for both lines. Numeric dust near zero is cleaned so goldens and human-readable demos stay stable, while ordinary non-integer reals keep full double precision. Send a JSON body with the six required numbers a11, a12, a21, a22, b1, and b2. The engine validates that every coefficient is a finite number; missing fields, non-numeric strings, and NaN or Infinity fail immediately with invalid_input and are not charged. When the absolute value of the coefficient determinant is smaller than a tight epsilon near 1e-12, the request also fails with a message that the system is singular and has no unique solution. If you chose Cramer's rule, det_x and det_y are included so a teaching UI can show the three determinants side by side. Wire the endpoint into scripts that already speak JSON and need a stable contract rather than reimplementing pivot logic in every language.

Practical use, pricing, limits, and delivery

Each successful request is one billable item at $0.002; failed validation and singular systems do not consume balance.

Teaching Cramer versus elimination

Lesson pages can switch method and show det_x, det_y, or the elimination path so learners connect both algorithms to the same unique intersection.

How do I solve a 2×2 system of equations with this API?

Send JSON with a11, a12, a21, a22, b1, and b2 (and optional method). The response returns x, y, determinant, and related fields when a unique solution exists.

What happens if the system is singular?

When the coefficient determinant is zero (within a tight epsilon), the request fails with invalid_input and is not charged — there is no unique solution.

Read the full KIT documentation →