Wize University Linear Algebra Textbook > Determinants

Cramer's Rule for Solving Linear Systems

0:00 / 0:00

Cramer's Rule

Cramer's rule is a method that uses determinants to solve systems of linear equations.

Definition of Ai\colorOne{A_i}

Let An×nA_{n \times n} be an invertible matrix, and let b⃗∈Rn\vec b \in \reals^n be a constant vector:
A=[a11a12…a1na21a22…a11⋮⋮⋮an1an2…ann],b⃗=[b1b2⋮bn]A = \left[ \begin{array}{rrr} a_{11} & a_{12} & \dots & a_{1n}\\ a_{21} & a_{22} & \dots & a_{11}\\ \vdots & \vdots & & \vdots\\ a_{n1} & a_{n2} & \dots &a_{nn}\\ \end{array} \right] ,\qquad \vec b= \begin{bmatrix} b_1\\ b_2\\ \vdots\\ b_n\\ \end{bmatrix}
Define AiA_i to be the matrix AA with column ii replaced by b⃗\vec b.
For example, A2A_2 replaces column 2 of AA:
A2=[a11b1…a1na21b2…a11⋮⋮⋮an1bn…ann]A_{\colorTwo{2}} = \left[ \begin{array}{rrr} a_{11} & \colorTwo{b_1} & \dots & a_{1n}\\ a_{21} & \colorTwo{b_2} & \dots & a_{11}\\ \vdots & \colorTwo{\vdots} & & \vdots\\ a_{n1} & \colorTwo{b_n} & \dots &a_{nn}\\ \end{array} \right]
PAGE BREAK

Cramer's Rule

Each component xix_i of the unique solution x⃗\vec x to the linear system Ax⃗=b⃗A\vec{x}=\vec{b} is given by:
xi=det(Ai)det(A)\boxed{\quad x_i = \dfrac{\detp{A_i}}{\detp{A}} \quad}
Example
Write an expression for each component of the solution vector of the following SLE: [abcd][xy]=[pq]\begin{bmatrix} a&b\\c&d \end{bmatrix} \begin{bmatrix} \colorOne x\\ \colorOne y \end{bmatrix} = \begin{bmatrix} \colorTwo p\\ \colorTwo q \end{bmatrix}.
x=∣pbqd∣∣abcd∣,y=∣apcq∣∣abcd∣\colorOne x= \dfrac{ \left\vert \begin{array}{rr} \colorTwo p&b\\ \colorTwo q&d \end{array} \right\vert } { \left\vert \begin{array}{rr} a&b\\ c&d \end{array} \right\vert } , \qquad \colorOne y= \dfrac{ \left\vert \begin{array}{rr} a&\colorTwo p\\ c&\colorTwo q \end{array} \right\vert } { \left\vert \begin{array}{rr} a&b\\ c&d \end{array} \right\vert }
0:00 / 0:00

Example: Cramer's Rule

Determine the solution to the SLE using determinants:
2x+3y=15x−4y=−3\begin{aligned} 2x+3y&=1\\ 5x−4y&=-3 \end{aligned}
We can write the matrix equation:
[235−4][xy]=[1−3]\begin{bmatrix} 2&3\\ 5&-4 \end{bmatrix}\begin{bmatrix} x\\y \end{bmatrix}=\begin{bmatrix} 1\\ -3 \end{bmatrix}
Apply Cramer's rule:
x=∣13−3−4∣∣235−4∣ = (1)(−4)−(3)(−3)(2)(−4)−(3)(5) = −523x =\dfrac{ \left\vert \begin{array}{rr} 1&3\\ -3&-4 \end{array} \right\vert } { \left\vert \begin{array}{rr} 2&3\\ 5&-4 \end{array} \right\vert } \ =\ \dfrac{(1)(-4)-(3)(-3)}{(2)(-4)-(3)(5)} \ =\ -\dfrac{5}{23}
y=∣215−3∣∣235−4∣ = (2)(−3)−(1)(5)−23 = 1123y=\dfrac{ \left\vert \begin{array}{rr} 2&1\\ 5&-3 \end{array} \right\vert } { \left\vert \begin{array}{rr} 2&3\\ 5&-4 \end{array} \right\vert } \ =\ \dfrac{(2)(-3)-(1)(5)}{-23} \ =\ \dfrac{11}{23}
Therefore, the unique solution is x⃗=[−5231123]\boxed{\vec x = \left[\begin{array}{r} -\dfrac{5}{23}\\[1.5em] \dfrac{11}{23}\\[0.5em] \end{array}\right] }.
Find yy given the system of linear equations:

[0−1142021−2][xyz]=[214]\left[ \begin{array}{rrr} 0&-1&1\\ 4&2&0\\ 2&1&-2 \end{array} \right] \begin{bmatrix} x\\y\\z\\ \end{bmatrix} = \begin{bmatrix} 2\\1\\4\\ \end{bmatrix}

Extra Practice