Try   HackMD

How to solve a system of linear equations?

In high school, we have seen many system of linear equations with a unique solution, and we know how to solve it. Here we are going to learn how to obtain all solutions of a system of linear equation when its solution is not unique.

Consider the system of linear equations

x+y+z+w+u=3,x+2y+2z+2w+2u=4,x+3y+3z+4w+4u=5.

Step 1: Transform the system into the augmented matrix

We may record the coefficients on the left into a matrix

A and the constants on the right into a vector
b
. By setting

A=[111111222213344], x=[xyzwu], and b=[345],

we know the system of linear equations is equivalent to

Ax=b, and we may represent this system by the augmented matrix

[Ab]=[111113122224133445].

Step 2: Make it into an echelon form

By running Gaussian elimination, which is a sequence of row operations, we may obtain

[111113011111000110].

This stair-like structure is called an echelon form . The term echelon is a way to arrange the troops in military; see the pictures in Wikipedia: Echelon formation to get a better sense of this name.

Note that, if preferred, one may run Gaussian elimination further to get the reduced echelon form

[100002011001000110].

Step 3: Recognize the leading variables and the free variables

The echelon form we used above is equivalent to

x+y+z+w+u=3, y+z+w+u=1,  w+u=0.

The first (left-most) variable with nonzero coefficient on each equation is called a leading variable . In this case, we have three leading variables

x,
y
, and
w
. Any variable that is not a leading variable is called a free variable . In this case,
z
and
u
are the free variables.

Note that given any numbers for the free variables, the leading variables are uniquely determined, as we will see in the next two steps.

Step 4: Find a special solution

For example, we may assign

z=0 and
u=0
. Thus, we solve, from right to left, that
w=0
,
y=1
, and
x=2
. Recording these numbers as a vector

p=[21000],

we call it as a special solution of the

Ax=b, which means it is one of the solution.

Step 5: Find the homogeneous solutions

In fact, we may assign

z=c1 and
u=c2
to get all solutions. Thus, we have

[xyzwu]=[21c10c10c20c2]=[21000]+c1[01100]+c2[00011]=p+c1h1+c2h2.

Note that

h1 is usually not a solution of
Ax=b
; instead, it is a solution of
Ax=0
. This is not suprising after a second thought. By assigning
z=0
and
u=0
, we get the solution
p
, so
Ap=b
. By assigning
z=1
and
u=0
, we get the solution
p+h1
, so
A(p+h1)=b
. Combining these two facts along with some algebra, it is straightforward to see

Ah1=A(p+h1)Ap=bb=0.

Indeed,

h1 is the unique solution of
Ax=0
with
z=1
and
u=0
. Therefore, here is another way to obtain
h1
. First, consider the homogeneous equation
Ax=0
. By running the Gaussian elimination, we know it is equivalent to

x+y+z+w+u=0, y+z+w+u=0,  w+u=0,

which are the same equations we have been using except that the constants on the right are replaced by zeros. By solving this homogeneous system with

z=1 and
u=0
, we see again that

h1=[01100].

In a similar way, one may obtain

h2 without calculating all the parametrization. (Give it a try!)

Now, the set

span({h1,h2})={c1h1+c2h2:c1,c2R}

is the solution set of

Ax=0. It is also called the homogeneous solution of
Ax=b
, since we have to replace
b
by
0
. On the other hand, the set

p+span({h1,h2})={p+c1h1+c2h2:c1,c2R}

is the solution set of

Ax=b. It is also called the general solution of
Ax=b
, in contrast to a special solution.

As a summary, the general solution is equal to a special solution plus the homogeneous solution.

This note can be found at Course website > Learning resources.