Cramer's Rule Calculator (2024)

Welcome to the Cramer's rule calculator, a quick and easy 2- and 3-variable system of equations solver. Together, we'll learn how to construct a coefficient matrix and then try using those matrices to solve systems of equations. You might have already seen one or two different ways to tackle similar mathematical problems. However, we're here to convince you that Cramer's rule for 3x3 matrices is almost as easy as Cramer's rule for 2x2 matrices (which is super easy)!

So, would you like to learn how to solve systems of equations with a matrix or two, without any substitution, elimination, or drawing graphs - just simple arithmetics?

Cramer's Rule Calculator (1)

What is a system of equations?

You know how not everything in life is known, or easy to describe? Like how fast does the universe expand, how much can you save on Black Friday, or how many apples did Mr. Smith buy if he paid $3.50 and one costs $0.50? You know, the essential questions in life.

Whenever we don't know some number explicitly, but we can describe it in relation to some other numbers, we obtain an equation. Mathematically speaking, it's a symbolic description of an equality that our value must satisfy. For example, we can write the third question as follows:

costofoneapple×$0.50=$3.50\text {cost of one apple} × \$0.50 = \$3.50costofoneapple×$0.50=$3.50.

The costofoneapple\text {cost of one apple}costofoneapple is the value that we don't know and would like to find. Usually, we call such a thing a variable and denote it by a single letter, say, x\text xx. The equation above then looks like this:

x×$0.50=$3.50\text x × \$0.50 = \$3.50x×$0.50=$3.50.

That's a pretty simple one, and we can easily calculate that Mr. Smith bought seven apples. However, life is not always that easy. Not only can Mr. Smith buy more apples, but he can also, for example, give a tip to the shopkeeper. We would then have to include that in the equation we construct, which would make it a little more complicated. But what if Mr. Smith wants to buy some oranges as well?

If a new value enters the picture and we don't know it either, we must introduce it as a new variable, say y\text yy. When we describe our two variable question, what we get is still an equation, however, in general, they become more difficult to calculate.

Nevertheless, if we have more information, the problem looks much more promising. For instance, if on one occasion Mr. Smith bought 7 apples and 3 oranges and paid $5.60, and on another he bought 1 apple and 5 oranges, and paid $4.00, then this is enough information to calculate how much an apple and an orange cost. This is because we can write two equations (one for each shopping) with two variables. We call such a thing a system of equations.

To sum up, in general, a system of equations is a number of equations with a few variables, and we want to find numbers that satisfy all of these equations. We will now describe how to solve such a system of equations with a matrix.

How about checking out our matrix multiplication calculator to learn about an interesting concept on matrices.

Using matrices to solve systems of equations

Let's look at a traveling-themed problem:

Cramer's Rule Calculator (2)

At first, it may not look like a system of equations, but in fact, it is just that. After all, the x\text xx's and y\text yy's we used in the section above are just examples of how we can denote a variable; there is no reason why we can't use bikes instead.

However, for simplicity of notation, and for the sake of our 3-variable system of equations solver, let's switch to the boring mathematical notation, and say that x\text xx will denote the bike, y\text yy the car, and z\text zz the plane. Then we can write the above system as

x+y+z=26\text x + \text y + \text z = 26x+y+z=26;

yzz=6\text y - \text z - \text z = 6yzz=6; and

x+xz=12\text x + \text x - \text z = 12x+xz=12.

We have three equations and three variables, so our end-goal is to use Cramer's rule for 3x3 matrices (the first 3 denote the number of equations, the second the number of variables). To do this, we first need to construct an array of numbers, which we'll call the coefficient matrix.

Before that, however, we have to work a little to make our system more like the one we see in our Cramer's rule calculator. Note that we can simplify the two last equations, i.e., add together the same variables in each line. For example, in the bottom equation, we have x+x\text x + \text xx+x, which we can write as 2x2\text x2x (one copy of x\text xx plus one copy of x\text xx equals two copies of x\text xx). All in all, we obtain

x+y+z=26\text x + \text y + \text z = 26x+y+z=26

y2z=6\text y - 2 \text z = 6y2z=6

2xz=122\text x - \text z = 122xz=12.

Now we're ready to form the coefficient matrix. It will be an array with three rows (because we have three equations) and three columns (because we have three coefficients). The first column will correspond to the variable x\text xx, the second to y\text yy, and the third to z\text zz. Here, by "correspond," we mean that it will contain the coefficients of that variable in consecutive equations (hence the name coefficient matrix). Note, that we don't have all the variables in all the lines. For example, the second equation doesn't have the x\text xx variable. Fortunately, this simply means that the coefficient of x\text xx in that line is, in fact, zero.

To sum up, the number in row i\text ii and column j\text jj in the coefficient matrix contains the number next to j\text jj-th coefficient (the first being x\text xx, the second y\text yy, and the third z\text zz) in the i\text ii-th equation. In our case, it will look as follows:

[111012201] \begin{bmatrix} 1 & 1 & 1 \\ 0 & 1 & -2 \\ 2 & 0 & -1 \end{bmatrix}102110121

Quite often, it is useful to define the so-called augmented coefficient matrix. It is the same thing with an additional column to the right, with the right-hand side numbers of the equalities of our system. Usually, it is separated from the others by a dashed line. In our case, it looks like this:

[11126012620112] \begin{bmatrix} 1 & 1 & 1 & ⁞ & 26 \\ 0 & 1 & -2 & ⁞ & 6\\ 2 & 0 & -1 & ⁞ & 12 \end{bmatrix}10211012126612

Let's not waste a minute more and start using these matrices to solve systems of equations using Cramer's rule for 3x3 systems.

Cramer's rule for 2x2 and 3x3 systems

Most of the ways of dealing with systems of equations is to change the system itself a lot - reducing its rows, substituting one value for another, and so on. It tends to get messy in more complicated examples. Cramer's rule is a way to hide all of that with a few simple arithmetic operations on the coefficient matrix, namely calculating a few determinants.

The determinant of a square matrix is a number that we get from multiplying and adding some of the cells of the matrix. Since our Cramer's rule calculator is a 2- and 3-variable system of equations solver, we'll focus on the formulas for when we have two equations with two variables and three equations with three variables.

If

A=[abcd]A = \begin{bmatrix} a & b \\ c & d \end{bmatrix}A=[acbd]

then the determinant of A\text AA, denoted A|\text A|A or det(A)\text {det(A)}det(A), is

A=a×db×c|\text A| = \text {a×d} - \text {b×c}A=a×db×c.

And if

B=[abcdefghi]B = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}B=adgbehcfi

then the determinant of BBB is

B=a×e×i+b×f×g+c×d×hc×e×gb×d×ia×f×h|\text B| =\text {a×e×i} + \text {b×f×g} + \text {c×d×h} - \text {c×e×g} - \text {b×d×i} - \text {a×f×h}B=a×e×i+b×f×g+c×d×hc×e×gb×d×ia×f×h

Now denote the coefficient matrix of our system by WWW (note that it is a 2x2 matrix when we have two equations and two variables, and 3x3 when we have three equations and three variables). We will now define some additional matrices, Wx\text W_\text xWx, Wy\text W_\text yWy, and Wz\text W_\text zWz, that will correspond to each variable of our system (Wz\text W_\text zWz exists only when we have z\text zz in the equations).

You may want to try out our eigenvalue and eigenvector calculator.

Recall the augmented coefficient matrix from the section above. It had an additional column with the numbers on the right hand side of the === sign in the system. We define the matrices corresponding to variables to be the initial coefficient matrix with the column of the variable in question swapped for the extra, right hand side column. For instance, the matrix Wz\text W_\text zWz will have the same first two columns (corresponding to x\text xx and y\text yy) as W\text WW, while its third column will be the additional one from the augmented coefficient matrix.

The Cramer's rule for 2x2 systems states that the system's solution is given by

x=Wx/W\text x = |\text W_\text x| / |\text W|x=Wx∣/∣W

y=Wy/W\text y = |\text W_\text y| / |\text W|y=Wy∣/∣W

and the Cramer's rule for 3x3 systems adds to that a third variable:

z=Wz/W\text z = |\text W_\text z| / |\text W|z=Wz∣/∣W

Note, that when we use these formulas to solve a system of equations, each matrix mentioned above is 2x2 in size when we have two equations and two variables, and 3x3 in size when we have three equations and three variables.

Things to remember:

  • Using matrices to solve systems of equations with Cramer's rule allows us to find the answer by simply following a few predetermined calculations. There is almost no thinking here, only multiplication, addition, and division;
  • We can use the above description as a step-by-step 2- and 3-variable system of equations solver. However, Cramer's rule still applies to larger matrices, although the calculations can get a little messy. In particular, the determinant gets pretty ugly. The number of summands in the formula is equal to the number of permutations. This means that for four equations with four variables, it has 24, and for five, it has 120 summands;
  • The determinant of a matrix can be zero. If it's the W\text WW matrix, then we have a problem: we cannot divide by zero! This can mean two things: either we have no solutions, or we have infinitely many of them. The first case is when at least one of the variable matrices is non-zero, and the latter when all of them are zero (together with W\text WW);
  • Our Cramer's rule calculator will tell you if we're dealing with one of the two special cases we've mentioned above. Even better, if there are infinitely many solutions, it will also describe the form of the pairs/triples that satisfy the system; and
  • Try to get a decent amount of sleep every day. It's always good to remember that.

Example: using the Cramer's rule calculator

Recall the traveling-based example from section two and the system of equations that we got from it after simplifying each line:

x+y+z=26\text {x + y + z} = 26x+y+z=26;

y2z=6\text y - 2\text z = 6y2z=6; and

2xz=122\text x - \text z = 122xz=12.

Let's also remind ourselves of the augmented coefficient matrix:

[11126012620112] \begin{bmatrix} 1 & 1 & 1 & ⁞ & 26 \\ 0 & 1 & -2 & ⁞ & 6\\ 2 & 0 & -1 & ⁞ & 12 \end{bmatrix}10211012126612

Before we move on to construct the four matrices used in Cramer's rule for 3x3 systems, let's take some time to describe how we can input the data into the Cramer's rule calculator.

We have three equations to deal with, so let's tell the calculator that by choosing the right option in the "Number of equations" field. This will turn our tool into a 3-variable system of equations solver and show us a picture of what such a system looks like, with a few mysterious symbols, like a1\text a_1a1 or c2\text c_2c2. These denote the coefficients of our system, i.e., the numbers that stand to the left of the variables in each line and the numbers to the right of the === sign.

This notation is listed in the calculator, where you can input the values from the problem that you want to solve. The a\text aa's correspond to the numbers next to x\text xx's, the b\text bb's to y\text yy's, the c\text cc's to z\text zz's, the d\text dd's are the numbers on the right, and the indices tell us the number of the row. Note that our Cramer's rule calculator accepts only linear equations. This means that we cannot, for example, have a quadratic one, or an expression with a variable under a square root.

Observe that those coefficients are also in our augmented coefficient matrix. In fact, it is enough to copy them into the Cramer's rule calculator. For example, the first row of the matrix has numbers 111, 111, 111, and 262626. It corresponds to the first equation, which has coefficients denoted with the subscript . Therefore, we have:

a1=1\text a_1 = 1a1=1, b1=1\text b_1 = 1b1=1, c1=1\text c_1 = 1c1=1, d1=26\text d_1 = 26d1=26.

Similarly, the other two rows give us:

a2=0\text a_2 = 0a2=0, b2=1\text b_2 = 1b2=1, c2=2\text c_2 = -2c2=2, d2=6\text d_2 = 6d2=6; and

a3=2\text a_3 = 2a3=2, b3=0\text b_3 = 0b3=0, c3=1\text c_3 = -1c3=1, d3=12\text d_3 = 12d3=12.

Once you get all that data into the Cramer's rule calculator, it should spit out the values of the four determinants, followed by the solution to the system. Let's look how it figured that out.

As we've mentioned in the section above, Cramer's rule for 2x2 and 3x3 systems means that we have to calculate the determinants of a few matrices. The first one, the so-called main one, is simply the coefficient matrix that we've defined in section two:

W=[111012201]W = \begin{bmatrix} 1 & 1 & 1 \\ 0 & 1 & -2 \\ 2 & 0 & -1 \end{bmatrix}W=102110121

To construct the other three, we'll need to exchange one column of this matrix with the fourth extra column of the augmented coefficient matrix, which in our case has numbers 262626, 666, and 121212. To get Wx\text W_\text xWx, the x\text xx matrix, we put those numbers instead of the column corresponding to the x\text xx variable, namely the first one:

Wx=[26116121201]W_x = \begin{bmatrix} 26 & 1 & 1 \\ 6 & 1 & -2 \\ 12 & 0 & -1 \end{bmatrix}Wx=26612110121

Similarly, we get

Wy=[12610622121]W_y = \begin{bmatrix} 1 & 26 & 1 \\ 0 & 6 & -2 \\ 2 & 12 & -1 \end{bmatrix}Wy=10226612121

Wz=[11260162012]W_z = \begin{bmatrix} 1 & 1 & 26 \\ 0 & 1 & 6 \\ 2 & 0 & 12 \end{bmatrix}Wz=10211026612

All we need to do is use the determinant formula from the section above for all four of the matrices:

W=1×1×(1)+1×(2)×2+1×0×01×1×21×0×(1)1×(2)×0=7|\text W| = 1\times 1 \times (-1) + 1\times (-2)\times 2 + 1\times 0\times 0 - 1\times 1\times 2 - 1\times 0\times (-1) - 1\times (-2)\times 0 = -7W=1×1×(1)+1×(2)×2+1×0×01×1×21×0×(1)1×(2)×0=7

Wx=26×1×(1)+1×(2)×12+1×6×01×1×261×6×(1)26×(2)×0=56|\text W_\text x| = 26\times 1\times (-1) + 1\times (-2)\times 12 + 1\times 6\times 0 - 1\times 1\times 26 - 1\times 6\times (-1) - 26\times (-2)\times 0 = -56Wx=26×1×(1)+1×(2)×12+1×6×01×1×261×6×(1)26×(2)×0=56

Wy=1×26×(1)+26×(2)×2+1×0×121×6×226×0×(1)1×(2)×12=98|\text W_\text y| = 1\times 26\times (-1) + 26\times (-2)\times 2 + 1\times 0\times 12 - 1\times 6\times 2 - 26\times 0\times (-1) - 1\times (-2)\times 12 = -98Wy=1×26×(1)+26×(2)×2+1×0×121×6×226×0×(1)1×(2)×12=98

Wz=1×1×12+1×6×2+26×0×026×1×21×0×121×6×0=28|\text W_\text z| = 1\times 1\times 12 + 1\times 6\times 2 + 26\times 0\times 0 - 26\times 1\times 2 - 1\times 0\times 12 - 1\times 6\times 0 = -28Wz=1×1×12+1×6×2+26×0×026×1×21×0×121×6×0=28.

Lastly, we use Cramer's rule for 3x3 systems and obtain the solution:

x=Wx/W=56/(7)=8\text x = |\text W_\text x| / |\text W| = -56 / (-7) = 8x=Wx∣/∣W=56/(7)=8,

y=Wy/W=98/(7)=14\text y = |\text W_\text y| / |\text W| = -98 / (-7) = 14y=Wy∣/∣W=98/(7)=14,

z=Wz/W=28/(7)=4\text z = |\text W_\text z| / |\text W| = -28 / (-7) = 4z=Wz∣/∣W=28/(7)=4.

Going back to the problem we started with, this means that the bike is equal to 888, the car is equal to 141414, and the plane is equal to 444.

We have a tool called reduced row echelon form calculator, where we solve a system of equations of your choice using the matrix row reduction and elementary row operations.

Cramer's Rule Calculator (2024)

References

Top Articles
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 5351

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.