Welcome to the system of equations calculator, where we will learn how to solve a system of linear equations. Our handy calculator will quickly find the solution to any problem you give it, and, if there are an infinite number of solutions, it will even tell you what they look like! The system of equations solver uses the so-called Gaussian elimination method, but this is not the only method, so below we present five different answers to the question "How to solve a system of equations?"

Let's not waste a second longer and get to it, shall we?

What is a system of linear equations?

Remember all those riddles on Facebook or Instagram, you know, the ones where three apples are equal to 30, an apple and two bananas are equal to 18, and a banana minus a coconut equal to two, and you had to calculate how much the apple, banana, and coconut are worth? That is what the mathematicians call a system of linear equations. "But how? Mathematicians don't use apples and bananas, do they?" Well, they too like to keep the doctor away and bite into an apple from time to time, but you're right, they don't calculate in apples. However, it doesn't make any difference if you right "Three apples equal to 30," or 3x = 30.

A system with apples vs a system with x-s.

The x that appeared above is what we call a variable. It denotes a number or element that we don't know the value of, but that we do know something about. In our case, we know that three apples equal to 30, but the apple is simply a variable, like x, as we don't know the value of it. In essence, "what is the solution to the system of equations..." is the same as "give me the value of an apple (or x) that satisfies..." To be honest, we know that most scientists would love to use bananas instead of x's, but they're just insecure about their drawing skills.

"But what the heck does linear mean?" We say that an equation is linear if its variables (be they x's or coconuts) are to the first power. This means that, for instance, they are not squared as in quadratic equations, or the denominator of a fraction, or under a square root. They can, however, be multiplied by any number, just as we had the 3 in our 3x = 30 equation. This applies to all the variables in an equation. For example, the equation -2x + 14y - 0.3z = 0 is linear, but 10x - 7y + z² = 1 isn't.

Lastly, if we have a few equations to solve together, then we call them a system of equations. We denote it by drawing a curly bracket (or a rotated set of mustache, whichever you prefer) to the left of them. This means that we're only interested in solutions to all the equations in the system. If we find values that work for the first equation but don't for the second, then we don't call that a solution.

How to solve a system of equations?

There are many different ways to solve a system of linear equations. Let's briefly describe a few of the most common methods.

  1. Substitution

The first method that students are taught, and the most universal method, works by choosing one of the equations, picking one of the variables in it, and making that variable the subject of that equation. Then, we use this rearranged equation and substitute it for every time that variable appears in the other equations. This way, those other equations now have one variable less, which makes them easier to solve.

For example, if we have an equation 2x + 3y = 6 and want to get x from it, then we start by getting rid of everything that doesn't contain x from the left hand side. To do this, we have to subtract 3y from both sides (because we have that expression on the left). This means that the left side will be 2x + 3y - 3y, which is simply 2x, and the right side will be 6 - 3y. In other words, we have transformed our equation into 2x = 6 - 3y.

Since we want to get x, and not 2x, we still need to get rid of the 2. To do this, we divide both sides by 2. This way, on the left, we get (2x) / 2, which is just x, and, on the right, we have (6 - 3y) / 2, which is 3 - 1.5y. All in all, we obtained x = 3 - 1.5y, and we can use this new formula to substitute 3 - 1.5y in for every x in the other equations.

  1. Elimination of variables

Solving systems of equations by elimination means that we're trying to reduce the number of variables in some of the equations to make them easier to solve. To do this, we start by transforming two equations so that they look similar. To be precise, we want to make the coefficient (the number next to a variable) of one of the equations variables the opposite of the coefficient of the same variable in another equation. We then add the two equations to obtain a new one, which doesn't have that variable, and so it is easier to calculate.

For example, if we have a system of equations,

2x + 3y = 6, and

4x - y = 3,

then we can try to make the coefficient of x in the first equation to be the opposite of the coefficient in the second equation. In our case, this means that we want to transform the 2 into the opposite of 4, which is -4. To do this, we need to multiply both sides of the first equation by -2, since 2 * (-2) = -4. This changes the first equation into

2x * (-2) + 3y * (-2) = 6 * (-2),

which is

-4x - 6y = -12.

Now we can add this equation to the second one (the 4x - y = 3) by adding the left side to the left side and the right to the right. This gives

4x - y + (-4x - 6y) = 3 + (-12),

which is

-7y = -9.

We've obtained a new equation with just one variable, which means that we can easily solve y. We can then substitute that number into either of the original equations to get x.

  1. Gaussian elimination method

This is the method used by our system of equations calculator. Named after a German mathematician Johann Gauss, it is an algorithmic extension of the elimination method presented above. In the case of just two equations, it is exactly the same thing. However, solving systems of equations by regular elimination gets trickier and trickier with more and more equations and variables. That's where the Gaussian elimination method comes in.

Let's say that we have four equations with four variables. To find the solution to our system, we want to try to get the values of our variables one by one by eliminating all the other consecutively. To do this, we take the first equation and the first of the variables. We use its coefficient to eliminate all the occurrences of that particular variable in the other three equations, just as we did in the regular elimination. This way, we are left with the first equation the same as it was, and three equations, now each with only three variables.

We now look at the first equation, give it a thumbs-up, and leave it as it is until the very end. We repeat the process for the other three equations. In other words, we take the second variable and its coefficient from the second equation to eliminate all occurrences of that variable in the last two equations. This leaves us with the first equation having four variables, the second having three, and the last two having only two variables.

Next, we declare the second equation to be nice and pretty and leave it be. We move on to the two remaining equations and take the third variable and its coefficient in the third equation to eliminate that variable from the fourth equality.

In the end, we obtain a system of four equations, in which the first has four variables, the second has three, the third has two, and the last has only one. This means that we can easily get the value of the fourth variable from the fourth equation (since it has no other variables). We then substitute that value to the third equation and get the value of the third variable (since it now has no other variables), and so on.

  1. Graphical representation

Arguably the least used method, but a method nonetheless. It takes each of the equations in our system and translates them to a function. The points on the graph of such a function correspond to the coordinates that satisfy that equation. Therefore, if we want to solve a system of linear equations, then it is enough to find all the points where the line cross on the graph, i.e., the coordinates that satisfy all of the equations.

It can be, however, tricky. If we have just two equations and two variables, then the functions are lines on a two-dimensional plane. Therefore, we just need to find the point where those two lines cross.

For three variables, the functions are now in a three-dimensional space, and are no longer lines but planes. This means that we would have to draw three planes (which is tricky in itself), and then also find where those planes cross. And, if you think that's difficult, try to imagine four variables and four dimensions. If it comes to you naturally, please contact us, and we'll direct you to the nearest Nobel prize-type project or a neurologist for a thorough head check.

  1. Cramer's rule

A fairly easy and very straightforward way to solve a system of linear equations. It does, however, require a good understanding of matrices and their determinants. As an encouragement, let us mention that it doesn't need any substitution, no playing around with the equations, it's just the good old basic arithmetics. For example, for a system of three equations with three variables, we plug in the coefficients from those equations to form four three-by-three matrices and calculate their determinants. We finish by dividing the appropriate values that we've just obtained to get the final solution.

Example: Using the system of equations solver

Let's look at one of those picture riddles, and try to solve it with our system of equations calculator.

A system of equations with sweet variables.

The first thing we have to do is write all the tasty sweets as letter variables. We know, the expression we'll get will be far from an eye candy, but mathematicians don't have much taste. Okay, let's get to work and leave the puns for dessert.

Our riddle has three symbols - the doughnut, the cookie, and the candy. We don't know the value of any of them, so we'll need three variables - one for each of the pictures. It is customary to use letters like x, y, and z, but feel free to use other if you please. We will denote the doughnut by x, the cookie by y, and the candy by z. This allows us to write the above riddle in the form:

x + x + x = y

y + y - z = 25

z + z - x = 16.

So, what is the solution to the system of equations? Now, hold your horses. First of all, we'll try to simplify each of the three expressions before we even think about how to solve this system of equations. Note, that our system of equations solver doesn't use the formulas in the form that we have now. In particular, it doesn't have any variables on the right side of the = sign, as we have in the first expression. So, we do indeed have to do some work first.

We take each of the equations and move all the variables to the left hand side. Then, we add together all summands with the same variable (x, y, or z) in that equation. Finally, we write the summands that we got in alphabetical order, in terms of the variables. This means that we write the expression with x first, then the expression with y, and then the one with z.

In our case, this means that we have to first move the y in the first equation from right to left. To do this, we subtract y from both sides of the equality. This gives

x + x + x - y = y - y,

which is

x + x + x - y = 0.

The whole system now looks like this:

x + x + x - y = 0

y + y - z = 25

z + z - x = 16

Now, we add up all the summands that contain the same variable. This means that in the first equation, we add the three x's, in the second, we add the two y's, and in the third, we add the two z's. We obtain

3x - y = 0

2y - z = 25

2z - x = 16.

Remember, that when we write 3x, we mean 3 * x, or "three copies of x". Now, we write the variables in alphabetical order. The first two equations already have the form we want, but in the last, we need to move the expression with x before the one with z. This gives

3x - y = 0

2y - z = 25

-x + 2z = 16

Observe that, at first glance, this doesn't look like the expression we have in the system of equations calculator. It is, however, just that. For example, the first equation doesn't have any z's in it. But recall that "no z's" means "zero copies of z." We can, therefore, write the missing variables with coefficients 0. In this way, we obtain

3x - y + 0z = 0

0x + 2y - z = 25

-x + 0y + 2z = 16

Now, this is more like it - this is just the form of the system of equations solver! Just to be sure, remember that when we have no number in front of a variable, then it is a customary way of saying that the number is 1. For example, the -y in the first equation is, in fact -1y.

Finally, we need to identify what data we need to take from the system we've obtained and where to put it in the system of equations calculator. Well, let's look at the first equality we have and the top one from the solver and compare them:

3x - y + 0z = 0

a₁x + b₁y + c₁z = d₁

The correspondence is just as it looks: a₁ is the number next to x in the equation, b₁ is the one next to y, c₁ the one next to z, and d₁ is the number we have on the right. In our case, this means that we should put a₁ = 3, b₁ = -1, c₁ = 0, and d₁ = 0. We repeat this with the second and the third equation: a₂ = 0, b₂ = 2, c₂ = -1, d₂ = 25, a₃ = -1, b₃ = 0, c₃ = 2, d₃ = 16. Once we give all those numbers, the system of equations solver will give us the solution. In the next section, we describe how it does that, step by step.

Example: solving systems of equations by Gaussian elimination

Dealing with cookies and doughnuts is all fun and games, but let's now try to burn some of those sugary calories by describing how to solve the system of equations we've obtained in the above section:

3x - y + 0z = 0

0x + 2y - z = 25

-x + 0y + 2z = 16

We want to leave the first equation as it is, since it has a non-zero coefficient next to the variable x. We will, however, use that coefficient to get rid of x's in the other equations. Observe that we don't have to worry about the second one, because its x coefficient is zero. To deal with the third, we will eliminate the -x from it by first transforming it into the opposite of 3x from the first equation. In fact, it is enough to multiply both sides of the third equation by 3.

3x - y + 0z = 0

0x + 2y - z = 25

-3x + 0y + 6z = 48

Now we have opposite numbers next to x in the first and the last equality, we add the two expressions together

(3x - y + 0z) + (-3x + 0y +6z) = 0 + 48,

which is

0x -y + 6z = 48.

We can now replace the third equation with the one we've just obtained, to get

3x - y + 0z = 0

0x + 2y - z = 25

0x - y + 6z = 48

What we've gained by this is that the two last expressions have no x in them, and it is always easier to solve a system of linear equations with two variables instead of three.

The next step in the Gaussian elimination method is to repeat the same process for the last two equations. In essence, we will use the non-zero coefficient of the y in the second equality to get rid of the y from the last one. As we've done above, we start by transforming the -y into the opposite of 2y, i.e., into -2y. To do this, it is enough to multiply both sides of the last equation by 2.

3x - y + 0z = 0

0x + 2y - z = 25

0x - 2y + 12z = 96

We can now add the two last equations to get

(0x + 2y - z) + (0x - 2y + 12z) = 25 + 96,

which is

0x + 0y + 11z = 121.

Time to replace the third equation

3x - y + 0z = 0

0x + 2y - z = 25

0x + 0y + 11z = 121.

This is the end-form of the system of equations that we get from the Gaussian elimination method. Now it is so much easier to solve the system of linear equations. How so? Well, let's begin with the last equality. It has only one variable with a non-zero coefficient, namely z. We can forget about the zero terms, which gives us

11z = 121,

and that means that we must have z = 11. Now that we know what the first part of the solution to the system of equations is, we can use this knowledge to substitute that number for z in the other two equations:

3x - y + 0 = 0

0x + 2y - 11 = 25,

which is

3x - y = 0

0x + 2y = 36.

Now we have the second equation with only one variable with a non-zero coefficient. If we forget about the zero terms, we'll get

2y = 36,

and therefore, we must have y = 18. Again, we substitute that number for y in the first equation:

3x - 18 = 0,

which gives

3x = 18,

and that means that x = 6. All in all, we've managed to solve the system of linear equations and find the solution to be

x = 6

y = 18

z = 11

If we now look at our picture riddle, all this solving the system of equation by elimination lead us to an answer that a doughnut equals 6, a cookie equals 18, and a candy equals 11.

A piece of cake, wasn't it?

Maciej Kowalski, PhD candidate
People also viewed…

Black Friday

How to get best deals on Black Friday? The struggle is real, let us help you with this Black Friday calculator!

Helium balloons

Wondering how many helium balloons it would take to lift you up in the air? Try this helium balloons calculator! 🎈

Quadrilateral Area

Find the area of any quadrilateral - even an irregular one - with our quadrilateral area calculator.

Triangle height

How to find the height of a triangle? What is the height of a triangle formula? Check out with this triangle height calculator!