Skip to main content

Lecture 2: Elimination with matrices

讲座摘要(lecture summary)

Method of Elimination

Elimination is the technique most commonly used by computer software to solve systems of linear equations. It finds a solution xx to Ax=bAx = b whenever the matrix AA is invertible. In the example used in class,

A=[121381041]andb=[1122]A = \begin{bmatrix} 1 & 2 & 1 \\ 3 & 8 & 1 \\ 0 & 4 & 1 \end{bmatrix} \quad \text{and} \quad \bm{b} = \begin{bmatrix} 1 \\ 12 \\ 2 \end{bmatrix}

The number 11 in the upper left corner of A is called the first pivot. We recopy the first row, then multiply the numbers in it by an appropriate value (in this case 33) and subtract those values from the numbers in the second row. The first number in the second row becomes 00. We have thus eliminated the 33 in row 22 column 11.

The next step is to perform another elimination to get a 00 in row 33 column 11; here this is already the case.

The second pivot is the value 22 which now appears in row 22 column 22. We find a multiplier (in this case 22) by which we multiply the second row to eliminate the 44 in row 33 column 22. The third pivot is then the 55 now in row 33 column 33.

We started with an invertible matrix AA and ended with an upper triangular matrix UU; the lower left portion of UU is filled with zeros. Pivots 1,2,51, 2, 5 are on 22 the diagonal of UU.

A=[121381041][121022041]U=[121022005]A = \begin{bmatrix} 1 & 2 & 1 \\ 3 & 8 & 1 \\ 0 & 4 & 1 \end{bmatrix} \to \begin{bmatrix} 1 & 2 & 1 \\ 0 & 2 & -2 \\ 0 & 4 & 1 \end{bmatrix} \to U = \begin{bmatrix} 1 & 2 & 1 \\ 0 & 2 & -2 \\ 0 & 0 & 5 \end{bmatrix}

We repeat the multiplications and subtractions with the vector b=[1122]\bm{b} = \begin{bmatrix} 1 \\ 12 \\ 2 \end{bmatrix}

For example, we multiply the 22 in the first position by 33 and subtract from 1212 to get 66 in the second position. When calculating by hand we can do this efficiently by augmenting the matrix AA, appending the vector b as a fourth or final column. The method of elimination transforms the equation Ax=bAx = b into a new equation Ux=cU\bm{x} = \bm{c}. In the example above, U=[121022005]U =\begin{bmatrix} 1 & 2 & 1 \\ 0 & 2 & -2 \\ 0 & 0 & 5 \end{bmatrix} comes from AA and c=[2610]\bm{c} = \begin{bmatrix} 2 \\ 6 \\ -10 \end{bmatrix} comes from b\bm{b}.

The equation Ux=cU\bm{x} = \bm{c} is easy to solve by back substitution; in our example, z=2,y=1z = −2, y = 1 and x=2x = 2. This is also a solution to the original system Ax=bA\bm{x} = \bm{b}.

The determinant of UU is the product of the pivots. We will see this again.

Pivots may not be 00. If there is a zero in the pivot position, we must exchange that row with one below to get a non-zero value in the pivot position.

If there is a zero in the pivot position and no non-zero value below it, then the matrix AA is not invertible. Elimination can not be used to find a unique solution to the system of equations – it doesn’t exist.

Elimination Matrices

The product of a matrix (3×33 \times 3) and a column vector (3×13 \times 1) is a column vector (3×13 \times 1) that is a linear combination of the columns of the matrix.

The product of a row (3×13 \times 1) and a matrix (3×33 \times 3) is a row (1×31 \times 3) that is a linear combination of the rows of the matrix.

We can subtract 33 times row 11 of matrix AA from row 22 of AA by calculating the matrix product:

[100310001][121381041]=[121022041]\begin{bmatrix} 1 & 0 & 0 \\ -3 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 2 & 1 \\ 3 & 8 & 1 \\ 0 & 4 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 2 & 1 \\ 0 & 2 & -2 \\ 0 & 4 & 1 \end{bmatrix}

The elimination matrix used to eliminate the entry in row mm column nn is denoted EmnE_{mn}. The calculation above took us from AA to E21AE_{21}A. The three elimination steps leading to UU were: E32(E31(E21A))=UE_{32}(E_{31}(E_{21}A)) = U, where E31=IE_{31} = I. Thus E32(E21A)=UE_{32}(E_{21}A) = U.

Matrix multiplication is associative, so we can also write (E32E21)A=U(E_{32}E_{21})A = U. The product E32E21E_{32}E_{21} tells us how to get from AA to UU. The inverse of the matrix E32E21E_{32}E_{21} tells us how to get from UU to AA.

If we solve Ux=EAx=EbU\bm{x} = EA\bm{x} = E\bm{b}, then it is also true that Ax=bAx = b. This is why the method of elimination works: all steps can be reversed.

A permutation matrix exchanges two rows of a matrix; for example,

p=[010100001]p = \begin{bmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}

The first and second rows of the matrix PAPA are the second and first rows of the matrix AA. The matrix PP is constructed by exchanging rows of the identity matrix.

To exchange the columns of a matrix, multiply on the right (as in APAP) by a permutation matrix.

Note that matrix multiplication is not commutative: PAAPPA \ne AP.

Inverses

We have a matrix:

E21=[100310001]E_{21} = \begin{bmatrix} 1 & 0 & 0 \\ -3 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

which subtracts 33 times row 11 from row 22. To “undo” this operation we must add 33 times row 11 to row 22 using the inverse matrix:

E211=[100310001]E_{21}^{-1} = \begin{bmatrix} 1 & 0 & 0 \\ 3 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}

In fact, E211E21=IE_{21}^{-1}E_{21} = I.

Problems and Solutions(习题及答案)

Problem 2.1: In the two-by-two system of linear equations below, what multiple of the first equation should be subtracted from the second equation when using the method of elimination? Convert this system of equations to matrix form, apply elimination (what are the pivots?), and use back substitution to find a solution. Try to check your work before looking up the answer.

2x+3y=56x+15y=12\begin{array}{rl} 2x + 3y & = 5 \\ 6x + 15y & = 12 \end{array}

Solution

One subtracts 3\bm{3} times the first equation from the second equation in order to eliminate the 6x6x.

To convert to matrix form, use the general format Ax=bA\bm{x} = \bm{b}:

2x+3y=56x+15y=12[23615][xy]=[512]\begin{array}{rl} 2x + 3y & = 5 \\ 6x + 15y & = 12 \end{array} \to \begin{bmatrix} 2 & 3 \\ 6 & 15 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 5 \\ 12 \end{bmatrix}

We then apply elimination on matrix AA. Using the first pivot (the number 22 in the upper left corner of AA), we subtract three times the first row from the second row to get:

A=[23615]U=A=[2306]A = \begin{bmatrix} 2 & 3 \\ 6 & 15 \end{bmatrix} \to U = A = \begin{bmatrix} 2 & 3 \\ 0 & 6 \end{bmatrix}

where UU is an upper triangular matrix with pivots 22 and 66. Doing the same to the right side b=(5,12)b = (5, 12) gives a new equation of the form Ux=cU\bm{x} = \bm{c} :

[2306][xy]=[53]\begin{bmatrix} 2 & 3 \\ 0 & 6 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 5 \\ -3 \end{bmatrix}

To solve our new equation, we use back substitution:

6y=3y=126y = -3 \to \boxed{y = -\frac{1}{2}}

and

2x+3y=52x+3(12)=52x=5+32=132x=1342x + 3y =5 \to 2x +3 \Big( -\frac{1}{2}\Big) = 5 \to 2x = 5 + \frac{3}{2} = \frac{13}{2} \to \boxed{x = \frac{13}{4}}

We know that our solution fulfills the first equation; let’s make sure that our values fulfill the second equation as a check on our work:

6x+15y=6(134)+15(12)=78304=126x + 15y = 6\Big(\frac{13}{4}\Big) + 15\Big(\frac{-1}{2}\Big) = \frac{78 - 30}{4} = 12 \quad \checkmark

Problem 2.2: (2.3 #29. Introduction to Linear Algebra: Strang) Find the triangular matrix EE that reduces “Pascal’s matrix” to a smaller Pascal:

E[1000110012101331]=[1000010001100121]E\begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ 1 & 2 & 1 & 0 \\ 1 & 3 & 3 & 1 \end{bmatrix*} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 \\ 0 & 1 & 2 & 1 \end{bmatrix}

Which matrix MM (multiplying several EE’s) reduces Pascal all the way to II?

Solution

The matrix is E=[1000110001100011]E =\begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ -1 & 1 & 0 & 0 \\ 0 & -1 & 1 & 0 \\ 0 & 0 & -1 & 1 \end{bmatrix*}

One can eliminate the second column with the matrix

[1000110001100011]\begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ -1 & 1 & 0 & 0 \\ 0 & -1 & 1 & 0 \\ 0 & 0 & -1 & 1 \end{bmatrix*}

and the third column with the matrix

[1000010000100011]\begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & -1 & 1 \end{bmatrix*}

Multiplying these together, we get

M=[1000010000100011][1000110001100011][1000110001100011]=[1000110012101331]M = \begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & -1 & 1 \end{bmatrix*} \begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ -1 & 1 & 0 & 0 \\ 0 & -1 & 1 & 0 \\ 0 & 0 & -1 & 1 \end{bmatrix*} \begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ -1 & 1 & 0 & 0 \\ 0 & -1 & 1 & 0 \\ 0 & 0 & -1 & 1 \end{bmatrix*} = \begin{bmatrix*}[r] 1 & 0 & 0 & 0 \\ -1 & 1 & 0 & 0 \\ 1 & -2 & 1 & 0 \\ -1 & 3 & -3 & 1 \end{bmatrix*}

Since MM reduces the Pascal matrix to I,MI, M must be the inverse matrix!