Steply

Solve x + y + 2z = 7, x - y + z = 0, 3x + y - z = 2 by gaussian…

Step by step, with the reason for every step · Gaussian elimination · Algebra 2

Step by step

The question

Question: solve x + y + 2z = 7, x − y + z = 0 and 3x + y − z = 2 by Gaussian elimination.

x + y + 2z = 7①
x − y + z = 0②

We want the x, y and z that make all three true.

3x + y − z = 2③

We will use three moves on the rows.

Swap two rows.

Times a row by a number that is not 0.

Add a multiple of one row to another.

Each move keeps the equations true, like in elimination.

swap two rows
× a row by a number (not 0)
add a multiple of one row to another

1 Write the augmented matrix

Each row is one equation: the numbers in front of x, y and z, then the number on the right.

The bar stands for the = signs.

This is called an augmented matrix.

= [1, 1, 2, 7; 1, −1, 1, 0; 3, 1, −1, 2]

We call the rows R 1, R 2 and R 3.

Our goal: 1s down the diagonal, and 0s under them.

This shape is called row-echelon form.

Then we go back up, one letter at a time.

goal: 1s down the diagonal, 0s under them

2 Get 0s under the 1 in column 1

→ [1, 1, 2, 7; 0, −2, −1, −7; 0, −2, −7, −19]

Careful!

A row move works on the whole row, the number after the bar too.

That number is the right side of the equation.

Careful: the whole row, after the bar too

3 Get a 1 in row 2

→ [1, 1, 2, 7; 0, 1, 1 over 2, 7 over 2; 0, −2, −7, −19]

4 Get 0s under the 1 in column 2

→ [1, 1, 2, 7; 0, 1, 1 over 2, 7 over 2; 0, 0, −6, −12]

5 Get a 1 in row 3

→ [1, 1, 2, 7; 0, 1, 1 over 2, 7 over 2; 0, 0, 1, 2]

6 Back substitution

Start at the bottom.

Each row is an equation again.

Row 3 is 1z = 2, with 0 for the other letters.

So z = 2.

z = 2

Row 2 is the equation y + z/2 = 7/2.

y + z2 = 72

We know z = 2.

We put it in.

y + 12 × 2 = 72

Work it out: y + 1 = 7/2.

y + 1 = 72

To remove the + 1, we take away 1 on both sides.

y + 1 − 1 = 72 − 1

So y = 5/2.

y = 52

Row 1 is the equation x + y + 2z = 7.

x + y + 2z = 7

We know y = 5/2 and z = 2.

We put them in.

x + 52 + 2 × 2 = 7

Work it out: x + 13/2 = 7.

x + 132 = 7

To remove the + 13/2, we take away 13/2 on both sides.

x + 132 − 132 = 7 − 132

So x = 1/2.

x = 12

We write it as (1/2, 5/2, 2).

(x, y, z) = (12, 52, 2)

7 Check

Let's check in every equation.

We put x = 1/2, y = 5/2, z = 2 into ①.

① (12) + (52) + 2(2) = 12 + 52 + 4 = 7

We get 7, the same as the right side.

Now ②.

② (12) − (52) + 2 = 12 − 52 + 2 = 0

We get 0, the same as the right side.

Now ③.

③ 3(12) + (52) − 2 = 32 + 52 − 2 = 2

We get 2, the same as the right side.

All of them work.

So the answer is right!

Let's look back.

First: write the augmented matrix.

Then: get 0s under the 1 in column 1.

Then: get a 1 in row 2.

Then: get 0s under the 1 in column 2.

Then: get a 1 in row 3.

Then: back substitution.

Last: check.

Answer
(x, y, z) = (12, 52, 2)

Your turn

Try this one yourself, then check:

Solve x + y + 3z = 14, x − y + z = 4, 3x + y − z = 8
Show the answer
(x, y, z) = (3, 2, 3)

More from Gaussian elimination

The whole lesson: Gaussian elimination →