System of Linear Equations Solver
Solve systems of 2 or 3 linear equations with multiple unknowns.
2×2 System
3×3 System
Quick Examples
Solving Systems of Equations
A system of linear equations has a unique solution if the coefficient matrix is non-singular (determinant ≠ 0).
Cramer's Rule (2×2)
Where D is the determinant of the coefficient matrix, Dₓ replaces the first column with constants, and Dᵧ replaces the second column.
Solution Types
| Condition | Solution |
|---|---|
| D ≠ 0 | Unique solution |
| D = 0, Dₓ = 0, Dᵧ = 0 | Infinite solutions |
| D = 0, Dₓ ≠ 0 or Dᵧ ≠ 0 | No solution |
Geometric Interpretation
- 2×2: Intersection point of two lines
- 3×3: Intersection point of three planes
What Is a System of Linear Equations?
A system of linear equations is a set of two or more linear equations that share the same variables. A solution is a set of values that makes every equation true at the same time. Geometrically, each equation is a line (in 2D) or a plane (in 3D), and the solution is where they all intersect.
The standard forms the calculator accepts are:
The Three Possible Outcomes
A linear system has exactly one of three outcomes — the calculator detects all three automatically:
| Outcome | 2×2 Geometry | Algebraic Sign | Example |
|---|---|---|---|
| Unique solution | Lines intersect at one point | Determinant D ≠ 0 | x + y = 5, x − y = 1 → (3, 2) |
| No solution | Parallel lines, never meet | D = 0 but Dx or Dy ≠ 0 | x + y = 4, x + y = 9 → impossible |
| Infinitely many | Same line (coincident) | D = Dx = Dy = 0 | 2x + 2y = 8 is just x + y = 4 doubled |
For 3×3 systems the picture extends to planes: three planes can meet at one point, form a line or a plane of solutions, or miss each other entirely.
Solution Methods
Substitution Method
Solve one equation for one variable, then substitute that expression into the other equation. Best when a variable already has coefficient 1 or −1.
Worked example: Solve 2x + y = 7 and x − y = 2. From the second equation, x = y + 2. Substitute into the first: 2(y + 2) + y = 7 → 3y + 4 = 7 → y = 1, then x = 3. Solution: x = 3, y = 1. Check: 2(3) + 1 = 7 ✓ and 3 − 1 = 2 ✓
Elimination Method
Add or subtract multiples of the equations to cancel one variable. Best when coefficients match or are easy multiples.
Worked example: Solve 3x + 2y = 16 and 3x − y = 7. Subtract the second from the first: 3y = 9 → y = 3. Back-substitute: 3x + 6 = 16 → 3x = 10 → x = 10/3, y = 3. Check: 3(10/3) + 2(3) = 10 + 6 = 16 ✓ and 10 − 3 = 7 ✓
Cramer's Rule
For a 2×2 system, form the coefficient determinant D = a1b2 − a2b1, then replace one column at a time with the constants: Dx = c1b2 − c2b1, Dy = a1c2 − a2c1. Then:
Worked example: Solve 2x + 3y = 7 and x − y = 1. D = 2(−1) − 1(3) = −5. Dx = 7(−1) − 1(3) = −10. Dy = 2(1) − 7(1) = −5. So x = (−10)/(−5) = 2, y = (−5)/(−5) = 1. Check: 2(2) + 3(1) = 7 ✓ and 2 − 1 = 1 ✓. For 3×3 systems the same idea applies with 3×3 determinants for D, Dx, Dy, and Dz.
Matrix Method (Inverse Matrix)
Write the system as AX = B, where A is the coefficient matrix, X the variable column, and B the constants. If A is invertible (determinant ≠ 0), the solution is X = A−1B. This is the most compact formulation and the one computers generalize to any size system.
Gaussian Elimination
Write the augmented matrix and use row operations (swap rows, multiply a row, add a multiple of one row to another) until it is in triangular form, then back-substitute. This is the workhorse method for 3×3 systems and the basis of most numerical solvers.
Worked 3×3 example: Solve x + y + z = 6, 2x + y + 3z = 13, x + 2y + z = 8.
- Start: rows [1 1 1 | 6], [2 1 3 | 13], [1 2 1 | 8]
- R2 ← R2 − 2R1 and R3 ← R3 − R1: [0 −1 1 | 1], [0 1 0 | 2]
- R2 ← −R2, then R3 ← R3 − R2: [0 0 1 | 3] → z = 3
- Back-substitute: y − 3 = −1 → y = 2; x + 2 + 3 = 6 → x = 1
- Check all three: 1 + 2 + 3 = 6 ✓, 2 + 2 + 9 = 13 ✓, 1 + 4 + 3 = 8 ✓
Which Method Should You Use?
| Method | Best For | Strength | Weakness |
|---|---|---|---|
| Substitution | Small systems with a coefficient of 1 | Intuitive, minimal arithmetic | Fractions appear quickly otherwise |
| Elimination | 2×2 with matchable coefficients | Clean integer arithmetic | Needs planning for 3×3 |
| Cramer's rule | 2×2 and 3×3 theory, determinants | Direct formula per variable | Slow for larger systems; fails at D = 0 |
| Matrix inverse | Repeated systems with the same A | Solve once, reuse for many B | Computing the inverse is work |
| Gaussian elimination | 3×3 and larger, computers | Systematic, scales to any size | Many steps by hand |
Real-World Applications
- Business: Break-even analysis with two products sharing production constraints.
- Chemistry: Balancing chemical equations is solving a system for integer coefficients.
- Traffic engineering: Flow conservation at intersections gives one equation per junction.
- Electrical circuits: Kirchhoff's laws produce systems for the unknown currents.
- Mixtures: Blending two solutions of different concentrations to hit a target strength.
- Economics: Supply and demand equilibrium across interconnected markets.
Common Mistakes to Avoid
- Never verifying: Substitute the answer into every original equation — a solution must satisfy all of them.
- Dividing by a zero determinant: Cramer's rule and the matrix inverse require D ≠ 0; a zero determinant means no unique solution, not x = 0.
- Unbalanced row operations: In elimination, whatever you multiply one equation by must multiply the entire equation, constants included.
- Mixing up Dx and Dy: Dx replaces the x-column (first) with constants; Dy replaces the y-column (second).
- Sign errors in substitution: Solving x − y = 2 for x gives x = y + 2, not x = y − 2.
Homogeneous Systems
A homogeneous system has all zero constants (e.g., x + 2y = 0, 2x + 4y = 0). It always has the trivial solution x = 0, y = 0. It has additional (nontrivial) solutions exactly when the determinant is zero — then the equations are dependent and the solution set is a line. Here D = 1(4) − 2(2) = 0, so every point with x = −2y works: (−2, 1), (−4, 2), and so on.
Solving Larger Systems
The same ideas scale up. Gaussian elimination handles 4×4, 10×10, or 1000×1000 systems with the identical row-operation routine — which is why it (not Cramer's rule) is what computers use. The matrix method shines when many systems share one coefficient matrix: compute A−1 once, then multiply by each new constants vector. For genuinely nonlinear systems (with x2 or xy terms), none of these methods apply directly — those need substitution or numerical methods.