# Cramer’s Rule – Definition, Formulas, and Examples

If you want to solve a system of linear equations involving many variables, then the methods of elimination and substitution become time-consuming. Cramer’s rule is a shorter way of solving such equations easily and quickly. Cramer’s rule makes use of the determinants and their properties to solve a system of linear equations.

Let’s understand what is Cramer’s rule and its formula with examples.

## What is Cramer’s Rule?

Cramer’s rule is one of the important methods applied to solve a system of equations. This rule is named after Gabriel Cramer, who published the rule for an arbitrary number of unknowns in 1750. This is the most commonly used formula for getting the solution for the given system of equations formed through matrices.

In this method, the values of the variables in the system of equations are calculated using the determinants of matrices. Thus, Cramer’s rule is also known as the determinant method. This rule has some limitations with respect to the solutions. This rule can be applied only when the system has unique solutions.

If we have a system of equations in $n$ variables $x_1$, $x_2$, $x_3$, …, $x_n$ written in the matrix form $\text{AX} = \text{B}$, where

• $\text{A}$ = the coefficient matrix which is a square matrix
• $\text{X}$ = the column matrix with variables
• $\text{B}$ = the column matrix with the constants (which are on the right side of the equations)

## Cramer’s Rule Formula

Cramer’s rule of solving a system of linear equations uses a formula involving determinants of matrices obtained from a set of given linear equations. This formula is known as Cramer’s rule formula.

The following steps are used to solve the system of equations

• Find $|\text{A}|$ and represent it by $\text{D}$
• Find the determinants $\text{D}_{x1}$, $\text{D}_{x2}$, $\text{D}_{x3}$, …, $\text{D}_{nn}$, where $\text{D}_{ₓ₁}$ is the determinant of matrix $\text{A}$ where the $i^{th}$ column is replaced by the column matrix $\text{B}$
• Divide each of these determinants $\text{D}_{x1}$, $\text{D}_{x2}$, $\text{D}_{x3}$, …, $\text{D}_{nn}$ by $\text{D}$ to find the value of the corresponding variables. I.e., $x_{1} = \frac{\text{D}_{x1}}{\text{D}}$, $x_{2} = \frac{\text{D}_{x2}}{\text{D}}$, $x_{3} = \frac{\text{D}_{x3}}{\text{D}}$…., $x_{n} = \frac{\text{D}_{xn}}{\text{D}}$.

Note:

• The system of equations has a unique solution only when $\text{D} \ne 0$
• The system of equations has no solution when $\text{D} = 0$

## Cramer’s Rule 2 x 2

Cramer’s rule $2 \times 2$ is used to solve a pair of linear equations involving two variables.

The following steps are used to solve a pair of linear equations in two variables $x$ and $y$ using Cramer’s rule.

Step 1: Write the pair of linear equations in matrix form $\text{AX} = \text{B}$.

Step 2: Find $\text{D}$ which is the determinant of matrix $\text{A}$. Also, find the determinants $\text{D}_x$ and $\text{D}_y$ where

• $\text{D}_x = det (\text{A})$ where the first column is replaced with $\text{B}$
• $\text{D}_y = det (\text{A})$ where the second column is replaced with $\text{B}$

Step 3: Find the values of the variables $x$ and $y$ by dividing each of $\text{D}_x$ and $\text{D}_y$ by $\text{D}$ respectively.

### Examples of Cramer’s Rule 2 x 2

Example 1: Solve pair of linear equations: $3x – y = 7$ and $2x + 5y = -1$.

The given pair of equations is

$3x – y = 7$ ——————————– (1)

$2x + 5y = -1$ ——————————– (2)

Rewriting the equations in the form of matrices, we get

$\begin{bmatrix} 3 & -1\\ 2 & 5 \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix} = \begin{bmatrix} 7\\ -1 \end{bmatrix}$, which is of the form $\text{AX} = \text{B}$, where

• $\text{A} = \begin{bmatrix} 3 & -1\\ 2 & 5 \end{bmatrix}$
• $\text{X} = \begin{bmatrix} x\\ y \end{bmatrix}$
• $\text{B} = \begin{bmatrix} 7\\ -1 \end{bmatrix}$

Therefore,

• $\text{D} = \begin{vmatrix} 3 & -1\\ 2 & 5 \end{vmatrix}$
• $\text{D}_x = \begin{vmatrix} 7 & -1\\ -1 & 5 \end{vmatrix}$ (Replacing $x$ with $\text{B}$)
• $\text{D}_y = \begin{vmatrix} 3 & 7\\ 2 & -1 \end{vmatrix}$ (Replacing $y$ with $\text{B}$)

Now, solving the determinants $\text{D}$, $\text{D}_x$, and $\text{D}_y$, we get

$\text{D} = \begin{vmatrix} 3 & -1\\ 2 & 5 \end{vmatrix} = 3 \times 5 – (-1) \times 2 = 15 + 2 = 17$

$\text{D}_x = \begin{vmatrix} 7 & -1\\ -1 & 5 \end{vmatrix} = 7 \times 5 – (-1) \times (-1) = 35 – 1 = 34$

$\text{D}_y = \begin{vmatrix} 3 & 7\\ 2 & -1 \end{vmatrix} = 3 \times (-1) – 7 \times 2 = -3 – 14 = -17$

Therefore, $x = \frac{\text{D}_x}{\text{D}} = \frac{34}{17} = 2$, and $y = \frac{\text{D}_y}{\text{D}} = \frac{-17}{17} = -1$.

Example 2: Solve pair of linear equations: $2x – y = 1$ and $x + 2y = 13$.

The given pair of equations is

$2x – y = 1$ ——————————- (1)

$x + 2y = 13$ ——————————- (2)

Rewriting the equations in the form of matrices, we get

$\begin{bmatrix} 2 & -1\\ 1 & 2 \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix} = \begin{bmatrix} 1\\ 13 \end{bmatrix}$, which is of the form $\text{AX} = \text{B}$, where

• $\text{A} = \begin{bmatrix} 2 & -1\\ 1 & 2 \end{bmatrix}$
• $\text{X} = \begin{bmatrix} x\\ y \end{bmatrix}$
• $\text{B} = \begin{bmatrix} 1\\ 13 \end{bmatrix}$

Therefore,

• $\text{D} = \begin{vmatrix} 2 & -1\\ 1 & 2 \end{vmatrix}$
• $\text{D}_x = \begin{vmatrix} 1 & -1\\ 13 & 2 \end{vmatrix}$ (Replacing $x$ with $\text{B}$)
• $\text{D}_y = \begin{vmatrix} 2 & 1\\ 1 & 13 \end{vmatrix}$ (Replacing $y$ with $\text{B}$)

Now, solving the determinants $\text{D}$, $\text{D}_x$, and $\text{D}_y$, we get

$\text{D} = \begin{vmatrix} 2 & -1\\ 1 & 2 \end{vmatrix} = 2 \times 2 – (-1) \times 1 = 4 + 1 = 5$

$\text{D}_x = \begin{vmatrix} 1 & -1\\ 13 & 2 \end{vmatrix} = 1 \times 2 – (-1) \times 13 = 2 + 13 = 15$

$\text{D}_y = \begin{vmatrix} 2 & 1\\ 1 & 13 \end{vmatrix} = 3 \times 13 – 1 \times 1 = 26 – 1 = 25$

Therefore, $x = \frac{\text{D}_x}{\text{D}} = \frac{15}{5} = 3$, and $y = \frac{\text{D}_y}{\text{D}} = \frac{25}{5} = 5$.

Example 3: Solve pair of linear equations: $3x – 2y = 7$ and $-6x + 4y = 9$.

The given pair of equations is

$3x – 2y = 7$ ——————————– (1)

$-6x + 4y = 9$ ——————————– (2)

Rewriting the equations in the form of matrices, we get

$\begin{bmatrix} 3 & -2\\ -6 & 4 \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix} = \begin{bmatrix} 7\\ 9 \end{bmatrix}$, which is of the form $\text{AX} = \text{B}$, where

• $\text{A} = \begin{bmatrix} 3 & -2\\ -6 & 4 \end{bmatrix}$
• $\text{X} = \begin{bmatrix} x\\ y \end{bmatrix}$
• $\text{B} = \begin{bmatrix} 7\\ 9 \end{bmatrix}$

Therefore,

• $\text{D} = \begin{vmatrix} 3 & -2\\ -6 & 4 \end{vmatrix}$
• $\text{D}_x = \begin{vmatrix} 7 & -2\\ 9 & 4 \end{vmatrix}$ (Replacing $x$ with $\text{B}$)
• $\text{D}_y = \begin{vmatrix} 3 & 7\\ -6 & 9 \end{vmatrix}$ (Replacing $y$ with $\text{B}$)

Now, solving the determinants $\text{D}$, $\text{D}_x$, and $\text{D}_y$, we get

$\text{D} = \begin{vmatrix} 3 & -2\\ -6 & 4 \end{vmatrix} = 3 \times 4 – (-2) \times )-6) = 12 – 12 = 0$

$\text{D}_x = \begin{vmatrix} 7 & -2\\ 9 & 4 \end{vmatrix} = 7 \times 4 – (-2) \times 9 = 28 + 18 = 46$

$\text{D}_y = \begin{vmatrix} 3 & 7\\ -6 & 9 \end{vmatrix} = 3 \times 9 – 7 \times (-6) = 27 + 42 = 69$

Therefore, $x = \frac{\text{D}_x}{\text{D}} = \frac{46}{0} = \text{Undefined}$, and $y = \frac{\text{D}_y}{\text{D}} = \frac{69}{0} = \text{Undefined}$.

Thus, the pair of equations $3x – 2y = 7$ and $-6x + 4y = 9$ has no solution.

Note: When $\text{D} = 0$, the system of linear equations does not have any solution, i.e., the system of equations is inconsistent.

## Cramer’s Rule 3 x 3

Cramer’s rule $3 \times 3$ is used to solve a system of linear equations involving three variables.

We will just extend the same process of Cramer’s rule for pair of linear equations for a $3 \times 3$ system of equations as well.

The following are the steps to solve this system of 3×3 equations in three variables $x$, $y$, and $z$ by applying Cramer’s rule.

Step 1: Write the system of equations in matrix form $\text{AX} = \text{B}$

Step 2: Find $\text{D}$ which is the determinant of matrix $\text{A}$, i.e., $\text{D} = det (\text{A})$. Also, find the determinants $\text{D}_x$, $\text{D}_y$, and $\text{D}_z$ where

• $\text{D}_x = det (\text{A})$ where the first column is replaced with $\text{B}$
• $\text{D}_y = det (\text{A})$ where the second column is replaced with $\text{B}$
• $\text{D}_z = det (\text{A})$ where the third column is replaced with $\text{B}$

Step 3: Find the values of the variables $x$, $y$, and $z$ by dividing each of $\text{D}_x$, $\text{D}_y$, and $\text{D}_z$ by $\text{D}$ respectively.

### Examples of Cramer’s Rule 3 x 3

Example 1: Solve system of linear equations: $2x + 5y + 2z = -38$, $3x – 2y + 4z = 17$, and $6x – y + 7z = 12$

The given system of equations is

$2x + 5y + 2z = -38$ ———————————– (1)

$3x – 2y + 4z = 17$ ———————————– (2)

$6x – y + 7z = 12$ ———————————– (3)

Rewriting the equations in the form of matrices, we get

$\begin{bmatrix} 2 & 5 & 2\\ 3 & -2 & 4 \\ 6 & -1 & 7 \end{bmatrix} \begin{bmatrix} x\\ y \\ z\end{bmatrix} = \begin{bmatrix} -38 \\ 17 \\ 12 \end{bmatrix}$, which is of the form $\text{AX} = \text{B}$, where

• $\text{A} = \begin{bmatrix} 2 & 5 & 2\\ 3 & -2 & 4 \\ 6 & -1 & 7 \end{bmatrix}$
• $\text{X} = \begin{bmatrix} x\\ y \\ z\end{bmatrix}$
• $\text{B} = \begin{bmatrix} -38\\ 17 \\ 12 \end{bmatrix}$

Therefore,

• $\text{D} = \begin{vmatrix} 2 & 5 & 2\\ 3 & -2 & 4 \\ 6 & -1 & 7 \end{vmatrix}$
• $\text{D}_x = \begin{vmatrix} -38 & 5 & 2\\ 17 & -2 & 4 \\ 12 & -1 & 7\end{vmatrix}$ (Replacing $x$ with $\text{B}$)
• $\text{D}_y = \begin{vmatrix} 2 & -38 & 2\\ 3 & 17 & 4 \\ 6 & 12 & 7 \end{vmatrix}$ (Replacing $y$ with $\text{B}$)
• $\text{D}_z = \begin{vmatrix} 2 & 5 & -38\\ 3 & -2 & 17 \\ 6 & -1 & 12 \end{vmatrix}$ (Replacing $z$ with $\text{B}$)

Now, solving the determinants $\text{D}$, $\text{D}_x$, $\text{D}_y$, $\text{D}_z$,we get

$\text{D} = \begin{vmatrix} 2 & 5 & 2\\ 3 & -2 & 4 \\ 6 & -1 & 7 \end{vmatrix}$

$= 2\begin{vmatrix} -2 & 4\\ -1 & 7 \end{vmatrix} – 5\begin{vmatrix} 3 & 4\\ 6 & 7 \end{vmatrix} + 2\begin{vmatrix} 3 & -2\\ 6 & -1 \end{vmatrix}$

$= 2 \times (-2 \times 7 – 4 \times (-1)) – (-5) \times (3 \times 7 – 4 \times 6) + 2 \times (3 \times (-1) – (-2) \times 6)$

$= 2 \times (-14 + 4) + 5 \times (21 – 24) + 2 \times (-3 + 12)$

$= 2 \times (-10) + 5 \times (-3) + 2 \times 9 = -20 – 15 + 18 =-17$

$\text{D}_x = \begin{vmatrix} -38 & 5 & 2\\ 17 & -2 & 4 \\ 12 & -1 & 7 \end{vmatrix}$

$= -38\begin{vmatrix} -2 & 4\\ -1 & 7 \end{vmatrix} – 5\begin{vmatrix} 17 & 4\\ 12 & 7 \end{vmatrix} + 2\begin{vmatrix} 17 & -2\\ 12 & -1 \end{vmatrix}$

$= -38 \times (-2 \times 7 – 4 \times (-1)) – 5 \times (17 \times 7 – 4 \times 12) + 2 \times (17 \times (-1) – (-2) \times 12)$

$= -38 \times (-14 + 4) – 5 \times (119 – 48) + 2 \times (-17 + 24)$

$= -38 \times (-10) – 5 \times 71 + 2 \times 7 = 380 – 355 + 14 = 39$

$\text{D}_y = \begin{vmatrix} 2 & -38 & 2\\ 3 & 17 & 4 \\ 6 & 12 & 7 \end{vmatrix}$

$= 2\begin{vmatrix} 17 & 4\\ 12 & 7 \end{vmatrix} – (-38)\begin{vmatrix} 3 & 4\\ 6 & 7 \end{vmatrix} + 2\begin{vmatrix} 3 & 17\\ 6 & 12 \end{vmatrix}$

$= 2 \times (17 \times 7 – 4 \times 12) – (-38) \times (3 \times 7 – 4 \times 6) + 2 \times (3 \times 12 – 17 \times 6)$

$= 2 \times (119 – 48) + 38 \times (21 – 24) + 2 \times (36 – 102)$

$= 2 \times 71 + 38 \times (-3) + 2 \times (-66) = -104$

$\text{D}_z = \begin{vmatrix} 2 & 5 & -38\\ 3 & -2 & 17 \\ 6 & -1 & 12 \end{vmatrix}$

$= 2\begin{vmatrix} -2 & 17\\ -1 & 12 \end{vmatrix} – 5\begin{vmatrix} 3 & 17\\ 6 & 12 \end{vmatrix} – 38\begin{vmatrix} 3 & -2\\ 6 & -1 \end{vmatrix}$

$= 2 \times (-2 \times 12 – 17 \times (-1)) – (-5) \times (3 \times 12 – 17 \times 6) – 38 \times (3 \times (-1) – (-2) \times 6)$

$= 2 \times (-24 + 17) + 5 \times (36 – 102) – 38 \times (-3 + 12)$

$= 2 \times (-7) + 5 \times (-66) – 38 \times 9 = -14 – 330 – 342 = -686$

Therefore, $x = \frac{\text{D}_x}{\text{D}} = \frac{39}{-17}= -\frac{39}{17}$, $y = \frac{\text{D}_y}{\text{D}} = \frac{-104}{-17} = \frac{104}{17}$, and $z = \frac{\text{D}_z}{\text{D}} = \frac{-686}{-17} = \frac{686}{17}$.

## Cramer’s Rule Conditions

There are certain conditions to applying Cramer’s rule for solving the given system of equations. Some of them include the following:

• Cramer’s rule fails for the system of equations in which $\text{D} = 0$ since for finding the values of unknowns, $\text{D}$ must be in the denominator, and hence these values go undefined.
• Also, when $\text{D} = 0$, there will be two possibilities for which
• The system may have no solution.
• The system may have an infinite number of solutions.
• From this, we can say that at least one of the numerator determinants is a $0$ (that means infinitely many solutions) or none of the numerator determinants is $0$ (that means no solution)
• If $\text{D} \ne 0$, we say that the system $\text{AX} = \text{B}$ has a unique solution.
• Thus, Cramer’s rule helps us determine whether the given system has “no solution” or an “infinite number of solutions”, using the determinants we calculate to apply the rule.

## Key Takeaways

• If there are $n$ variables and $n$ equations, we have to compute $(n + 1)$ determinants.
• This rule can give the solutions only when $\text{D} \ne 0$.
• If $\text{D} = 0$, the system has either an infinite number of solutions or no solutions.
• We cannot find solutions by using this rule when the system has an infinite number of solutions.

## Practice Problems

Solve the following system of equations using Cramer’s rule.

• $3x + 2y = 8$,  $6x – 4y = 9$
• $x + 3y = 6$,  $2x – 3y = 12$
• $141x + 93y = 189$,  $93x + 141y = 45$
• $x – y + z = 2$, $2x – y – z = -6$, $2x + 2y + z = -3$
• $3x + y + z = 2$, $x + 2y + z = -3$, $3x + y + 2z = 4$
• $x – 3y + z = -5$, $-3x – y – z = 1$, $2x – 2y + 3z = 1$

## FAQs

### Does Cramer’s rule always work?

No, Cramer’s rule does not work always. It is applicable only when the given system of equations has a unique solution.

### What is Cramer’s rule also known as?

Cramer’s rule is also known as the determinant method.

### How does Cramer’s rule work?

Cramer’s rule is used to find the solution of the system of equations with a unique solution. It is also used to find whether the system has a unique solution, no solution, or an infinite number of solutions.

### What is Cramer’s rule definition?

Cramer’s rule states the solution of the system of equations written in the matrix form $\text{AX} = \text{B}$ (where $\text{A}$ is the matrix of coefficients, $\text{X}$ is the column matrix of variables, and $\text{B}$ is the column matrix of coefficients) is obtained by dividing $det (\text{A})$ by the same determinant where the respective columns are replaced by the matrix $\text{B}$.

### What is Cramer’s rule 2×2?

First, write the given system of $2 \times 2$ equations as $\text{AX} = \text{B}$, where $\text{X}$ is a column matrix of the variables $x$ and $y$. Then find the determinants $\text{D}$, $\text{D}_x$, and $\text{D}_y$, where $\text{D} = det(\text{A})$ and $\text{D}_x$ and $\text{D}_y$ are same as $det(\text{A})$ where the first and second columns are respectively replaced by the matrix $\text{B}$. Then we use the following to find the variables $x$ and $y$.
a) $x = \frac{\text{D}_x}{\text{D}}$
b) $y = \frac{\text{D}_y}{\text{D}}$

### What is $\text{D}_x$ in Cramer’s Rule?

To solve a system of equations using Cramer’s Rule, first, we write it in the form $\text{AX} = \text{B}$. Then $\text{D}_x$ is a Cramer’s rule determinant of the coefficient matrix where the first column is replaced with the column matrix $\text{B}$.

### What are the advantages of Cramer’s rule?

Cramer’s rule is used to solve a system of equations where the number of variables is equal to the number of equations. Also, using this rule, we can find the value of finding any variable right away without finding the other variables.

### What is Cramer’s rule 3×3?

First, write the given system of $3 \times 3$ equations as $\text{AX} = \text{B}$, where $\text{X}$ is a column matrix of the variables $x$, $y$, and $z$. Then find the determinants $\text{D}$, $\text{D}_x$, $\text{D}_y$, and $\text{D}_z$, where $\text{D} = det(\text{A})$ and $\text{D}_x$, $\text{D}_y$, and $\text{D}_z$ are same as $det(\text{A})$ where the first, second, and third columns are respectively replaced by the matrix $\text{B}$. Then use the following to find the variables $x$, $y$, and $z$.
a) $x = \frac{\text{D}_x}{\text{D}}$
b) $y = \frac{\text{D}_y}{\text{D}}$
c) $z = \frac{\text{D}_z}{\text{D}}$

## Conclusion

Cramer’s rule is one of the important methods applied to solve a system of equations. In this method, the values of the variables in the system of equations are calculated using the determinants of matrices. But this rule has some limitations with respect to the solutions. This rule can be applied only when the system has unique solutions.