# Solving System Of Linear Equations Using Cramer’s Rule

Cramer’s rule is a method of solving the system of linear equations using determinants. It is named after Gabriel Cramer (1704–1752) who discovered this method. In this article we are going to discuss and work few examples for solving system of linear equations using Cramer’s rule.

Before you start reading about Cramer’s rule, learn to compute determinant of 2 x 2 and 3 x 3 matrix as a prerequisite to this article : Finding Determinants Using Cross Multiplication.

Coefficient Matrix and Augmented Matrix

Given a system of equation you can derive a coefficient matrix and an augmented matrix from it. Both are the same thing with little different.

Suppose you are given a system of linear equations with 2 unknowns.

$a_{11}x + a_{12}y = b_1$

$a_{21}x + a_{22}y = b_2$

The augmented matrix and coefficient matrix would look like the following.

The system of linear equation is in the form of $Ax = b$ which is written as

$Ax = b$$Ax = b$

$\begin{bmatrix}a_{11} & a_{12}\\a_{21} & a_{22}\end{bmatrix} . \begin{bmatrix}x \\ y\end{bmatrix} = \begin{bmatrix}b_1 \\ b_2\end{bmatrix}$$\begin{bmatrix}a_{11} & a_{12}\\a_{21} & a_{22}\end{bmatrix} . \begin{bmatrix}x \\ y\end{bmatrix} = \begin{bmatrix}b_1 \\ b_2\end{bmatrix}$

The matrix $A$ is coefficient matrix, $x$ is a column vector of unknowns, and $b$ represents the constant vector.

Determinant Of 2 x 2 Matrix

The determinant of a 2 x 2 matrix can be calculated using cross multiplication.

$A = \begin{bmatrix}a_{11} & a_{12}\\a_{21} & a_{22}\end{bmatrix}$$A = \begin{bmatrix}a_{11} & a_{12}\\a_{21} & a_{22}\end{bmatrix}$

$|A| = \begin{vmatrix}a_{11} & a_{12}\\a_{21} & a_{22}\end{vmatrix} = a_{11}a_{22} - a{12}.a_{21}$$|A| = \begin{vmatrix}a_{11} & a_{12}\\a_{21} & a_{22}\end{vmatrix} = a_{11}a_{22} - a{12}.a_{21}$

Example #1

Find the determinant of $A = \begin{bmatrix}2 & 1\\3 & 7\end{bmatrix}$.

Solution:

$|A|= \begin{vmatrix}2 & 1\\3 & 7\end{vmatrix} = 14 - 3 = 11$$|A|= \begin{vmatrix}2 & 1\\3 & 7\end{vmatrix} = 14 - 3 = 11$

### Solving System of Equations with 2 Unknowns With Cramer’s Rule

Given a system of equations with 2 unknowns you can solve it using Cramer’s rule by following steps.

1. Find the augmented matrix and the coefficient matrix for the system of equations.
2. Find the determinant of $D$ of matrix $A$.
3. Replace the $x$ coefficients of coefficient matrix $A$ with constant vector $b$ to get x-matrix and find its determinant $D_x$
4. Replace the $y$ coefficients of coefficient matrix $A$ with constant vector $b$ to get y-matrix and find its determinant $D_y$
5. Find the solution to system of linear equation according to following equations.
$x = \frac{\strut D_x}{\strut D}$$x = \frac{\strut D_x}{\strut D}$

$y = \frac{\strut D_y}{\strut D}$$y = \frac{\strut D_y}{\strut D}$

See the following figure to understand how the matrices look like.

Given a system of equations such as shown above, first derive the augmented matrix and coefficient matrix. The coefficient matrix has no constant vector. Use the coefficient matrix to get the determinant of matrix $A$ which is $D$.

X Matrix And Y Matrix

You can get x matrix by replacing the first column which is x column by the constant vector. See the image below.

Similarly, compute the y matrix from coefficient matrix of $A$. Compute the determinant of x matrix which is $D_x$ and compute the determinant of y matrix which is $D_y$.

To find the solution to each unknowns use the following formula, mentioned earlier.

Solution for x

$x = \frac{\strut D_x}{\strut D}$$x = \frac{\strut D_x}{\strut D}$

Solution for y

$y = \frac{\strut D_y}{\strut D}$$y = \frac{\strut D_y}{\strut D}$

In the next section, we will solve a system of linear equation with two unknown.

Example #1

Find the solution to following system of linear equations with two unknowns using Cramer’s rule.

$x + 3y = 5$.

$5x - 2y = 8$.

Solution:

Given the system of linear equations we can obtain augmented matrix and coefficient matrix.

$A = \begin{bmatrix}1 & 3 & 5\\5 & -2 & 8\end{bmatrix}$$A = \begin{bmatrix}1 & 3 & 5\\5 & -2 & 8\end{bmatrix}$

The coefficient matrix must be a square matrix, so lets write the augmented matrix in the form $Ax = b$$Ax = b$ in that order.

$Ax = b$$Ax = b$

$\begin{bmatrix}1& 3\\5 & -2\end{bmatrix} . \begin{bmatrix}x & y\end{bmatrix} = \begin{bmatrix}5 & 8\end{bmatrix}$$\begin{bmatrix}1& 3\\5 & -2\end{bmatrix} . \begin{bmatrix}x & y\end{bmatrix} = \begin{bmatrix}5 & 8\end{bmatrix}$

Compute the determinant of the matrix $A$$A$

$D = \begin{vmatrix}1& 3\\5 & -2\end{vmatrix} = -2 - 15 = -17$$D = \begin{vmatrix}1& 3\\5 & -2\end{vmatrix} = -2 - 15 = -17$

Compute the determinant of the $x$$x$ matrix.

$D_x = \begin{vmatrix}5 & 3\\8 & -2\end{vmatrix} = -10 - 24 = -34$$D_x = \begin{vmatrix}5 & 3\\8 & -2\end{vmatrix} = -10 - 24 = -34$

Compute the determinant of the $y$$y$ matrix.

$D_y = \begin{vmatrix}1& 5\\5 & 8\end{vmatrix} = 8 - 25 = -17$$D_y = \begin{vmatrix}1& 5\\5 & 8\end{vmatrix} = 8 - 25 = -17$

Therefore,

$x = \frac{\strut -34}{\strut -17} = 2$$x = \frac{\strut -34}{\strut -17} = 2$

$y = \frac{\strut -17}{\strut -17} = 1$$y = \frac{\strut -17}{\strut -17} = 1$

We can verify the solution by substitution.

$(2) + 3(1) = 5$$(2) + 3(1) = 5$

$5(2) - 2(1) = 8$$5(2) - 2(1) = 8$

The solutions to the system of linear equations are correct.

### Solving System Of Equations With 3 Unknowns Using Cramer’s Rule

We can solve the system of equations with 3 unknowns which gives a $3 \times 3$ square matrix using the Cramer’s rule.

Though we need to compute the determinant of additional sub-matrices because there is one more unknown other than x and y. Let us call it z.

The steps remain the same as we solved for $2 \times 2$ matrix. Here is the list of steps.

Let $A$$A$ be a $3 \times 3$$3 \times 3$ matrix.

Step 1: Compute determinant $D$$D$ of $A$$A$.

Step 2: You must extract sub-matrices or minors from the matrix $A$$A$ and take determinant