### Row Operation

##### 1. Gaussian elimination and back substitution

To solve a system of linear equations, we first simplify the system and then do backward substitution.

Example In the system

 3x1 + x2 - x3 = 2 x1 - x2 + x3 = 2 2x1 + 2x2 + x3 = 6

the variable x1 appears in all 3 equations. We try to eliminate x1 so that it appears in only 1 equation. Specifically, by multiplying -3 to the 2nd equation and then add to the 1st equation, x1 is eliminated from the 1st equation.

 4x2 - 4x3 = -4 x1 - x2 + x3 = 2 2x1 + 2x2 + x3 = 6

Next the operation (-2)[equation 2] + [equation 3] (multiply -2 to the 2nd equation and then add to the 3rd equation) further eliminates x1 from the 3rd equation.

 4x2 - 4x3 = -4 x1 - x2 + x3 = 2 4x2 - x3 = 2

The system is as simple as we can get as far as x1 is concerned.

Next we try to simplify the system regarding x2. The operation (-1)[equation 1] + [equation 3] eliminates x2 from the 3rd equation.

 4x2 - 4x3 = -4 x1 - x2 + x3 = 2 3x3 = 6

Although the system is simple enough to be solved. We may still make some cosmetic improvements. By exchanging the 1st and the 2nd equations (denoted [equation 1] ↔ [equation 2]), we rearrange the equations from the most complicated down to the simplest.

 x1 - x2 + x3 = 2 4x2 - 4x3 = -4 3x3 = 6

Finally, the coefficients can be further simplified by multiplying 1/4 and 1/3 to the 2nd and the 3rd equations (denoted (1/4)[equation 2] and (1/3)[equation 3]).

 x1 - x2 + x3 = 2 x2 - x3 = -1 x3 = 2

This completes the simplification process.

Now we start solving the system by backward substitution. From the 3rd equation (the simplest equation), we have

x3 = 2.

Substituting this into the 2nd equation (the next simplest), we get

x2 = -1 + x3 = -1 + 2 = 1.

Further substituting into the 1st equation (the most complicated), we get

x1 = 2 + x2 - x3 = 2 + 1 - 2 = 1.

We conclude that the system has a unique solution x1 = 1, x2 = 1, x3 = 2.

In the example above, we have used the following operations to simplify a system.

r[equation i] + [equation j]
add a multiple of one equation to another.
[equation i] ↔ [equation j]
exchange two equations.
d[equation i], d ≠ 0
multiply a nonzero number to an equation.

In general, any system of linear equations can be simplified, by the three operations, to a simple system in which equations are arranged from the most complicated to the simplest. This process is called the gaussian elimination.

After completing the gaussian elimination, we may solve the simplest equation. Then we successively substitute the results into more and more complicated equations to get the whole solution. This process is called the backward substitution.

Example This example shows different choices may be taken in the gaussian elimination. However, the solution will not be affected by the choices.

For the same system just solved,

 3x1 + x2 - x3 = 2 x1 - x2 + x3 = 2 2x1 + 2x2 + x3 = 6

we try a slightly different gaussian elimination process. By (-3/2)[equation 3] + [equation 1] and (-1/2)[equation 3] + [equation 2], we have

 - 2x2 - 5/2x3 = -7 - 2x2 + 1/2x3 = -1 2x1 + 2x2 + x3 = 6

Then (-1)[equation 2] + [equation 1] gives us

 - 3x3 = -6 - 2x2 + 1/2x3 = -1 2x1 + 2x2 + x3 = 6

We further exchange [equation 1] ↔ [equation 3] to rearrange from the most complicated down to the simplest.

 2x1 + 2x2 + x3 = 6 - 2x2 + 1/2x3 = -1 - 3x3 = -6

Now from the 3rd equation, we have

x3 = (-6)/(-3) = 2.

Substituting into the 2nd equation, we have

x2 = -(-1 - 1/2x3)/2 = -(-1 - (1/2)×2)/2 = 1.

Substituting further into the 1st equation, we get

x1 = (6 - 2x2 - x3)/2 = (6 - 2 - 2)/2 = 1.