24  Systems of equations

Two unknowns, two constraints

Two streaming plans. Plan A charges $6 per month plus $3 per film. Plan B charges $15 per month with unlimited films. At some number of films per month they cost exactly the same. Where is that crossover?

Two walkers start from opposite ends of a 9 km path. One walks at 4 km/h, the other at 5 km/h. When do they meet, and where?

Both questions have the same shape: two things you don’t know, two separate facts about them. A single equation can pin down one unknown. To pin down two, you need two.

24.1 What the notation is saying

Here are the two streaming plans written as equations. Let \(m\) = months (fixed at 1, so we can drop it) and \(f\) = number of films rented:

\[\begin{cases} \text{Cost}_A = 6 + 3f \\ \text{Cost}_B = 15 \end{cases}\]

When the costs are equal: \(6 + 3f = 15\). One unknown, one equation — you already know how to solve this.

Now for the walkers. Let \(t\) = time in hours, \(d\) = distance walked by the first walker. Two facts:

\[\begin{cases} d + (9 - d) = 9 \\ d = 4t \quad \text{and} \quad 9 - d = 5t \end{cases}\]

Rewriting cleanly:

\[\begin{cases} d + 5t = 9 \\ d - 4t = 0 \end{cases}\]

Read the curly brace as “both of these must be true at the same time.” That is a system. The solution is the pair of values \((d,\, t)\) that satisfies both equations simultaneously.

24.1.1 The general form

The standard 2×2 system looks like this:

\[\begin{cases} a_1 x + b_1 y = c_1 \\ a_2 x + b_2 y = c_2 \end{cases}\]

Here \(x\) and \(y\) are the unknowns. The numbers \(a_1, b_1, c_1\) and \(a_2, b_2, c_2\) are given — they are the coefficients (the multipliers of \(x\) and \(y\)) and the constant terms (the values on the right).

24.1.2 Compact matrix notation

The same system can be written using a matrix — just the coefficients arranged in a rectangular array:

\[\begin{pmatrix} a_1 & b_1 \\ a_2 & b_2 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} c_1 \\ c_2 \end{pmatrix}\]

Say it as: the 2×2 matrix of coefficients, multiplied by the column of unknowns, equals the column of constants. This notation is compact — it stores the same information without repeating \(x\) and \(y\) on every line. For a 2×2 system it’s a convenience. For a 100×100 system (as in circuit analysis or machine learning), it’s essential.

The matrix itself — the rectangular array of coefficients — is written with parentheses around it:

\[A = \begin{pmatrix} a_1 & b_1 \\ a_2 & b_2 \end{pmatrix}\]

Read “\(A\)” as “the coefficient matrix.” The entries are: top-left \(a_1\) (coefficient of \(x\) in the first equation), top-right \(b_1\) (coefficient of \(y\) in the first equation), and so on.

24.2 The method

Three methods solve a 2×2 system. Each is worth knowing: the graphical method shows you what you’re doing, substitution is efficient for small systems, and elimination is the one that scales.

24.2.1 Method 1 — Graphical

Each equation is a straight line. The solution is where the two lines cross.

\[\begin{cases} x + y = 5 \\ x - y = 1 \end{cases}\]

Rearrange each equation into \(y = mx + b\) form:

  • Line 1: \(y = -x + 5\) (slope \(-1\), intercept \(5\))
  • Line 2: \(y = x - 1\) (slope \(1\), intercept \(-1\))

Plot both. They cross at \((3, 2)\). Check: \(3 + 2 = 5\) ✓ and \(3 - 2 = 1\) ✓.

Three possible outcomes:

What the lines do What it means
Cross at one point One unique solution
Are parallel (never cross) No solution — the equations contradict each other
Are the same line Infinitely many solutions — one equation gives no new information

24.2.2 Method 2 — Substitution

Solve one equation for one variable, then substitute into the other. This eliminates one unknown and leaves a single equation you can solve directly.

\[\begin{cases} x + y = 5 \qquad (1) \\ x - y = 1 \qquad (2) \end{cases}\]

From equation (1): \(x = 5 - y\).

Substitute into equation (2):

\[(5 - y) - y = 1\]

\[5 - 2y = 1\]

\[-2y = -4 \implies y = 2\]

Now substitute \(y = 2\) back into \(x = 5 - y\):

\[x = 5 - 2 = 3\]

Solution: \(x = 3\), \(y = 2\).

When to use it: substitution works cleanly when one equation already has a variable with coefficient 1 (so there’s no fraction to deal with when you isolate it).

24.2.3 Method 3 — Elimination

Multiply one or both equations by constants to make the coefficient of one variable the same (or opposite) in both equations. Then add or subtract to eliminate that variable.

\[\begin{cases} 2x + 3y = 12 \qquad (1) \\ 4x - y = \phantom{1}5 \qquad\;\; (2) \end{cases}\]

The coefficient of \(y\) is \(3\) in equation (1) and \(-1\) in equation (2). Multiply equation (2) by \(3\) to make the \(y\)-coefficients match in magnitude:

\[3 \times (2): \quad 12x - 3y = 15 \qquad (2')\]

Now add equations (1) and (2’):

\[(2x + 3y) + (12x - 3y) = 12 + 15\]

\[14x = 27 \implies x = \frac{27}{14}\]

Substitute into equation (1):

\[2 \cdot \frac{27}{14} + 3y = 12 \implies \frac{27}{7} + 3y = 12 \implies 3y = 12 - \frac{27}{7} = \frac{57}{7} \implies y = \frac{19}{7}\]

Check in equation (2): \(4 \cdot \frac{27}{14} - \frac{19}{7} = \frac{54}{7} - \frac{19}{7} = \frac{35}{7} = 5\)

When to use it: elimination is best when no variable has a coefficient of 1, or when the numbers make substitution awkward. It’s also the method that generalises directly to 3×3 and larger systems (Gaussian elimination).

24.3 Why this works

The determinant tells you whether a unique solution exists

For the system \(\begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} e \\ f \end{pmatrix}\), define the determinant:

\[\det(A) = ad - bc\]

Read it as: top-left times bottom-right, minus top-right times bottom-left.

  • If \(\det(A) \neq 0\): one unique solution exists. The two lines cross.
  • If \(\det(A) = 0\): no unique solution. The lines are parallel (no solution) or identical (infinitely many).

For the system \(\begin{cases} x + y = 5 \\ x - y = 1 \end{cases}\), the matrix is \(\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\) and \(\det = (1)(-1) - (1)(1) = -2 \neq 0\). One solution. ✓

The determinant is a quick test before you do any work. If it’s zero, stop — no amount of algebra will produce a unique answer.

24.4 Worked examples


Example 1 — Business: supply and demand equilibrium.

A market for concert tickets has a supply curve and a demand curve:

\[\begin{cases} p = 2q + 10 \qquad \text{(supply: price rises with quantity)} \\ p = -3q + 60 \qquad \text{(demand: price falls as quantity rises)} \end{cases}\]

Here \(p\) = price (dollars), \(q\) = quantity (thousands of tickets). The equilibrium is where supply price equals demand price.

Set the right-hand sides equal (substitution):

\[2q + 10 = -3q + 60\]

\[5q = 50 \implies q = 10\]

\[p = 2(10) + 10 = 30\]

Equilibrium: 10,000 tickets at $30 each.

Check in the demand equation: \(-3(10) + 60 = -30 + 60 = 30\)

The determinant check: rewrite as \(\begin{cases} 2q - p = -10 \\ -3q - p = -60 \end{cases}\). Matrix \(\begin{pmatrix} 2 & -1 \\ -3 & -1 \end{pmatrix}\), \(\det = (2)(-1) - (-1)(-3) = -2 - 3 = -5 \neq 0\). Unique solution confirmed.


Example 2 — Engineering: two-loop circuit (Kirchhoff’s laws).

A simple circuit has two loops. Kirchhoff’s voltage law says the voltage drops around each loop must sum to zero. After applying the law to each loop, the unknowns are the two loop currents \(I_1\) and \(I_2\) (in amps):

\[\begin{cases} 3I_1 + 2I_2 = 12 \qquad \text{(loop 1: total 12 V)} \\ 2I_1 + 5I_2 = 14 \qquad \text{(loop 2: total 14 V)} \end{cases}\]

Use elimination. Multiply equation (1) by 5 and equation (2) by 2:

\[\begin{cases} 15I_1 + 10I_2 = 60 \\ 4I_1 + 10I_2 = 28 \end{cases}\]

Subtract the second from the first:

\[11I_1 = 32 \implies I_1 = \frac{32}{11} \approx 2.91 \text{ A}\]

Substitute into equation (1):

\[3 \cdot \frac{32}{11} + 2I_2 = 12 \implies \frac{96}{11} + 2I_2 = 12 \implies 2I_2 = 12 - \frac{96}{11} = \frac{36}{11} \implies I_2 = \frac{18}{11} \approx 1.64 \text{ A}\]

Check in equation (2): \(2 \cdot \frac{32}{11} + 5 \cdot \frac{18}{11} = \frac{64 + 90}{11} = \frac{154}{11} = 14\)


Example 3 — Science: mixture problem.

A lab needs 80 mL of a 35% saline solution. The lab has a 20% solution and a 50% solution. How many mL of each should be mixed?

Let \(x\) = mL of the 20% solution, \(y\) = mL of the 50% solution.

Two constraints:

\[\begin{cases} x + y = 80 \qquad \text{(total volume)} \\ 0.20x + 0.50y = 0.35 \times 80 = 28 \qquad \text{(total salt)} \end{cases}\]

From equation (1): \(x = 80 - y\). Substitute into equation (2):

\[0.20(80 - y) + 0.50y = 28\]

\[16 - 0.20y + 0.50y = 28\]

\[0.30y = 12 \implies y = 40\]

\[x = 80 - 40 = 40\]

Mix 40 mL of the 20% solution with 40 mL of the 50% solution.

Check: salt = \(0.20(40) + 0.50(40) = 8 + 20 = 28\) and \(28/80 = 0.35\)


Example 4 — Computing: game resource constraints.

A game character can perform two actions: attacking costs 3 energy and 1 second, defending costs 1 energy and 2 seconds. In one round, the character uses exactly 14 energy and 8 seconds. How many attacks and defends did they perform?

Let \(a\) = attacks, \(d\) = defends.

\[\begin{cases} 3a + d = 14 \qquad \text{(energy)} \\ a + 2d = 8 \qquad\;\, \text{(time)} \end{cases}\]

From equation (1): \(d = 14 - 3a\). Substitute into equation (2):

\[a + 2(14 - 3a) = 8\]

\[a + 28 - 6a = 8\]

\[-5a = -20 \implies a = 4\]

\[d = 14 - 3(4) = 2\]

Four attacks and two defends.

Check energy: \(3(4) + 2 = 14\) ✓. Check time: \(4 + 2(2) = 8\) ✓.

Determinant check: matrix \(\begin{pmatrix} 3 & 1 \\ 1 & 2 \end{pmatrix}\), \(\det = (3)(2) - (1)(1) = 5 \neq 0\). Unique solution. ✓

24.5 Where this goes

This chapter handled two unknowns and two equations. Real systems are often much larger — 10 unknowns, 100, or more. The method that scales is Gaussian elimination: the same idea as the elimination you learned here, applied row by row to a matrix. That is the core of linear algebra (Vol 7). Matrix notation, which you saw as a shorthand here, becomes indispensable there — you’ll work with eigenvalues, matrix inverses, and linear transformations that are impossible to write without it.

When systems get large enough, solving them exactly becomes computationally expensive. Numerical methods (Vol 7) replace exact algebra with iterative algorithms — methods that get close enough, fast enough, for engineering and data science work. Systems of equations are the motivating problem that drives a large part of that volume. The determinant you met here generalises too: for an \(n \times n\) matrix, the same zero/non-zero test predicts whether a unique solution exists.

Where this shows up

  • Engineering: Kirchhoff’s voltage and current laws applied to a circuit produce one equation per loop or node. A circuit with two loops gives a 2×2 system; a real circuit might give a 50×50 system solved by computer using the same method.
  • Science: Chemical stoichiometry — balancing an equation with two unknown coefficients — is a 2×2 system. Equilibrium calculations in physical chemistry are similar.
  • Finance: Supply and demand equilibrium is the intersection of two linear functions. Every introductory economics model of price-setting is a system of equations.
  • Computing: Linear regression with two parameters solves a 2×2 system. Graphics engines apply matrix transformations (systems of equations) to every vertex on screen, thousands of times per second.

24.6 Exercises

These are puzzles. The interesting part is setting up the system — translating the situation into two equations before you solve.


1. Two friends are buying supplies for a camping trip. Rashida buys 3 bags of trail mix and 2 water bottles for $19. Tomasz buys 1 bag of trail mix and 4 water bottles for $17. What does one bag of trail mix cost, and what does one water bottle cost?


2. A cinema charges one price for adults and another for children. Two families bought tickets last Saturday:

  • The Nguyens: 3 adults and 2 children, total $32.
  • The Garcias: 1 adult and 4 children, total $24.

What is the adult ticket price? What is the child ticket price?


3. Two cyclists start from the same point at the same time and ride in opposite directions. After 3 hours they are 132 km apart. One rides 6 km/h faster than the other. What is each cyclist’s speed?


4. Use the determinant to decide, without solving, whether each system has a unique solution, no solution, or infinitely many solutions.

(a) \[\begin{cases} 2x + 4y = 8 \\ x + 2y = 4 \end{cases}\]

(b) \[\begin{cases} 3x - y = 5 \\ 6x - 2y = 7 \end{cases}\]

(c) \[\begin{cases} 5x + 3y = 11 \\ 2x - y = 3 \end{cases}\]


5. Two phone plans:

  • Plan X: $20 per month plus $0.10 per text.
  • Plan Y: $35 per month, unlimited texts.

(a) Set up a system and find the number of texts per month where both plans cost the same.

(b) If you send 200 texts per month, which plan is cheaper and by how much?


6. A chemist has two alcohol solutions: one is 30% alcohol, the other is 70% alcohol. She needs 200 mL of a 45% solution.

How many mL of each solution should she mix?

(Hint: write one equation for total volume and one for total amount of alcohol.)