Solving a System Three Different Ways

One system solved by substitution, by Cramer's rule and by the matrix inverse, with the same answer each time and guidance on when each method is worth using.

--

The same pair of equations can be solved by substitution, by Cramer's rule, or with a matrix inverse. All three must agree — so the interesting question is not which is correct, but which is worth using when.

Concept The system
 2x + y = 4
 x + 3y = 7

Every method below works on this one system, so the answers can be compared directly.

Example Method 1 — substitution
Rearrange the first equation for  y :
 y = 4 - 2x
Substitute into the second:
 x + 3(4 - 2x) = 7
 x + 12 - 6x = 7
 -5x = -5 , so  x = 1
Back-substitute:  y = 4 - 2(1) = 2
⟹ x = 1, y = 2

No formulas to memorise — but with awkward coefficients the algebra gets messy quickly.

Example Method 2 — Cramer's rule

Build three determinants: the coefficient determinant, then one for each variable.

 D = \begin{vmatrix} 2 & 1 \\ 1 & 3 \end{vmatrix} = 6 - 1 = 5
Replace the x-column with the constants:
 D_x = \begin{vmatrix} 4 & 1 \\ 7 & 3 \end{vmatrix} = 12 - 7 = 5
Replace the y-column instead:
 D_y = \begin{vmatrix} 2 & 4 \\ 1 & 7 \end{vmatrix} = 14 - 4 = 10
 x = \frac{D_x}{D} = \frac{5}{5} = 1
 y = \frac{D_y}{D} = \frac{10}{5} = 2
⟹ x = 1, y = 2
Example Method 3 — the matrix inverse
Write the system as  AX = B :
 \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 4 \\ 7 \end{pmatrix}
The determinant is 5, so the inverse exists:
 A^{-1} = \frac{1}{5}\begin{pmatrix} 3 & -1 \\ -1 & 2 \end{pmatrix}
Then  X = A^{-1}B :
 x = \frac{(3)(4) + (-1)(7)}{5} = \frac{12 - 7}{5} = 1
 y = \frac{(-1)(4) + (2)(7)}{5} = \frac{-4 + 14}{5} = 2
⟹ x = 1, y = 2
Concept Choosing a method
system x=1, y=2 substitution Cramer inverse
Substitution is quickest for small, tidy systems. Cramer's rule is systematic and suits programming. The inverse pays off for large systems, or when the same  A is reused with different values of  B .
Note Points to watch
Check that  D \neq 0 before using Cramer's rule or the inverse.
Always substitute the answer back into the original equations.
Keep the variables in the same order in every row.
A sign slip in one determinant changes the whole answer.
Summary
  1. Substitution, Cramer's rule and the matrix inverse all solve the same system.
  2. For 2x + y = 4 and x + 3y = 7 every method gives x = 1, y = 2.
  3. Cramer's rule uses D = 5, Dx = 5 and Dy = 10.
  4. The inverse method solves X = A⁻¹B in one multiplication.
  5. All three need D ≠ 0, and every answer should be checked by substitution.