Mathematics · Algebra
Linear system solver — 2×2 and 3×3
Solve a 2×2 or 3×3 linear system and distinguish unique, inconsistent and dependent systems using Gaussian elimination.
Created v1.0
By Thibaut Grzelak, Mechanical Analysis Engineer
Results
- x
- 2
- y
- 1
Unknowns in x, y, z order.
| 1 | 0 | 2 |
| 0 | 1 | 1 |
Results show up to four significant digits for readability; internal calculations retain full precision.
See calculation details
01Determinant of A
det A = a₁₁a₂₂ − a₁₂a₂₁1 × (-1) − 1 × 102[A | b]
[A | b]| 1 | 1 | 3 |
| 1 | -1 | 1 |
03L₂
L₂ ← L₂ − kL₁L₂ ← L₂ − 1 × L₁| 1 | 1 | 3 |
| 0 | -2 | -2 |
04L₂
L₂ ← L₂ / pivotL₂ ← L₂ / (-2)| 1 | 1 | 3 |
| 0 | 1 | 1 |
05L₁
L₁ ← L₁ − kL₂L₁ ← L₁ − 1 × L₂| 1 | 0 | 2 |
| 0 | 1 | 1 |
06Solution state
rank(A) = rank([A | b]) = n2 = 207x
x = b′₁208y
y = b′₂109L₁(x)
a₁₁x + a₁₂y = b₁1 × 2 + 1 × 1 ≈ 310L₂(x)
a₂₁x + a₂₂y = b₂1 × 2 + (-1) × 1 ≈ 111Ax
Ax = b(2 ; 1)01Formulas and symbols
Formulas used
Ax = b
rank(A) = rank([A|b]) = n
A: coefficient matrix; x: unknown vector; b: right-hand side; rank: number of independent pivots.
| Symbol | Meaning |
|---|---|
| A | Matrix A |
| b | Right-hand sides b |
| x | Solution vector |
| det A | Determinant of A |
| [A|b] | Reduced augmented matrix |
02Validation example
Reference numerical case
- x + y = 3 and x − y = 1 give x = 2, y = 1 and determinant −2. Doubling the first equation gives infinitely many solutions if the right side is 6, and no solution if it is 7.
03How it works
Fill the coefficient cells beside x, y and z, then the right-hand side of each equation. Row scaling and partial pivoting reduce the augmented matrix; its ranks determine the solution state.
04Limits and conventions
Real square systems of size 2 or 3. Pivots below 64 times machine epsilon after row scaling are treated as numerical zero. Very ill-conditioned systems may be classified as dependent; this is not symbolic exact arithmetic.
05Common mistakes
Keep coefficient rows and right-hand-side values in the same order. A zero determinant does not distinguish no solution from infinitely many solutions.
06Practical questions
What does it mean when a linear system has no solution?
It means the equations are inconsistent: no vector satisfies all of them at the same time. In row-reduced form this appears as a contradictory row such as 0 = nonzero.
Why can a linear system have infinitely many solutions?
Infinitely many solutions occur when the equations are dependent and do not provide enough independent constraints to determine every unknown uniquely. One or more variables remain free.