# Cramer's Rule Calculator

Instructions: Use this calculator to solve a system of equations you provide using Cramer's rule, showing all the steps. First, click on one of the buttons below to specify the dimension of the system (number of equations and variables). For example, "2x2" means "2 equations and 2 variables"

Then, fill out the coefficients associated to all the variables and the right hand size, for each of the equations. If a variable is not present in one specific equation, type "0" or leave it empty.

x   +   y   +   z   =
x   +   y   +   z   =
x   +   y   +   z   =

Solving systems of linear equations is one of the paramount objects in Algebra. This is because many different applications lead directly to solving such systems.

Could be that your working with a word problem, or assigning optimal diets to soldiers in the Army, you will stumble upon some kind of a linear system.

And Cramer's Rule is one of the most common approaches to solving large systems of linear equations, especially when the number of equations is the same as the number of variables.

It is not that Cramer's Rule will simplify the number of operations required to solve a system of equations, its fame is based upon the fact that it is a rule that is easy to memorize.

### First: How is Cramer's rule calculated?

Step 1: For Cramer's Rule to work, you need to start with a system of equations that has the same number of equations as the number of variables. If that is not the case, stop, you cannot use Cramer's Rule.

Step 2: Identify the system of equation in matrix form: $$Ax = b$$, where $$A$$ is a $$n \times n$$ matrix that contains the coefficients that multiply the variables and $$A_{ij}$$ is the coefficient that multiplies the jth variable in the ith equation, and $$b$$ is a vector of size $$n$$ that collects all the right hand side of each of the equations.

Step 3: Compute the determinant of the matrix $$A$$. If $$\det(A) = 0$$, the system has more than one solution, and Cramer's Rule cannot do anything else.

Step 4: You define the associated matrix $$A^{j}$$ to be the same as the matrix $$A$$, except that column j of the matrix $$A$$ is replaced by $$b$$.

Step 5: If $$\det(A) \ne 0$$, there is a unique solution, and the components $$x_j$$ , with $$j = 1, 2, ..., n$$ are computed as

$x_j = \displaystyle \frac{\det(A^j) }{\det(A)}$

### How you do Cramer's rule on a calculator?

Different calculators will conduct the Cramer's Rule for you, but majority won't show you the steps. Out calculator will guide you through all the steps, with all the details.

### How do you solve a 4x4 matrix in Cramer's rule?

One of the reasons why Cramer's rule is so popular is that its formulation really does not change much, if at all, for different system sizes.

Indeed, doing Cramer's Rule for a 4x4 system is not any harder than doing it for a 2x2 system (other than the calculation of the determinants involved will be more laborious)

Ultimately, regardless of the size of the system, you compute the solutions according to

$x_j = \displaystyle \frac{\det(A^j) }{\det(A)}$

which means that you take the original matrix, and replace a column of $$A$$ by $$b$$ and compute the determinants and find the quotient of them.

### How to do Cramer's rule calculator for ax=b

Solving ax=b in this context refers to solving $$Ax = b$$ at the matrix level. So the trick for correctly using Cramer's Rule is to correctly convert a given system of equations into a matrix equation of the form $$Ax = b$$.

### Example of the use of Cramer's Rule

Question: The following $$3 \times 3$$ system of linear equations has been provided:

\begin{aligned} 2 x&\, + \, &3 y&\, + \, &4 z & \, = \,1\\2 x&\, + \, &3 y&\, + \, &2 z & \, = \,5\\ x&\, + \, &2 y&\, + \, &8 z & \, = \,2 \end{aligned}

Solve the above system using Cramer's Rule, showing all the steps.

Solution:

### Step 1: Find the corresponding Matrix Structure

The first step consists of finding the corresponding matrix $$A$$ and vector $$b$$ that allow the system to be written as $$A x = b$$.

In this case, and based on the coefficients of the equations provided, we get that

$A = \begin{bmatrix} \displaystyle 2&\displaystyle 3&\displaystyle 4\\[0.6em]\displaystyle 2&\displaystyle 3&\displaystyle 2\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 8 \end{bmatrix}$

and

$b = \begin{bmatrix} \displaystyle 1\\[0.6em]\displaystyle 5\\[0.6em]\displaystyle 2 \end{bmatrix}$

### Step 2: Compute the Determinant of the Matrix

Now, we need to compute the determinant of $$A$$ in order to know whether or not we can use Cramer's Rule:

Using the sub-determinant formula we get:

$\begin{vmatrix} \displaystyle 2&\displaystyle 3&\displaystyle 4\\[0.6em]\displaystyle 2&\displaystyle 3&\displaystyle 2\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 8 \end{vmatrix} = 2 \cdot \left( 3 \cdot \left( 8 \right) - 2 \cdot \left(2 \right) \right) - 3 \cdot \left( 2 \cdot \left( 8 \right) - 1 \cdot \left(2 \right) \right) + 4 \cdot \left( 2 \cdot \left( 2 \right) - 1 \cdot \left(3 \right) \right)$ $= 2 \cdot \left( 20 \right) - 3 \cdot \left( 14 \right) + 4 \cdot \left( 1 \right) = 2$

Since $$\det(A) = \displaystyle 2 \ne 0$$, we conclude that the matrix is invertible, and we can continue with the use of Cramer's Rule.

### Step 3: Computing the Solutions

Now, we need to compute each of the solutions $$x_j$$, by using the formula:

$x_j = \displaystyle \frac{\det(A^j)}{\det(A)}$

where $$A^j$$ correponds exactly to the matrix $$A$$ except that the column j is replaced by $$b$$.

For $$x$$:

Using the sub-determinant formula we get:

$\begin{vmatrix} \displaystyle 1&\displaystyle 3&\displaystyle 4\\[0.6em]\displaystyle 5&\displaystyle 3&\displaystyle 2\\[0.6em]\displaystyle 2&\displaystyle 2&\displaystyle 8 \end{vmatrix} = 1 \cdot \left( 3 \cdot \left( 8 \right) - 2 \cdot \left(2 \right) \right) - 3 \cdot \left( 5 \cdot \left( 8 \right) - 2 \cdot \left(2 \right) \right) + 4 \cdot \left( 5 \cdot \left( 2 \right) - 2 \cdot \left(3 \right) \right)$ $= 1 \cdot \left( 20 \right) - 3 \cdot \left( 36 \right) + 4 \cdot \left( 4 \right) = -72$

Now we find that using Cramer's formula, $$x$$ is computed as

$x = \displaystyle \frac{\det(A^{ 1}) }{\det(A)} = \displaystyle \frac{ \begin{vmatrix} \displaystyle 1&\displaystyle 3&\displaystyle 4\\[0.6em]\displaystyle 5&\displaystyle 3&\displaystyle 2\\[0.6em]\displaystyle 2&\displaystyle 2&\displaystyle 8 \end{vmatrix} }{ \begin{vmatrix} \displaystyle 2&\displaystyle 3&\displaystyle 4\\[0.6em]\displaystyle 2&\displaystyle 3&\displaystyle 2\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 8 \end{vmatrix} } = \displaystyle \frac{ \displaystyle -72 }{ \displaystyle 2} = -36$

For $$y$$:

Using the sub-determinant formula we get:

$\begin{vmatrix} \displaystyle 2&\displaystyle 1&\displaystyle 4\\[0.6em]\displaystyle 2&\displaystyle 5&\displaystyle 2\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 8 \end{vmatrix} = 2 \cdot \left( 5 \cdot \left( 8 \right) - 2 \cdot \left(2 \right) \right) - 1 \cdot \left( 2 \cdot \left( 8 \right) - 1 \cdot \left(2 \right) \right) + 4 \cdot \left( 2 \cdot \left( 2 \right) - 1 \cdot \left(5 \right) \right)$ $= 2 \cdot \left( 36 \right) - 1 \cdot \left( 14 \right) + 4 \cdot \left( -1 \right) = 54$

Now we find that using Cramer's formula, $$y$$ is computed as

$y = \displaystyle \frac{\det(A^{ 2}) }{\det(A)} = \displaystyle \frac{ \begin{vmatrix} \displaystyle 2&\displaystyle 1&\displaystyle 4\\[0.6em]\displaystyle 2&\displaystyle 5&\displaystyle 2\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 8 \end{vmatrix} }{ \begin{vmatrix} \displaystyle 2&\displaystyle 3&\displaystyle 4\\[0.6em]\displaystyle 2&\displaystyle 3&\displaystyle 2\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 8 \end{vmatrix} } = \displaystyle \frac{ \displaystyle 54 }{ \displaystyle 2} = 27$

For $$z$$:

Using the sub-determinant formula we get:

$\begin{vmatrix} \displaystyle 2&\displaystyle 3&\displaystyle 1\\[0.6em]\displaystyle 2&\displaystyle 3&\displaystyle 5\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 2 \end{vmatrix} = 2 \cdot \left( 3 \cdot \left( 2 \right) - 2 \cdot \left(5 \right) \right) - 3 \cdot \left( 2 \cdot \left( 2 \right) - 1 \cdot \left(5 \right) \right) + 1 \cdot \left( 2 \cdot \left( 2 \right) - 1 \cdot \left(3 \right) \right)$ $= 2 \cdot \left( -4 \right) - 3 \cdot \left( -1 \right) + 1 \cdot \left( 1 \right) = -4$

Now we find that using Cramer's formula, $$z$$ is computed as

$z = \displaystyle \frac{\det(A^{ 3}) }{\det(A)} = \displaystyle \frac{ \begin{vmatrix} \displaystyle 2&\displaystyle 3&\displaystyle 1\\[0.6em]\displaystyle 2&\displaystyle 3&\displaystyle 5\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 2 \end{vmatrix} }{ \begin{vmatrix} \displaystyle 2&\displaystyle 3&\displaystyle 4\\[0.6em]\displaystyle 2&\displaystyle 3&\displaystyle 2\\[0.6em]\displaystyle 1&\displaystyle 2&\displaystyle 8 \end{vmatrix} } = \displaystyle \frac{ \displaystyle -4 }{ \displaystyle 2} = -2$

Hence, and summarizing, the solution is

$\begin{bmatrix} \displaystyle x\\\\\displaystyle y\\\\\displaystyle z \end{bmatrix} = \begin{bmatrix} \displaystyle -36\\\\\displaystyle 27\\\\\displaystyle -2 \end{bmatrix}$

which concludes the calculation of the solutions for the given linear system.