Solving linear systems using Cramer's Rule

All in One Place

Everything you need for better grades in university, high school and elementary.

Learn with Ease

Made in Canada with help for all provincial curriculums, so you can study in confidence.

Instant and Unlimited Help

Get the best tips, walkthroughs, and practice questions.

0/2
?
Intros
Lessons
  1. Cramer's Rule Overview:
  2. Using Cramer's Rule with 2 x 2 matrices
  3. Using Cramer's Rule with 3 x 3 matrices
0/7
?
Examples
Lessons
  1. Cramer's Rule with 2 x 2 matrices
    Solve the following linear systems with Cramer's Rule"
    1. x+2y=3 x+2y=3
      2x+3y=1 2x+3y=1
    2. 5x+3y=1 5x+3y=1
      x+y=2x+y=2
    3. y=3x+5 y=3x+5
      y=4x2 y=4x-2
    4. 2x+4y=3 2x+4y=3
      4x+8y=64x+8y=6
  2. Cramer's Rule with 3 x 3 matrices
    Solve the following linear systems with Cramer's Rule"
    1. x+4y+3z=1 x+4y+3z=1
      x+2y+9z=1 x+2y+9z=1
      x+6y+6z=1 x+6y+6z=1
    2. x+3y+4z=4 x+3y+4z=4
      x+3y+2z=2 -x+3y+2z=2
      3x+9y+6z=6 3x+9y+6z=-6
    3. 23y3z=x 2-3y-3z=x
      3x+9y=33z 3x+9y=3-3z
      3x+6y+6z4=0 3x+6y+6z-4=0
Topic Notes
?
Last chapter we saw that we are able to solve linear systems with Gaussian Elimination. Now we are going to take a look at a new method which involves solving linear systems with Cramer's Rule. Cramer's Rule requires us to find the determinant of 2 x 2 and 3 x 3 matrices (depends on your linear system). However, this rule can only be used if you have the same number of equations and variables. If you have a different number of equations and variables, then finding the determinant will be impossible. Hence, it will not be possible to use Cramer's rule.

Solving linear systems using Cramers Rule


What is Cramers rule


Cramers rule is a technique to solve systems of linear equations where there are the same amount of unknowns as equations in the system. The technique consists on a set of equations involving determinants and ratios in order to obtain the unique set of solutions for a linear system.

Throughout this lesson we will focus on explaining the method for solving a system that we will call Cramers rule 3x3 and Cramers rule 2x2, this means that we will focus on the cases where we have a system of equations with 3 equations for 3 unknowns (n=3) or a system with 2 equations for 2 unknowns (n=2). The reason for it is that Cramers rule is not practical when a system is of higher order than 3, other methods, such as solving a linear system with matrices using Gaussian elimination, or simply solving systems of linear equations by substitution are much more computationally effective to work through a linear system. Still Cramers rule is an important piece of linear algebra to be considered due its mathematical rigor and the deep understanding of the transcription of linear systems into matrices, and viceversa, when such systems have unique solutions.

How to use Cramers rule


But what is Cramers rule perse? Instead of reciting a Cramers rule definition, let us showcase the technique a little better by going through its steps in detail.

Steps to follow when using Cramers rule linear algebra:

1. \enspace For a linear system of three equations and three unknowns and for a linear system of two equations and two unknowns, as the ones represented below:

ax+by+cz=m ax+ by + cz = m \quad \quad \quad \quad \quad \quad \quad
dx+ey+fz=nax+by=mdx+ey+fz=n \quad \quad ax+by=m
gz+hy+iz=ocx+dy=ngz+hy+iz=o \quad \quad cx+dy=n
Equation 1: Systems of linear equations. 3 equations for 3 unknowns on the left, 2 equations for 2 unknowns on the right


2. \enspace The system of linear equations has to be converted into and augmented matrix.
    1. From the augmented matrix, the elements in the left hand side of the vertical line which represents the equal sign conform a square coefficient matrix. This square coefficient matrix will be used to obtain a series of determinants in our next step.
    2. From the augmented matrix, the elements on the column vector on the right hand side of the equal sign will be used as replacement for certain elements when obtaining the set of determinants in the next step.
    3. The augmented matrices for the system with three equations and 3 unknowns and the system of two equations and two unknowns represented in equation 1 look as follows:

    4. Solving systems of linear equations by graphing
      Equation 2: Augmented matrices from the systems of linear equations

    5. Take into account that Cramers rule can be used with any system of n equations for n unknowns (as long as there are as many equations as unknowns, it doesnt matter the quantity). We have picked to represent the cases in which n=3\, n = 3\, and n=2 \, n = 2 \, since those are usually the ones used before we decide to continue our calculations with a different and more convenient technique.


3. \enspace Then we need to calculate n+1 \, n+1 \, determinants.
    1. In other words, for the case in which n=3 \, n=3 \, , we will be calculating 4 determinants. For the case in which n=2\, n = 2 \, , we will calculate 3 determinants.
    2. The determinants are all named based in the variables contained in the system of linear equations in question. For example, for the case in which the system has three unknowns, you have variables xx, yy, zz, therefore, the determinants are: DxD_x, DyD_y, DzD_z. For the case in which the system has two unknowns, you have the variables xx, yy, therefore, the determinants are: DxD_x, DyD_y. Besides, in each case, there is always an extra determinant we just call DD.
    3. The determinant DD, is always the determinant of the square coefficient matrix (which we called CC) from the left hand side of the augmented matrix. For the systems where n=3\, n= 3 \, and n=2\, n=2 \, . The determinant DD would be as follows:

    4. Solving systems of linear equations by graphing
      Equation 3: Determinant D

    5. The determinants DxD_x, DyD_y, Dz...D_z ... are obtained by replacing the column vector b from equation 2, into the corresponding column on the square coefficient matrix.

Solving systems of linear equations by graphing
Equation 4: Formulating the determinants Dx, Dy, Dz


4. \enspace Once the determinants have been calculated, we just follow the next ratio equations in order to obtain the values of the variables from the systems of equations:

x=DxD \large x= \frac{D_x}{D} \quad \quad \quad \quad \quad

y=DyDx=DxD \large y= \frac{D_y}{D} \quad \quad x= \frac{D_x}{D}

z=DzDy=DyD \large z= \frac{D_z}{D} \quad \quad y= \frac{D_y}{D}
Equation 5: Finding the variables solutions for the systems of linear equations. 3 equations for 3 unknowns on the left, 2 equations for 2 unknowns on the right

In general, each equation for each variable, as shown in equation 5, is what we call the Cramers rule formula. Many books and published materials refer to this simply as Cramers rule, when in reality the technique requires multiple equations. For that same reason, sometimes you may see this technique called the matrix Cramers rule (usually referring to the augmented matrix from equation 2 or the set of determinants from equations 3 and 4).

As you can see, solving systems of equations using Cramers rule becomes very tedious very fast, and this is why this method is usually left on the side and people prefer to use techniques such as row reduction through gaussian elimination. If we compare such two methods, we can clearly see that as the system increases in number of equations, and thus unknowns, the Cramers rule matrices get bigger and the method longer since it requires n+1 amount of determinants to be solved; not only that, the determinants become bigger as n increases too.
Therefore, we are going to focus on solving systems of linear equations with up to 3 equations for 3 unknowns on this lesson, higher n values are suggested to be solved with other techniques for solving systems of linear equations.

Cramers rule to solve system of equations


Having explained the steps on how to do Cramers rule, let us learn how to use it while solving systems of linear equations.
We will divide this section in two parts, one dedicated to solve a system of 2 equations for 2 unknowns (n=2n=2) and the other one dedicated to solve a system with 3 equations for 3 unknowns.

  • Cramers rule for 2x2

Use Cramers rule to solve the system of 2 linear equations for 2 unknowns as shown below:

x+2y=3x+2y=3
2x+3y=12x+3y=1
Equation 6: System of 2 linear equations for 2 unknowns

We convert the system into an augmented matrix:

Solving systems of linear equations by graphing
Equation 7: Augmented matrix for the 2x2 system

And then we calculate the 3 required determinants (remember that step 3 of our method dictates that we need to compute n+1 \, n+1 \, determinants. For this case we have a system of 2 unknowns, thus n=2 \, n=2 \, , therefore n+1=2+1=3\, n+1 = 2+1 =3\, , and so, 3 determinants to be solved).
Following equation 3, we solve the Cramers rule determinant D first:

Solving systems of linear equations by graphing
Equation 8: Cramers rule determinant D

Notice how this determinant DD is just the determinant of the square coefficient matrix from the left hand side of the augmented matrix in equation 7.

Now, to solve the determinants related to each of the variables in the equations from the system we need to substitute the column related to each variable in the square coefficient matrix, by the column coming from the right hand side of the augmented matrix. Thus, the determinants DxD_x, DyD_y are:

Solving systems of linear equations by graphing
Equation 9: Cramers rule determinants related to each variable

To finally find the unique solution for each variable in the equations, we now solve the Cramers rule equation for each of them:

x=DxD=71=7 \large x = \frac{D_x}{D} = \frac{7}{-1} = -7

y=DyD=51=5 \large y = \frac{D_y}{D} = \frac{-5}{-1} = 5
Equation 10: Solution to the variables x and y

And so, the system has been solved! The solutions for the variables xx and yy are: x=7,y=5x=-7, y=5.
Now let us take a look at the process on how to do the Cramers rule 3x3!

  • Cramers rule for 3x3

Use Cramers rule to solve the system of equations for 3 unknowns as shown below:

x+4y+3z=1 x+4y+3z=1
x+2y+9z=1x+2y+9z=1
x+6y+6z=1x+6y+6z=1
Equation 11: System of 3 linear equations for 3 unknowns

We convert the system into an augmented matrix:

Solving systems of linear equations by graphing
Equation 12: Augmented matrix for the 3x3 system

And then we calculate the 4 required determinants. Starting with determinant DD:

Solving systems of linear equations by graphing
Equation 13: Cramers rule determinant D

This determinant DD is just the determinant of the square coefficient matrix from the left hand side of the augmented matrix in equation 12.
Now, to solve the determinants related to each of the variables in the equations from the system we substitute the column related to each variable in the square coefficient matrix by the column coming from the right hand side of the augmented matrix. And so, the determinants DxD_x, DyD_y, DzD_z are:

Solving systems of linear equations by graphing
Equation 14: Cramers rule determinants related to each variable

Solving for the variables xx, yy and zz:

x=DxD=1818=1 \large x = \frac{D_x}{D} = \frac{-18}{-18} = 1

y=DyD=018=0 \large y = \frac{D_y}{D} = \frac{0}{-18} = 0

z=DzD=018=0 \large z = \frac{D_z}{D} = \frac{0}{-18} = 0
Equation 15: Solution to the variables x and y

And so, the system has been solved! x=1,y=0,z=0x=1, y=0, z=0

In summary, in order to use Cramers rule for solving linear equations we: rewrite the system into an augmented matrix, use the left hand side of this matrix as a square coefficient matrix, and the right hand side as a substitution for the solumns related to each variable in the coefficient matrix, set up the n+1 determinants for the system, evaluate determinants and apply Cramers rule equations to find the unique solutions to the variables.

Remember, if you are not completely content with this technique you can always work through a Cramers rule proof by solving the system using any of the other techniques you already know to solve linear systems of equations.

Cramers rule examples


On this section we add a few other examples exercises where we use Cramers rule to solve systems of equations. We start with a few examples of 2x2 systems and end up with a 3x3 problem.

Example 1

Solve the following linear system using Cramers rule:

5x+3y=1 5x+3y=1
x+y=2x+y=2
Equation 16: System of 2 linear equations for 2 unknowns

We convert the system into an augmented matrix:

Solving systems of linear equations by graphing
Equation 17: Augmented matrix for the 2x2 system

And then we calculate the 3 required determinants:

Solving systems of linear equations by graphing
Equation 18: Cramers rule determinants

Now use DD, DxD_x, DyD_y to finally find the unique solution for each variable in the equations:

x=DxD=52=2.5 \large x = \frac{D_x}{D} = \frac{-5}{2} = -2.5

y=DyD=92=4.5 \large y = \frac{D_y}{D} = \frac{9}{2} = 4.5
Equation 19: Solution to the variables x and y

So, the solutions for the variables xx and yy are: x=2.5,y=4.5x=-2.5, y=4.5

Example 2

Solve the following linear system using Cramers rule:

y=3x+5 y=3x+5
y=4x2y=4x-2
Equation 20: System of 2 linear equation for 2 unknowns

We convert the system given above to the standard notation so we can transform it into the augmented matrix later:

y=3x+5 y=3x+5 \quad 3x+y=5 \quad -3x+y=5
y=4x2y=4x-2 \quad 4x+y=2 \quad -4x+y=-2
Equation 21: System of 2 linear equations for 2 unknowns

We convert the system into an augmented matrix:

Solving systems of linear equations by graphing
Equation 22: Augmented matrix for the 2x2 system

And then we calculate the 3 required determinants:

Solving systems of linear equations by graphing
Equation 23: Cramers rule determinants

Now use DD, DxD_x, DyD_y to finally find the unique solution for each variable in the equations:

x=DxD=71=7 \large x = \frac{D_x}{D} = \frac{7}{1} = 7

y=DyD=261=26 \large y = \frac{D_y}{D} = \frac{26}{1} = 26
Equation 24: Solution to the variables x and y

So, the solutions for the variables xx and yy are: x=7,y=26x=7, y=26

Example 3

Solve the following linear system using Cramers rule:

2x+4y=3 2x+4y=3
4x+8y=64x+8y=6
Equation 25: System of 2 linear equations for 2 unknowns

We convert the system into the Cramers rule matrix (augmented matrix):

Solving systems of linear equations by graphing
Equation 26: Augmented matrix for the 2x2 system

And then we calculate the 3 required determinants:

Solving systems of linear equations by graphing
Equation 27: Cramers rule determinants

Now use DD, DxD_x, DyD_y to finally find the unique solution for each variable in the equations:

x=DxD=00=0 \large x = \frac{D_x}{D} = \frac{0}{0} = 0

y=Dyy=00=0 \large y = \frac{D_y}{y} = \frac{0}{0} = 0
Equation 28: Solution to the variables x and y

So, the solutions for the variables xx and yy are: x=0,y=0x=0, y=0

Example 4

For the final Cramers rule example, we will be solving a system of 3 equations for 3 unknowns:

x+3y+4z=4 x+3y+4z=4
x+3y+2z=2-x+3y+2z=2
3x+9y+6z=63x+9y+6z=-6
Equation 29: System of 3 linear equations for 3 unknowns

We convert the system into an augmented matrix:

Solving systems of linear equations by graphing
Equation 30: Augmented matrix for the 3x3 system

And then we calculate the 4 required determinants:

Solving systems of linear equations by graphing
Equation 31: Cramers rule determinants

Now use DD, DxD_x, DyD_y to finally find the unique solution for each variable in the equations:

x=DxD=7236=2 \large x = \frac{D_x}{D} = \frac{72}{-36} = -2

y=DyD=7236=2 \large y = \frac{D_y}{D} = \frac{72}{-36} = -2

y=DzD=10836=3 \large y = \frac{D_z}{D} = \frac{-108}{-36} = 3
Equation 32: Solution to the variables x, y and z

And the system is solved! The solutions for the variables xx, yy and zz are: x=2,y=2,z=3x=-2, y=-2, z=3

For this last exercise we would like to work on a proof of Cramers rule by solving the system from equation 24 using another method and check for the result.
Thus, we use substitution to solve the system:

starting up with the three equations:

x+3y+4z=4x+3y+2z=23x+9y+6z=6 x \, + \, 3y \, + \, 4z=4 \quad \quad \quad -x \, + \, 3y \, + \, 2z=2 \quad \quad \quad 3x \, + \, 9y \, + \, 6z=-6

solve forx x in the 1st equation, and substitute it in the 3rd:

x=43y4zx =4-3y-4z

3(43y4z)+9y+6z=6  3(4-3y-4z) \, + \, 9y \, + \, 6z=-6 \;   6z+12=6 \; -6z \, + \, 12=-6

6z=18  -6z=-18 \;   z=3 \; z=3
Equation 33: Solving the 3x3 system by substitution (part 1)

Now we continue the substitution technique by substituting the found value of the variable zz into the first and second equations and obtain a new simplified system of 2 equations for 2 unknowns:

x+3y+4z=4  x \, + \, 3y \, + \, 4z = 4 \;   x+3y+4(3)=4   \; x \, + \, 3y \, + \, 4(3)= 4 \;   x+3y=8 \; x \, + \, 3y=-8

x+3y+2z=2  -x \, + \, 3y \, + \, 2z = 2 \;   x+3y+2(3)=2   \;-x \, + \, 3y \, + \, 2(3)= 2 \;   x+3y=4 \; - x \, + \, 3y=-4

The new equations are:

x+3y=8x+3y=4x \, + \, 3y=-8 \quad \quad \quad -x \, + \, 3y=-4
Equation 34: Solving the 3x3 system by substitution (part 2)

Using these new expressions found in equation 29, solve for x in the second equation and substitute it in the first equation to find yy:

3y+4=x  3y \, + \, 4=x \;   (3y+4)+3y=8 \; (3y \, + \, 4) \, + \, 3y=-8
6y+4=8  6y \, + \, 4 = -8 \;   6y=12 \; 6y= -12
y=2y=-2
Equation 35: Solving the 3x3 system by substitution (part 3)

And we finalize this by substituting the found value of y into the second expression from equation 29:

x+3y=4  -x \, + \, 3y=-4 \;   x+3(2)=4 \; -x \, + \, 3(-2)=-4
x6=4  -x-6=-4 \;   x=2 \; -x=2
x=2x=-2
Equation 36: Solving the 3x3 system by substitution (part 4)

The final found values for the variables xx,yy and zz are: x=2,y=2,z=3x=-2, y=-2, z=3

Therefore, the unique solutions for the variables in the linear system of equations match with the answers found using Cramers rule for matrices! And you can clearly see that both approaches are good for us to use when solving systems.

To finalize our lesson of today, as always, we have a few recommendations for your further studies. First, this detailed article in which you can find an example of using Cramers rule to solve two equations with two unknowns. And then, this link on the inverse matrix and Cramers rule where you can find an example of a 3x3 system in the bottom.

This is it for this lesson, see you in the next one!
This is a different way of solving linear systems. Instead of using Gaussian Eliminations, you can use Cramer's Rule! Make sure to review your determinants of 2 x 2 and 3 x 3 matrices.

Cramer's Rule for 2 x 2 matrices:
x=DxDx=\frac{D_x}{D}

y=DyDy=\frac{D_y}{D}

Cramer's Rule for 3 x 3 matrices:
x=DxDx=\frac{D_x}{D}

y=DyDy=\frac{D_y}{D}

z=DzDz=\frac{D_z}{D}