Systems of Equations Solver
2×2.
Find the values that fit two or three linear equations at the same time.
- D
- −5
- Dx
- −10
- Dy
- −5
The two lines cross at one point, and D is not 0. Raising the right side of equation 1 by 1 moves x by 0.2 and y by 0.2.
The two equations as lines
Drag the point to move the crossingLine 1 is 2x + 3y = 7. Line 2 is x − y = 1. They cross at (2, 1). Dragging the point keeps both slopes and changes the right sides.
Working
- 1The system2x + 3y = 7x − y = 1
- 2D, the determinant of the coefficientsD = (2)(−1) − (3)(1) =−5
- 3Dx: put the right sides in the x columnDx = (7)(−1) − (3)(1) =−10
- 4Dy: put the right sides in the y columnDy = (2)(1) − (7)(1) =−5
- 5Divide each by Dx=−10−5=2y=−5−5=1
- 6Check: put the answer back into each equation2(2)+3(1)= 71(2)−1(1)= 1
What if a right side changes?
What if a right side changes
| Right side | x | y | Solutions |
|---|---|---|---|
| 3One | 1.2 | 0.2 | One |
| 5One | 1.6 | 0.6 | One |
| 7(yours)One | 2 | 1 | One |
| 9One | 2.4 | 1.4 | One |
| 11One | 2.8 | 1.8 | One |
Each extra 1 on the right side of equation 1 moves x by 0.2 and y by 0.2. Large moves mean the lines are close to parallel, so small errors in your numbers matter.
How it's worked out
Each linear equation in x and y is a straight line of points that make it true. A system asks which point lies on every line at once. There are three methods here, and when a single answer exists, all three reach it.
Cramer's rule
Write the two equations with x and y on the left. The determinant D is one number built from the coefficients. Then and are the same determinant, with the right sides swapped into the x column or the y column.
Three equations work the same way with larger determinants, and a as well. The rule needs D to be something other than 0. When D is 0 it can tell you there is no single answer, but it cannot say which of the other two cases you have, so elimination has to decide.
Elimination
Write the numbers as a grid and use three moves on its rows: swap two rows, multiply a row by a number, or add a multiple of one row to another. None of these changes the solution. You keep going until each unknown stands alone, and the last column then holds the answers. A row that reads 0 = 5 means no solution, and a row of all zeros means one unknown is free.
Substitution
Solve one equation for one unknown and put that into the other equation, which leaves one unknown to find. This is easiest when a coefficient is 1 or −1, so the solver looks for one of those first. In the exact view the numbers stay as fractions in all three methods, so rounding never creeps into the working.
Worked examples
A theater counts its tickets
A theater sold 120 tickets, some at $8 and some at $5, and took in $780. Let x be the $8 tickets and y the $5 tickets. One fact counts tickets and one counts money, which gives x + y = 120 and 8x + 5y = 780.
The first equation has coefficients of 1, so substitution suits it: . Putting that in leaves , so y = 60 and x = 60. Check it the way the box office would: 60 tickets at $8 plus 60 at $5 is $780.
Dana mixes two solutions
Dana needs 10 L of a 25% solution and has a 10% and a 40% stock. Let x and y be the liters of each. The volumes add to 10, and the pure substance adds to 25% of 10, which is 2.5 L. That gives x + y = 10 and 0.1x + 0.4y = 2.5.
The answer is 5 L of each. That makes sense, because 25% sits exactly halfway between 10% and 40%. If she wanted a target nearer one stock, she would need more of that stock.
Sam works out prices from three receipts
Sam has three receipts from a cafe: one coffee, one muffin and one sandwich for $12; two coffees, three muffins and a sandwich for $19; and one coffee, one muffin and two sandwiches for $19. With x, y and z as the three prices, each receipt is one equation.
The determinant is 1, so there is one answer: the coffee is $3, the muffin is $2 and the sandwich is $7. You can spot the sandwich straight away, since the first and third receipts differ by one sandwich and $7.
Reading your result
Every system lands in one of three cases. The determinant D separates the first case from the other two, and elimination separates those two from each other.
| System | D | Result |
|---|---|---|
| x + 2y = 4; 3x − y = 5 | −7 | Lines cross once, at (2, 1) |
| x + 2y = 4; 2x + 4y = 3 | 0 | Parallel lines, no solution |
| x + 2y = 4; 2x + 4y = 8 | 0 | The same line, infinitely many |
In the last row the second equation is just twice the first, so it adds nothing new. Any point on the line works, and you write the answer with y free: . Pick any y and that gives you the x to go with it.
The right sides tell you how firm an answer is. For the steady pair x + y = 2 and x − y = 0, adding 1 to a right side moves x by only 0.5. For the nearly parallel pair x + y = 2 and x + 1.001y = 3, adding 1 to the second right side moves y by 1,000. If your numbers came from measurements, an answer like that is not one to trust.
Exact fractions help you compare with a textbook. The answer to 2x + y = 1 and x + 2y = 1 is and . As a decimal that is about 0.333333, which can only ever be close.
Common mistakes
- Leaving an equation unsorted. Before you read off coefficients, move the x and y terms to the left and the number to the right. In , the x coefficient is −3 and the y coefficient is 1, with 2 on the right.
- Skipping a zero. An equation such as has a y coefficient of 0, and that 0 still has to be entered. Its line is vertical, at x = 3.
- Mixing up the columns in Cramer's rule. For the right sides replace the x column, not the y column. Swapping them gives you y over D, and then the two answers trade places.
- Calling D = 0 "no solution". D = 0 only means there is no single solution. Parallel lines have no solution and a repeated line has infinitely many, and both of those give D = 0.
- Stopping before the check. Put your answer back into every equation, not just the one you used last. An answer that fits only one of them points to a slip in the arithmetic.