Substitution method
Solve two linear equations by substitution, with the isolated variable shown: for 2x + y equals 5 and x − y equals 1, x comes from the first equation and the solution is x equal to 2, y equal to 1. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A1
- 2
- B1
- 1
- C1
- 5
- A2
- 1
- B2
- -1
- C2
- 1
- Equation1
- 2*x + y = 5
- Equation2
- x - y = 1
- Isolated variable
- x
- Isolated from equation
- 1
The substitution method is the algebra-class procedure for solving a pair of linear equations in two unknowns: isolate one variable from one equation, replace it in the other equation, solve the resulting one-variable line, then back-substitute to recover the second coordinate. This calculator accepts the six finite coefficients of a1 times x plus b1 times y equals c1 and a2 times x plus b2 times y equals c2, shows which variable was isolated and from which equation, and returns the unique solution pair x and y.
What the substitution method is and when it yields a unique pair
Substitution is the first hand method most algebra courses teach for a two-by-two linear system, before elimination and long before matrix inverses. You write the system as a1 times x plus b1 times y equals c1 and a2 times x plus b2 times y equals c2. You pick an equation whose coefficient of x or of y is not zero, solve that equation for the chosen variable as a linear expression in the remaining variable, and substitute the expression into the other equation.
The result is a single linear equation in one unknown. Solve it with ordinary arithmetic, then plug the number you found back into the isolation expression to recover the second coordinate. Algebraically this intersection is the same point that Cramer's rule and Gaussian elimination compute: the pair is unique precisely when the coefficient determinant a1 times b2 minus a2 times b1 is nonzero.
Where a substitution-method calculator earns its keep
Secondary-school and college algebra courses grade the substitution method itself, not only the final pair, so a trusted oracle that returns the isolation expression together with x and y speeds homework checks, tutoring demos, and answer-key generation without skipping the steps the rubric requires. Exam generators need a deterministic tool that refuses dependent and inconsistent systems instead of silently emitting empty coordinates that a buggy grader might treat as success.
Curriculum authors building interactive lessons want the same isolation preference every time, a readable pair of equation strings, and an honest error when a student types two copies of the same line or two parallel lines. Programming notebooks and interview screens often hide a two-by-two solve inside a mixture, a break-even, or a two-loop circuit, and engineers need the unique intersection from six measured coefficients rather than a computer-algebra session.
Keep all six values finite, treat a zero determinant as no unique solution rather than a crash, and prefer the server-computed x and y over re-solving with a different floating-point path in client code. If you later need Cramer's rule artifacts, a three-by-three system, or an inequality region, treat those as separate search intents and landings rather than overloading this substitution-method solver.
What you can do with it
Homework and exam answer keys
Check textbook 2×2 systems against one canonical isolation expression and the unique (x, y), or catch items that are dependent or inconsistent.
Classroom substitution-method drills
Show which variable was isolated, from which equation, and the expression that was substituted, so learners can verify each algebraic step.
FAQ
How do I solve a two-variable system by the substitution method?
Send finite numbers a1, b1, c1, a2, b2, and c2 for a1*x + b1*y = c1 and a2*x + b2*y = c2.
What happens if the system has no unique solution?
Dependent equations (infinitely many solutions) and inconsistent parallel lines are both rejected and are not billed.
Which variable does the calculator isolate first?
It prefers x from the first equation when a1 is nonzero, then y from the first equation, then x or y from the second. The same coefficients always produce the same isolation fields.
How is this different from Cramer's rule or elimination?
This page solves by substitution and shows the isolation expression. Cramer's rule uses determinants; elimination adds multiples of rows. The unique pair matches, but the method artifacts differ.
How do I check the solution of a system?
Put both values back into each equation. With x equal to 2 and y equal to 1, the first equation gives 2 times 2 plus 1, which is 5, and the second gives 2 minus 1, which is 1, so both hold.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/substitution-method \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a1":2,"b1":1,"c1":5,"a2":1,"b2":-1,"c2":1}'const res = await fetch("https://api.kit.forhosting.com/math/substitution-method", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a1": 2,
"b1": 1,
"c1": 5,
"a2": 1,
"b2": -1,
"c2": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/substitution-method",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a1": 2,
"b1": 1,
"c1": 5,
"a2": 1,
"b2": -1,
"c2": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/substitution-method", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a1":2,"b1":1,"c1":5,"a2":1,"b2":-1,"c2":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a1":2,"b1":1,"c1":5,"a2":1,"b2":-1,"c2":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/substitution-method", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a1": 2,
"b1": 1,
"c1": 5,
"a2": 1,
"b2": -1,
"c2": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.substitution_method",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
When the two lines are parallel or coincident there is no unique solution, and the task fails with invalid_input instead of inventing a pair.
What the substitution method is and when it yields a unique pair
When that determinant vanishes the two lines are parallel or coincident, so there is either no solution or infinitely many, and this calculator reports invalid_input rather than a hollow success with missing coordinates. The implementation always prefers to isolate x from the first equation when a1 is nonzero, then y from the first equation, then x or y from the second, so the same six coefficients always produce the same isolated_variable, isolated_from_equation, isolated_expression, and the same rounded x and y. There is no random seed, no clock, and no network call on the path; identical inputs yield identical JSON every time a student, a tutor, or a script asks again.
Input contract, response shape, and error behaviour
On a unique system the body echoes the six coefficients, printable equation1 and equation2 strings, method substitution, the isolated variable, the equation it came from, the isolation expression in the form isolated equals open parenthesis right-hand side minus other coefficient times the other variable close parenthesis divided by the self coefficient, and the numeric pair x and y rounded to twelve decimal places so goldens stay stable across runtimes. Classic check: a1 equals two, b1 equals one, c1 equals five, a2 equals one, b2 equals negative one, c2 equals one isolates x from the first equation as x equals open parenthesis five minus one times y close parenthesis over two, substitutes into the second equation, and returns x equals two and y equals one. POST a JSON body with six required finite numbers: a1, b1, and c1 for the first equation, and a2, b2, and c2 for the second. Each field may arrive as a JSON number or as a plain numeric string; missing fields, empty strings, booleans, objects, and non-finite values fail with invalid_input naming the field and are not charged. Pair the response with your own graphing code if you need a sketch of the two lines; this endpoint solves for the intersection only. Successful API calls use the published base of $0.002 per item.
Where a substitution-method calculator earns its keep
Because this capability is a pure parse engine, the browser tool is free and API pricing is the published base of $0.002 per successful item; failed validation does not consume prepaid balance.
Integration use cases
LMS auto-grading of unique solutions
Accept substitution answers only when a unique pair exists; reject parallel or coincident lines as invalid_input instead of inventing coordinates.
Technical questions
What does the substitution-method calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.