The formula
Write the system as A·x = b, where A holds the coefficients.
Form the augmented matrix [A | b] and apply Gauss–Jordan elimination: swap rows, scale a row, add a multiple of one row to another.
rank(A) = rank([A | b]) = number of unknowns → one solution
rank(A) = rank([A | b]) < unknowns → infinitely many solutions
rank(A) < rank([A | b]) → no solution
Worked example
- 2x + 3y − z = 5, x − y + 2z = 3, 3x + y + z = 10.
- Augmented matrix: [2 3 −1 | 5; 1 −1 2 | 3; 3 1 1 | 10]; the determinant of the coefficients is 5, so there is one solution.
- After elimination: x = 23/5 = 4.6, y = −2, z = −9/5 = −1.8.
- Check the first equation: 2(4.6) + 3(−2) − (−1.8) = 9.2 − 6 + 1.8 = 5 ✓
What is a system of linear equations?
A system of linear equations is a set of equations that share the same unknowns, where each unknown appears only to the first power and is never multiplied by another unknown. Two equations in x and y describe two straight lines, and the solution is the point where they cross. Three equations in x, y and z describe three planes. Systems like this appear throughout science, engineering and economics: mixing solutions to a target concentration, balancing chemical equations, analysing electrical circuits with Kirchhoff's laws and finding the break-even point between costs and revenue.
How to enter your equations
Type each equation with its variables and an equals sign, and separate equations with semicolons: for example "3x + 2y = 12; x − y = 1". You can use any single letters as variables, put terms on either side of the equals sign and use decimals or fractions such as 1/2x. The solver gathers like terms, so "2x + 3 = y" is fine. It can handle as many unknowns as you like, as long as each is a single letter, and it tells you when there are more unknowns than independent equations.
Gauss–Jordan elimination
The calculator uses Gauss–Jordan elimination, the systematic version of the elimination method taught at school. It writes the coefficients as an augmented matrix and uses three row operations, swapping rows, multiplying a row by a non-zero number and adding a multiple of one row to another, to turn the coefficient part into the identity matrix. The right-hand column then contains the solution. To limit rounding errors, it picks the largest available number in each column as the pivot, a technique called partial pivoting.
One, none or infinitely many solutions
A linear system has exactly one solution, no solution or infinitely many. Two parallel lines never meet, so their system is inconsistent and has no solution. Two equations describing the same line have infinitely many solutions, because every point on the line satisfies both. The calculator decides which case applies by comparing the rank of the coefficient matrix with the rank of the augmented matrix. For a square system, a non-zero determinant guarantees a unique solution. You can explore determinants, inverses and ranks in our matrix calculator.
Solving by hand: substitution and elimination
For two equations, substitution is often quickest: rearrange one equation for one variable and substitute it into the other. For 3x + 2y = 12 and x − y = 1, x = y + 1, so 3(y + 1) + 2y = 12, which gives y = 1.8 and x = 2.8. Elimination works well when coefficients line up: multiply the second equation by 2 and add it to the first to remove y, giving 5x = 14. Cramer's rule, which divides determinants, is elegant for 2 × 2 and 3 × 3 systems but inefficient for larger ones.
Non-linear equations and other tools
If an equation contains squared terms, products of variables or functions such as square roots, the system is non-linear and this solver can't handle it directly. A single equation with x² can be solved with our quadratic equation calculator. For checking the slope and intercept of a straight line through two points, use the slope, distance and midpoint calculator. For arithmetic with fractional answers, the fraction calculator shows exact working.