Two numbers are hiding from you. All you get are two clues about them. How do you pin them down exactly?
Say the clues are: twice the first number, plus the second, is . And the first number minus the second is . That's it. That's the whole puzzle. And yet, somehow, exactly one pair of numbers satisfies both clues at once.
We write clues like this as equations:
This is called a system of equations, two statements that both have to be true at the same time. And there are three classic ways to crack it: substitution, elimination, and matrices. They're not competing techniques you memorize separately. They're the same idea, viewed from three angles, and by the end you'll see exactly how they connect.
What does "solving a system" actually mean?
Here's the picture worth holding onto before any algebra happens: each equation is a line, and the solution is wherever the lines cross.
Think of it like a treasure map. One clue says "the treasure is somewhere on this line." On its own, that's useless, the line has infinitely many points on it. But a second clue draws a different line. Now there's only one spot that satisfies both, the single point where the two lines meet.
Drag the white handle to rotate the second line around its fixed point. Watch where it crosses the green line.
Notice what happens as you rotate the line: the crossing point slides smoothly... until the two lines become parallel, and the crossing point vanishes entirely. No crossing means no solution. That's not a special case to memorize, it falls straight out of the picture. Two non-parallel lines in a plane always cross exactly once, so a system with two genuinely different equations always has exactly one answer, unless you get unlucky and they never meet at all.
Now the question is just: how do we find that point without dragging a slider?
Method 1: Substitution, or trading one unknown for the other
Here's the core trick. If one equation tells you what equals in terms of , you can just... swap it in everywhere shows up in the other equation. Suddenly that other equation only has one unknown left.
Take . Rearranged, that's . Now plug that directly into :
Look what happened. is gone. What's left is a single-variable equation, , which anyone can solve: . Then we go back and recover using .
Press play and watch substitution turn two unknowns into one, step by step.
That's substitution in full: isolate one variable, swap it into the other equation, solve what's left, then back-substitute. It shines when one of your equations already has a variable sitting by itself, like . But if both equations are tangled up, say and , isolating a variable means dragging fractions through every step. That's when the next method starts looking better.
Method 2: Elimination, or combining clues directly
Here's the interesting move: you're allowed to add two true equations together, and the result is still true. If and , then adding the left sides and the right sides gives another true statement:
And look, the terms cancel: , so immediately, no substitution required.
But you don't have to add the equations as-is. You can scale one of them by any number first, and the sum is still a valid equation that the same solution satisfies. That gives you a whole family of equations to choose from, and your job is just to pick the that makes one variable's coefficient hit exactly zero.
Slide k. The combined line always passes through the same solution, but at just the right k, one variable disappears.
Watch the combined line as you slide : it swings around, but it always passes through the same solution point. That's not a coincidence, since the original point makes both equations equal zero, it makes every combination of them equal zero too. Elimination is just substitution's cousin: instead of swapping in an expression, you cancel a variable by construction. It's fastest exactly when a small multiple of one equation lines up with the other, like coefficients that are already equal or opposite.
Method 3: Matrices, or elimination running the machine
Here's where it gets interesting. Strip the 's and 's away and all that's really in a system are the coefficients. We can package those into a grid, a matrix, and write the whole system as one compact statement:
That matrix isn't just a storage box for numbers. It's a machine. Feed it any point , and it stretches and skews the whole plane, sending that point somewhere new. Solving is asking one question: which input point gets sent exactly to by this machine?
Press play. The grid warps into the matrix's transformation, and the point x rides along until it lands exactly on target b.
Watch the grid warp as the machine turns on. Our answer, , rides along with it, and by the time the transformation finishes, it lands precisely on the target . That's the geometric meaning of a solution: it's whatever input the matrix maps to your target output. To actually compute it, we run the machine in reverse, using its inverse matrix , so that . And that inverse is built, under the hood, from exactly the row-scaling-and-adding moves you just did by hand in elimination. Matrices don't replace elimination, they're elimination, organized so it scales to ten equations as easily as two.
Which method should you actually use?
All three always agree, because they're answering the same question. But they're not equally fast on every system.
Reach for substitution when one equation already isolates a variable cleanly, like . Reach for elimination when the coefficients are simple enough that adding or subtracting a small multiple cancels a variable right away. Reach for matrices the moment you have three or more equations, or you're solving the same kind of system repeatedly, since setting it up once as means every future system with a different is just one matrix inversion away.
The short version
A system of equations asks for the one point where two lines cross. Substitution finds it by solving one equation for a variable and swapping that into the other, collapsing two unknowns into one. Elimination finds it by adding scaled copies of the equations together until a variable cancels on its own. Matrices repackage the whole system as , turning "solve the system" into "find the input a transformation sends to a target output," which is really elimination running underneath, just organized to handle far more than two equations at once.
Same crossing point, three different roads to it. Pick whichever one the numbers in front of you make easiest.
All visualizations are interactive React components running entirely in your browser, computing every intersection, every elimination step, and every matrix transform live from the numbers you choose. No libraries beyond React.