Systems of Linear Equations

A market stall sells apples and bananas, but the price tags have fallen off. All you overhear is two customers at the till: "3 apples and 2 bananas, that's £4", and a moment later, "1 apple and 4 bananas, please — £5." Neither sentence alone tells you what a single apple costs. But the two sentences together pin it down exactly — there is only one pair of prices that makes both true at once.

That is the whole idea of a system of linear equations: several conditions that must all hold true at the same time. Each equation like a_1 x + b_1 y = c_1 draws a straight line; solving the system means finding the point (x, y) that lies on every line at once:

\begin{aligned} a_1 x + b_1 y &= c_1 \\ a_2 x + b_2 y &= c_2 \end{aligned}

Geometrically, the solution is the point where the lines cross. One equation on its own leaves a whole line of possible answers — every pair of prices with 3a + 2b = 4 is "consistent" with the first sentence alone, and there are infinitely many such pairs. The second equation slices that whole line down to a single point — exactly as the second customer's sentence pinned down the price of a banana. This is the pattern behind every system: each new equation is a fresh clue, narrowing an ocean of possibilities down towards one answer, the way each new clue in a puzzle rules out guesses until only one is left standing.

Two roads to the same answer

There are two standard ways to peel a system apart by hand. Try both on x + y = 7 and x - y = 1 and watch them land on the exact same point.

Substitution — solve one equation for one letter, then plug that into the other:

x - y = 1 \;\Rightarrow\; x = y + 1 \quad\text{substitute:}\quad (y+1) + y = 7 \;\Rightarrow\; 2y = 6 \;\Rightarrow\; y = 3,\; x = 4.

Elimination — add or subtract the equations so one letter cancels outright:

\begin{aligned} x + y &= 7 \\ x - y &= 1 \\ \hline 2x \phantom{{}+y} &= 8 \end{aligned} \;\Rightarrow\; x = 4,\quad\text{then}\quad y = 7 - 4 = 3.

Both routes hand back (x, y) = (4, 3). That agreement is not a coincidence — it's the same crossing point, found by two different paths through the algebra. Pick whichever method makes the arithmetic easiest for the system in front of you.

Find the crossing

A system of two equations is really two lines drawn on the same page. Each slider below tilts one line; the dot marks where they cross — the live solution, updating as you drag. Tilt the lines until they run side by side and the dot vanishes: no crossing, no solution.

Try to produce all three outcomes yourself before reading on: park one slider, then hunt for a setting of the other that makes the lines cross far off to one side (a solution with large coordinates), a setting that makes them run perfectly parallel (the dot vanishes — no solution), and finally the one exact setting where the two lines lie completely on top of each other (infinitely many solutions, though on a slider it looks like the dot jumping unpredictably, since "the whole line matches" isn't a single point to mark). Seeing all three with your own hands makes the next card's classification feel obvious rather than memorised.

Three outcomes, not just one

Two straight lines in a plane can relate to each other in exactly three ways — so a system of two linear equations always ends in exactly one of three outcomes:

1. One unique solution — the lines cross at a single point.

x + y = 5, \qquad x - y = 1 \quad\Longrightarrow\quad (x, y) = (3, 2).

2. No solution — the lines are parallel and never meet.

2x + 3y = 6, \qquad 4x + 6y = 10.

Double the first equation and you get 4x + 6y = 12 — same slope as the second equation, but a different constant. Same direction, different line: they run alongside each other forever and never touch.

3. Infinitely many solutions — the two equations are secretly the same line.

2x + 3y = 6, \qquad 4x + 6y = 12.

Here the second equation is the first one, just multiplied by 2. Every point that solves one automatically solves the other, so the whole line is one giant family of solutions.

Never — and that fact is quietly doing a lot of work above. A straight line, by definition, never curves back on itself. Two different straight lines can therefore meet at at most one point: if they touched twice, the segment joining those two touching points would have to be part of both lines, which forces the lines to be identical, not different. That is exactly why there are only three possible outcomes for a system of two linear equations — one crossing, no crossing, or "crossing" everywhere because they're the same line — and never, say, "the lines cross at exactly two points." Curvy graphs don't get this guarantee: a parabola and a line can perfectly well cross twice, which is one reason non-linear systems are a much wilder animal than linear ones.

Back to the market stall

Let a be the price of an apple and b the price of a banana, both in pounds. The two overheard sentences become:

\begin{aligned} 3a + 2b &= 4 \\ a + 4b &= 5 \end{aligned}

Solve by elimination. Multiply the second equation by 3 so the a-terms match:

3a + 12b = 15.

Now subtract the first equation from this new one — the a's cancel:

(3a + 12b) - (3a + 2b) = 15 - 4 \;\Rightarrow\; 10b = 11 \;\Rightarrow\; b = 1.1.

Substitute back into a + 4b = 5:

a + 4(1.1) = 5 \;\Rightarrow\; a = 5 - 4.4 = 0.6.

An apple costs 60p and a banana costs £1.10. Check it against both overheard sentences: 3(0.6) + 2(1.1) = 1.8 + 2.2 = 4 ✓, and 0.6 + 4(1.1) = 0.6 + 4.4 = 5 ✓. Two conditions, one pair of prices.

Notice what would happen if a third customer walked up and said "2 apples and 1 banana, that's £2.20." Plug in the prices we just found: 2(0.6) + 1(1.1) = 1.2 + 1.1 = 2.3 \ne 2.20. That third sentence doesn't fit the same two prices — so either it's a different special offer, or someone mis-heard. A system with more equations than unknowns is called overdetermined, and it often has no solution at all, precisely because there are more conditions than there is freedom left to satisfy them.

A mixing problem

Systems show up just as naturally when you're blending things, not just pricing them. A café sells a house blend made from a mild coffee (£8 per kg) and a strong coffee (£12 per kg). They want to make 10\text{ kg} of house blend that costs exactly £9.60 per kg on average. How many kilograms of each coffee go in?

Let m be the kilograms of mild coffee and s the kilograms of strong coffee. Two facts must both hold: the weights add up to 10\text{ kg}, and the total cost matches £9.60 \times 10 = £96:

\begin{aligned} m + s &= 10 \\ 8m + 12s &= 96 \end{aligned}

Substitute m = 10 - s from the first equation into the second:

8(10 - s) + 12s = 96 \;\Rightarrow\; 80 - 8s + 12s = 96 \;\Rightarrow\; 4s = 16 \;\Rightarrow\; s = 4.

Then m = 10 - 4 = 6. The café needs 6 kg of mild coffee and 4 kg of strong coffee. Same two-condition structure as the apples and bananas — only this time the "conditions" are a total weight and a total cost, not two separate purchases.

A dangerously common slip: solve for x, plug it into y, get an answer — and stop. But an answer that only satisfies the last equation you touched isn't verified yet. Always plug your final (x, y) back into both original equations. If either one fails, an arithmetic slip crept in somewhere and the "solution" is wrong — even though it looked fine a moment ago.

Here's how the slip actually happens. Solving x + y = 7 and x - y = 1, suppose a sign error creeps in during elimination and you arrive at x = 5 instead of 4. Carry that forward into x - y = 1 and you'll get y = 4 — which looks perfectly consistent, because you built it to satisfy that one equation. Only checking against the other equation catches the error: 5 + 4 = 9 \ne 7. The check isn't a formality — it's the only step that can catch this exact class of mistake.

A second trap: treating "no solution" or "infinitely many solutions" as if you'd done something wrong. They haven't — they're exactly as valid and important as a unique answer. A system of parallel supply-and-demand lines that never cross is telling you something real (no price works for both); don't go hunting for a mistake that isn't there.

Long before European algebra had symbols for x and y, Chinese mathematicians were already solving systems with several unknowns. The Nine Chapters on the Mathematical Art (Jiǔzhāng Suànshù), compiled around 200 BCE, lays out a method called fangcheng: arrange the coefficients of a system into a grid of counting rods on a board, then combine rows to cancel unknowns one at a time — precisely the row-by-row cancelling you just did with the apples and bananas. It is, in every meaningful sense, the same idea taught today as Gaussian elimination, roughly 1800 years before Gauss was even born.

The fangcheng rods came in two colours — red for positive amounts, black for negative — so the scribes could cancel a term by adding a red rod to a black one, the same cancellation you did by hand above. Europe wouldn't comfortably accept negative numbers as legitimate quantities for another thousand-plus years, yet this counting-rod arithmetic was already juggling them correctly to solve real systems: grain taxes, exchange rates between different measures, shared costs among travellers — the "apples and bananas" problems of their day.

The same idea now runs at a scale no one with counting rods could dream of. When an airline replans crew and aircraft after a storm grounds half its flights, it is solving systems with thousands of unknowns — which pilot flies which plane, which gate, which connection — all bound together by conditions that must hold simultaneously. Different century, different tools, exactly the same idea: several conditions, one answer that satisfies them all.

Why this is linear algebra

Two equations, two unknowns is easy to picture — but real problems have hundreds of equations in hundreds of unknowns, and lines become flat hyperplanes in high-dimensional space. No one solves those by sketching. Instead we pack the whole system into a single matrix equation A\vec{x} = \vec{b} and let the machinery of matrices do the work. That repackaging is the next step.

It also turns the "three outcomes" you just discovered into a permanent, general fact rather than a two-variable curiosity. Every linear system, no matter how many equations or unknowns it has, ends in exactly one of the same three outcomes: a unique solution, no solution, or infinitely many. The market-stall problem and the coffee-blend problem both happened to land in the first camp — but swap in a third, contradictory coffee order and the system would collapse into the second. Learning to recognise which of the three a matrix equation describes, instantly and without sketching a single line, is exactly what the rest of this topic builds towards.

See it explained