# document.write (document.title)

 Math Help > Basic Math > Word Problems and Basic Arithmetic > Substitution Method > Substitution Method, with Three Equations in Three Unknowns

There are two basic ways to solve n equations with n unknowns: substitution and elimination.  Each of them can have variations.  For example, matrix methods are extensions of the elimination method.  In this section, we will explore substitution.

## Substitution Method

### Three variables and Three unknowns

Let the variables be x, y, and z.  The equations are eq.1, eq.2, and eq.3.  The substitution method has these basic steps:

1. Solve eq.1 for z.
2. Substitute the whole right-hand side of the equation (the one you just wrote) in place of "z" in eq.2. You should use parentheses around the substituted expression to keep everything orderly.
3. Solve the equation you wrote in step 2 for y.
4. Substitute the whole right-hand side of the equation you wrote in step 1 in place of "z" in eq.3.  Then substitute the whole right-hand side of the equation you wrote in step 3 in place of "y" in eq.3.
5. Solve the equation you wrote in step 4 for x.  You should get a numeric value of x.
6. Use this value of x in the equation you wrote in step 3 to solve for y.  You should get a numeric value of y.
7. Use these values of x and y in the equation you wrote in step 1 to solve for z.  You should get a numeric value of z.

Now I will apply these steps to an example, and I will label them so you can understand what I'm doing at each step.

### Example: three variables and three unknowns

3x-z+120=y
y-2z=30
x+y+z=180

Step 1: Solve eq.1 for z.
3x-z+120=y
z=3x+120-y

Step 2: Substitute z in eq.2
y-2z=30
y-2(3x+120-y)=30

Step 3: Solve the equation you wrote in step 2 for y.
y-2(3x+120-y)=30
y-6x-240+2y=30
3y-6x=270
y-2x=90
y=90+2x

Step 4: Substitute z, then substitute y in eq.3.
x+y+z=180
x+y+(3x+120-y)=180
x+(90+2x)+(3x+120-(90+2x))=180

Step 5: Solve the equation you wrote in step 4 to get the value of x.
x+(90+2x)+(3x+120-(90+2x))=180
x+90+2x+3x+120-90-2x=180
4x+120=180
x=15

Step 6: Use this value of x in the equation you wrote in step 3 to solve for y.
y=90+2x
y=90+2(15)
y=120

Step 7: Use these values of x and y in the equation you wrote in step 1 to solve for z.
z=3x+120-y
z=3(15)+120-120
z=45+120-120
z=45

3x-z+120=y
3(15)-45+120=120
45-45+120=120
120=120
True.

y-2z=30
120-2(45)=30
120-90=30
30=30
True.

x+y+z=180
15+120+45=180
180=180
True.

You should be able to see how this generalizes to n equations in n unknowns.  You would solve the first equation for the first unknown, then substitute this in the second equation, and solve for the second unknown.  Then substitute both variables in the third equation, and solve for the third unknown.  Then substitute all three variables in the fourth equation, and solve for the fourth unknown, etc.  When you get to the last equation, and solve it for the last unknown, you should be down to a numeric answer.  Then work backwards through the odd-numbered steps, getting numeric answers for each variable in turn.

### Related pages in this website

The webmaster and author of this Math Help site is Graeme McRae.