In this explainer, we will learn how to use Cramer’s rule to solve a system of linear equations.

This will involve using determinants to solve systems of two and three linear equations.

Cramer’s rule gives us a useful way of solving simultaneous equations; for example, it allows us to solve a system of equations for one variable independently without having to solve for all the variables.

Cramer’s rule was devised by Gabriel Cramer, a Genevan mathematician, in 1750, and what he devised was a way of solving a system of linear equations using a matrix equation and the determinants of the matrices involved.

We are now going to look at Cramer’s rule and how it is used. Let’s start with a system of two linear equations.

### Definition: Cramer’s Rule for a System of Two Linear Equations in Two Unknowns

If we have the following system of two linear equations in two unknowns, and , with constants –, which can be converted to the matrix equation Cramer’s rule tells us that if the determinant of the coefficient matrix is nonzero, then is the unique solution to this system of equations.

This is often simplified to where , , and are the determinants of the matrices found by substituting the elements of the constants matrix with the elements from the columns of the - and -coefficients and the determinant of the coefficient matrix. Cramer’s rule can be extended to any number of linear equations. For example, for a system of three equations in three unknowns, we get the following.

### Definition: Cramer’s Rule for a System of Three Equations in Three Unknowns

If we have the following system of three linear equations in three unknowns, , , and , with constants –, which can be converted to the matrix equation Cramer’s rule tells us that if is nonzero, then is the unique solution to this system of equations, where , , , and are the determinants of the matrices found by substituting the elements of the constants matrix with the elements from the columns of the -, -, and -coefficients and the determinant of the coefficient matrix.

However, it is worth pointing out Cramer’s rule can be generalized to linear equations in unknowns and different notation may be seen; for example, for the determinant of a matrix, you might see or . In this explainer, we will use notation in the form and we will only deal with systems of linear equations with at most 3 unknowns.

Now we know what Cramer’s rule is and how to use it, but where does it come from?

To see where Cramer’s rule comes from, let’s attempt to solve the following system of linear equations:

We want to eliminate a variable; assuming both and are nonzero, we multiply the top equation by and the bottom equation by and then subtract:

Factoring this gives us

Finally, if ,

In our notation, this is ; we could do exactly the same for . In fact, we can do the same for higher-order matrices, provided the determinant is nonzero.

Now, for our first example, we are going to look at a question that explains a condition of the rule.

### Example 1: Determining the Applicability of Cramer’s Rule in Solving a System of Linear Equations with an Infinite Solution Set

Is Cramer’s rule useful for finding solutions to systems of linear equations in which there is an infinite set of solutions?

### Answer

The short answer to this question is no, as Cramer’s rule is not applicable when the system of linear equations has an infinite number of solutions.

Let us explore why. There are two ways for a system of linear equations to have an infinite number of solutions. First, there could be more variables than equations. In this case, Cramer’s rule is not applicable since we need the coefficient matrix to be square. Second, if the determinant of the coefficient matrix is zero, then there can be an infinite number of solutions or zero solutions. However, as we can see in our formula for Cramer’s rule, we divide by the determinant of the coefficient matrix; we cannot do this if it is equal to zero. Hence, Cramer’s rule is not applicable.

So, we can conclude that Cramer’s rule would not be useful for finding the solutions to systems of linear equations in which there is an infinite set of solutions.

We have now looked at the conditions of the rule, but before we move on to looking at examples of how to use the rule, we will quickly recap how to find the determinant of and matrices.

### How To: Finding the Determinant of a 2 × 2 and a 3 × 3 Matrix

If we begin with a matrix, then

We get this result by subtracting the product of the diagonals.

Now, for a matrix, then, using the first row to find the determinant, we get

When looking at the determinant of a matrix, an important key point to remember is that the coefficients, that you multiply the matrix minors by, the pattern , , as shown above.

At this point, we also remember that the determinant can be calculated using any row or column.

Let us recap how we found the cofactor:

If we take the element a and then we delete the column and row that it is in, then the four remaining elements form our cofactor.

Having reminded ourselves how to find determinants, we will now look at some examples of using Cramer’s rule to solve systems of linear equations.

### Example 2: Solving a System of Two Equations Using Determinants

Use determinants to solve the system

### Answer

The first step is to set up a matrix equation for our system of equations:

Now, as we are looking to solve the system of equations using determinants, we will recall Cramer’s rule.

Provided is nonzero, is the unique solution to this system of equations, where and are the determinants of the matrices found by substituting the elements of the constants matrix with the elements from the columns of the - and -coefficients, as follows:

To apply Cramer’s rule, we need to determine , , and . We will start with :

With this result, not only have we found , but since is nonzero, we have shown that we can find a unique solution to our system of equations.

Next, we will calculate :

Finally, we will calculate :

We will now substitute in the values for our determinants into the solution given by Cramer’s rule to find the values of and : therefore,

Now, if we look at , therefore,

In conclusion, we can say that the unique solution to the system of linear equations is

At this point, we can perform a quick check by substituting the values of and into the original set of equations to check that both equations are satisfied, as follows:

In the first equation,

In the second equation,

In our next example, we will look at a problem in which the system of equations will need to be rearranged before solving.

### Example 3: Solving a System of Two Equations Using Determinants

Use determinants to solve the system

### Answer

In this question, we are asked to solve a system of two linear equations in two variables. We could do this by eliminating a variable; however, we will use Cramer’s rule.

For a system of equations with two unknowns, Cramer’s rule states that if is nonzero, then is the unique solution to the system.

Therefore, the first step is to rearrange our equations into a form that can be easily converted into a matrix equation:

Now that we have our system in this form, we set up a matrix equation:

At this point, we remember that and are the determinants of the matrices found as a result of substituting the elements of the constants matrix with the elements from the columns of the - and -coefficients, as follows:

The next stage is to calculate the required determinants. We will start with :

With this result, not only have we found , but we have also shown that we can solve our system of equations, since the determinant of the coefficient matrix is not zero.

Next, we will calculate :

Finally, we will calculate :

We have everything we need to use Cramer’s rule to solve our system of equations. We will now substitute in the values for the determinants to find the values of and : therefore,

Now, if we calculate , therefore,

In conclusion, we can say that the unique solution to the system of equations is

In the previous two examples, we have looked at problems involving two unknowns. In the next example, we will look at a system of three linear equations with three unknowns.

### Example 4: Solving a System of Three Equations Using Determinants

Use determinants to solve the system

### Answer

To solve a system of three equations in three unknowns by using determinants, we can use Cramer’s rule provided that the determinant of the coefficient matrix is nonzero.

Then, the unique solution is given by

The first step is to rearrange our equations so that we have the constant terms on their own. We do this so that the system can be easily converted into a matrix equation:

Now that we have our system in this form, we set up a matrix equation:

Next, using Cramer’s rule, we remember that , , and are the determinants of the matrices that are the result of substituting the elements of the constants matrix with the elements from the columns of the -, -, and -coefficients, as follows:

The next stage is to calculate the required determinants; we will start with :

With this result, not only have we found , but we have also shown that we can find a unique solution to our system of equations. This is because the value of is nonzero.

Next, we will calculate :

Then, we will calculate :

Finally, we will calculate :

Now, we have everything we need to use Cramer’s rule to solve our system of equations; we substitute our values for the determinants into the unique solution given by Cramer’s rule to find the values of , , and as follows: therefore,

Now, we calculate : therefore,

Finally, we calculate : therefore,

In conclusion, we can say that the unique solution to the system of linear equations is

For the final example, we will look at a question where the system of equations is given in terms of determinants.

### Example 5: Solving a System of Three Equations Using Determinants

Solve, using Cramer’s rule, the simultaneous equations

### Answer

To enable us to use Cramer’s rule in this problem, the first step is to evaluate the determinants of the matrices:

Now that we have the determinants, we can form a system of three equations that can then be used to set up a matrix equation:

As we have been asked to solve the system of equations using determinants, we are going to recall Cramer’s rule: if the determinant of the coefficient matrix is nonzero, then there is a unique solution to the system given by

To apply Cramer’s rule, we will rewrite the system as a matrix equation; however, we need to be careful to include zero coefficients in our coefficient matrix. To help us do this, we can rewrite our system of equations to include the zero coefficients before writing it as a matrix equation:

When written as a matrix equation, we get

At this point, we remember that , , and , from Cramer’s rule, are the determinants of the matrices that are formed as a result of substituting the elements of the constants matrix with the elements from the columns of the -, -, and -coefficients, as follows:

The next stage is to calculate the required determinants; we will start with :

Next, we will calculate :

Then, we will calculate :

Finally, we will calculate :

We will now substitute our values for the determinants into the unique solution from Cramer’s rule to find our values of , , and : therefore,

Now, we calculate : therefore,

Finally, we will look at : therefore,

In conclusion, we can say that the unique solution to the system of linear equations is

Let us finish by recapping some basic points.

### Key Points

- For the following system of equations with two unknowns, Cramer’s rule tells us that if is nonzero, then the system has a unique solution given by
- For the following system of equations with three unknowns, Cramer’s rule tells us that if is nonzero, then the system has a unique solution given by
- Cramer’s rule can be extended to linear equations in unknowns.
- To find , , or , we substitute the values in the constants matrix for the column in the coefficient matrix that is identified and find the determinant of the newly formed matrix.
- A necessary condition of Cramer’s rule is that the determinant of the coefficient matrix is not equal to zero.