Sub topic 12
Extension: Cramer’s Rule and Determinants
This chapter assumes you can solve one-variable linear equations, substitute values into expressions, and use elimination on a system of two linear equations. It also assumes you understand that a system can have one solution, no solution, or infinitely many solutions.
The determinant of a coefficient matrix
Consider the system
\[ ax+by=e \] \[ cx+dy=f \]
The coefficients of \(x\) and \(y\) form a coefficient matrix:
\[ \begin{bmatrix} a & b\\ c & d \end{bmatrix} \]
The determinant of this \(2 \times 2\) matrix is
\[ D=ad-bc \]
The determinant is a single number that helps determine whether the two equations have a unique solution.
| Determinant | Meaning |
|---|---|
| \(D\ne 0\) | The system has exactly one solution |
| \(D=0\) | The system has no unique solution: it has either no solution or infinitely many solutions |
When \(D\ne0\), Cramer’s rule gives the values of \(x\) and \(y\):
\[ x=\frac{Dx}{D} \qquad y=\frac{Dy}{D} \]
where
\[ D_x=ed-bf \]
and
\[ D_y=af-ec \]
Cramer’s rule replaces one coefficient column at a time with the constants column.
Worked example
Solve the system:
\[ 2x+3y=13 \] \[ 5x-2y=4 \]
Here,
\[ a=2,\quad b=3,\quad c=5,\quad d=-2,\quad e=13,\quad f=4 \]
First calculate the main determinant:
\[ D=ad-bc \] \[ D=(2)(-2)-(3)(5)=-4-15=-19 \]
Because \(D\ne0\), the system has exactly one solution.
Now calculate \(D_x\):
\[ Dx=ed-bf \] \[ Dx=(13)(-2)-(3)(4)=-26-12=-38 \]
Then calculate \(D_y\):
\[ Dy=af-ec \] \[ Dy=(2)(4)-(13)(5)=8-65=-57 \]
Use the two quotients:
\[ x=\frac{-38}{-19}=2 \] \[ y=\frac{-57}{-19}=3 \]
Therefore, the solution is
\[ (x,y)=(2,3) \]
Check it in both original equations:
\[ 2(2)+3(3)=4+9=13 \]
\[ 5(2)-2(3)=10-6=4 \]
The ordered pair works in both equations.
from fractions import Fraction
def solve_2x2(a, b, e, c, d, f):
"""Return the unique solution of ax + by = e and cx + dy = f."""
determinant = a * d - b * c
if determinant == 0:
return None
dx = e * d - b * f
dy = a * f - e * c
return Fraction(dx, determinant), Fraction(dy, determinant)
print(solve_2x2(2, 3, 13, 5, -2, 4))
# (Fraction(2, 1), Fraction(3, 1))What happens when the determinant is zero?
A zero determinant means the coefficient rows are dependent. Geometrically, the two lines have the same slope. The lines are either distinct and parallel or they are the same line.
For example:
\[ y=2x+1 \] \[ y=2x-3 \]
Both lines have slope \(2\), so they never intersect. The system has no solution.
In contrast:
\[ x+y=3 \] \[ 2x+2y=6 \]
The second equation is twice the first. Both equations describe the same line, so infinitely many ordered pairs satisfy the system.
The determinant tells you that there is no unique solution, but it does not distinguish these two cases. Use substitution, elimination, or comparison of the equations to decide whether the result is a contradiction or an identity.
Choosing Cramer’s rule
Cramer’s rule has a clear advantage: each variable has a direct formula. It also exposes the condition for a unique solution through \(D\).
However, it requires several determinant calculations. A sign error in \(ad-bc\), \(Dx\), or \(Dy\) changes the answer. Elimination is often faster when one variable already cancels or when the coefficients are simple.
Exercise
For the system \(3x+2y=16\) and \(x-2y=0\), calculate \(D\), \(Dx\), and \(Dy\), then find the solution.
Show answer
\(D=(3)(-2)-(2)(1)=-8\), \(Dx=(16)(-2)-(2)(0)=-32\), and \(Dy=(3)(0)-(16)(1)=-16\). Thus \(x=(-32)/(-8)=4\) and \(y=(-16)/(-8)=2\). The solution is \((4,2)\).