Gaussian elimination solver
Solve n linear equations in n unknowns by row reduction: the three-equation example gives the unknowns 2, 3 and −1, with the pivots and 2 row swaps shown so you can follow the work. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
Gaussian elimination is the classical algorithm for solving a square linear system A x equals b: you build the augmented matrix, clear entries below each pivot, then back-substitute to recover every unknown. Successful runs return the solution vector x, the order n, the pivot values used, how many rows were swapped, and a unique flag.
What Gaussian elimination does and when a unique solution exists
Write the problem as A times the column vector of unknowns equals the column vector of constants. The coefficient matrix A must be square of order n, so you have n independent linear equations in n unknowns. Gaussian elimination forms the augmented matrix with A on the left and b on the right, then systematically introduces zeros below the main diagonal.
At stage k the algorithm selects the largest absolute value in column k from row k downward (partial pivoting), swaps that row into position k if needed, and uses row multiples to clear every entry below the pivot. Geometry and algebra agree: a unique solution exists precisely when A is invertible, which in this procedure means every pivot stays away from zero.
Practical use, pricing, limits, and delivery
Use the browser tool when you want an immediate exact solve while checking homework, preparing a lecture on row reduction, or debugging a small circuit, balance, or least-constraint model 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.
Prefer this general n×n Gaussian path when your system is larger than two equations; a dedicated 2×2 Cramer helper remains available for teaching two-line determinants, but searchers who ask for Gaussian elimination expect the algorithm named in the title. Keep n modest and 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.
What you can do with it
Homework and tutoring verification
Students and graders confirm the solution vector for square systems, including singular cases that correctly fail, without a local CAS install.
Small engineering and circuit models
Scripts that balance node voltages, mass flows, or two-to-n parameter linear constraints call a deterministic Ax=b oracle instead of shipping a heavy numeric stack.
FAQ
Does the solver use partial pivoting?
Yes. At each stage it selects the largest absolute value in the active column below the diagonal, swaps rows if needed, then eliminates. That improves numerical stability versus naive elimination.
Is the Gaussian elimination solver free?
The browser tool runs free on your device.
What is the maximum system size?
n is limited to 32 so cost stays within the analytic tier-A envelope. Larger dense systems need a dedicated numeric library or a different capability.
When does a linear system have a unique solution?
When the coefficient matrix is invertible, which during elimination means no pivot becomes zero. The result tells you whether the solution it found is unique.
What does the result show besides the solution?
It lists the pivot value used at each stage and how many rows were swapped. In the three-equation example the first pivot is −3 and the work needs 2 row swaps.
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/algebra/gaussian-elimination \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"A":[[2,1,-1],[-3,-1,2],[-2,1,2]],"b":[8,-11,-3]}'const res = await fetch("https://api.kit.forhosting.com/algebra/gaussian-elimination", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"A": [
[
2,
1,
-1
],
[
-3,
-1,
2
],
[
-2,
1,
2
]
],
"b": [
8,
-11,
-3
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/gaussian-elimination",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"A": [
[
2,
1,
-1
],
[
-3,
-1,
2
],
[
-2,
1,
2
]
],
"b": [
8,
-11,
-3
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/gaussian-elimination", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"A":[[2,1,-1],[-3,-1,2],[-2,1,2]],"b":[8,-11,-3]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"A":[[2,1,-1],[-3,-1,2],[-2,1,2]],"b":[8,-11,-3]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/gaussian-elimination", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"A": [
[
2,
1,
-1
],
[
-3,
-1,
2
],
[
-2,
1,
2
]
],
"b": [
8,
-11,
-3
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.gaussian_elimination",
"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
This capability runs that procedure with partial pivoting on a coefficient matrix you supply as a JSON array of rows and a right-hand side vector of matching length. When a pivot is zero or near zero within a tight tolerance, the coefficient matrix is treated as singular and the request fails with invalid_input instead of inventing a false unique solution.
What Gaussian elimination does and when a unique solution exists
After the forward pass the system is upper triangular: each diagonal entry is a pivot, and the last equation involves only x_n. Back-substitution then solves for x_n, plugs it into the previous row for x_{n-1}, and continues up to x_1. If a column offers no usable pivot, the rows of A are linearly dependent—parallel constraints, an under-determined subsystem, or an inconsistent over-constraint—and this API refuses to invent a unique vector. That matches classroom and production expectations: you either get one stable x or an explicit singular error, never a silent least-squares guess.
How to call the solver and read the response
Numeric dust near zero is cleaned so goldens and human-readable demos stay stable, while ordinary non-integer reals keep full double precision. Partial pivoting improves numerical reliability compared with naive left-to-right elimination without row swaps; it does not change the mathematical solution when A is well conditioned, but it reduces catastrophic cancellation when a small leading entry would otherwise become the pivot. Send a JSON body with required field A, a non-empty array of n rows each of length n of finite numbers, and required field b, an array of n finite numbers. Aliases matrix, a, and coeff are accepted for A; rhs, right_hand_side, and constants are accepted for b. Order n must lie between 1 and 32 inclusive so Worker isolates stay within a conservative analytic cost envelope. The engine validates rectangular shape, matching lengths, and finite numeric cells; missing fields, jagged rows, non-numeric strings, NaN, and Infinity fail immediately with invalid_input and are not charged. During elimination, if the best absolute pivot in a column falls below a tight epsilon near 1e-12, the request fails with a message that the coefficient matrix is singular and no unique solution exists. On success the response always includes x (the solution vector of length n), n, method set to gaussian_elimination, pivots (the diagonal pivots after selection and optional row swaps), row_swaps (how many times two rows were exchanged), and unique set to true. 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 matrices do not consume balance. Results are fully deterministic: the same A and b always yield the same x, pivots, and row_swaps for a given floating-point environment.
Integration use cases
Teaching row reduction and pivoting
Lesson pages show pivots and row_swaps so learners connect partial pivoting and back-substitution to the same unique solution vector.
Technical questions
How do I solve Ax equals b with Gaussian elimination using this API?
Send JSON with square matrix A (array of n rows of length n) and vector b of length n. The response returns x, n, pivots, row_swaps, and unique when a unique solution exists.
What happens if the coefficient matrix is singular?
When a zero or near-zero pivot appears during elimination (within a tight epsilon), the request fails with invalid_input and is not charged — there is no unique solution.