Skip to main content

Lecture 3: Multiplication and Inverse Matrices

讲座摘要(lecture summary)

Matrix Multiplication

We discuss four different ways of thinking about the product AB=CAB = C of two matrices. If AA is an m×nm \times n matrix and BB is an n×pn × p matrix, then CC is an m×pm × p matrix. We use cijc_{ij} to denote the entry in row ii and column jj of matrix CC.

Standard (row times column)

The standard way of describing a matrix product is to say that cijc_{ij} equals the dot product of row ii of matrix AA and column jj of matrix BB. In other words, cij=k=1naikbkjc_{ij}=\displaystyle\sum_{k=1}^{n}a_{ik}b_{kj}.

Columns

The product of matrix AA and column jj of matrix BB equals column jj of matrix CC. This tells us that the columns of CC are combinations of columns of AA.

Rows

The product of row ii of matrix AA and matrix BB equals row ii of matrix CC. So the rows of CC are combinations of rows of BB.

Column times row

A column of AA is an m×1m × 1 vector and a row of BB is a 1×p1 × p vector. Their product is a matrix:

[234][16]=[212318424]\begin{bmatrix*}[c] 2 \\ 3 \\ 4 \end{bmatrix*} \begin{bmatrix*}[c] 1 & 6\\ \end{bmatrix*} = \begin{bmatrix*}[c] 2 & 12 \\ 3 & 18 \\ 4 & 24 \end{bmatrix*}

The columns of this matrix are multiples of the column of AA and the rows are multiples of the row of BB. If we think of the entries in these rows as the coordinates (2,12)(2, 12) or (3,18)(3, 18) or (4,24)(4, 24), all these points lie on the same line; similarly for the two column vectors. Later we’ll see that this is equivalent to saying that the row space of this matrix is a single line, as is the column space.

The product of AA and BB is the sum of these ”column times row” matrices:

AB=k=1n[a1kamk][bk1bkn]AB = \sum_{k=1}^{n} \begin{bmatrix*}[r] a_{1k} \\ \vdots \\ a_{mk} \end{bmatrix*} \begin{bmatrix*}[c] b_{k1} & \dots & b_{kn}\\ \end{bmatrix*}

Blocks

If we subdivide AA and BB into blocks that match properly, we can write the product AB=CAB = C in terms of products of the blocks:

[A1A2A3A4][B1B2B3B4]=[C1C2C3C4].\begin{bmatrix*}[c] \textcolor{blue}{A_1} & \textcolor{blue}{A_2} \\ A_3 & A_4 \end{bmatrix*} \begin{bmatrix*}[c] \textcolor{#228B22}{B_1} & B_2 \\ \textcolor{#228B22}{B_3} & B_4 \end{bmatrix*} = \begin{bmatrix*}[c] C_1 & C_2 \\ C_3 & C_4 \end{bmatrix*}.

Here C1=A1B1+A2B3C_1 = A_1 B_1 + A_2 B_3

Inverses

Square matrices

If AA is a square matrix, the most important question you can ask about it is whether it has an inverse A1A^{−1}. If it does, then A1A=I=AA1A^{−1}A = I = AA^{−1} and we say that AA is invertible or nonsingular.

If A is singular – i.e. A does not have an inverse – its determinant is zero and we can find some non-zero vector x\bm{x} for which Ax=0A\bm{x} = 0. For example:

[1226][31]=[00].\begin{bmatrix*}[c] 1 & 2 \\ 2 & 6 \end{bmatrix*} \begin{bmatrix*}[r] 3 \\ -1 \end{bmatrix*} = \begin{bmatrix*}[c] 0 \\ 0 \end{bmatrix*}.

In this example, three times the first column minus one times the second column equals the zero vector; the two column vectors lie on the same line.

Finding the inverse of a matrix is closely related to solving systems of linear equations:

[1327][acbd]=[1001]AA1I\begin{array}{cccc} \begin{bmatrix*}[c] 1 & 3 \\ 2 & 7 \end{bmatrix*} & \begin{bmatrix*}[c] a & c \\ b & d \end{bmatrix*} & = & \begin{bmatrix*}[c] 1 & 0 \\ 0 & 1 \end{bmatrix*} \\ A & A^{-1} & &I \end{array}

can be read as saying ”A times column jj of A1A^{−1} equals column jj of the identity matrix”. This is just a special form of the equation Ax=bA\bm{x} = \bm{b}.

Gauss-Jordan Elimination

We can use the method of elimination to solve two or more linear equations at the same time. Just augment the matrix with the whole identity matrix II:

[13102701][13100121][10730121]\bigg[\begin{array}{cc|cc} 1 & 3 & 1 & 0 \\ 2 & 7 & 0 & 1 \end{array}\bigg] \to \bigg[\begin{array}{cc|cc} 1 & 3 & 1 & 0 \\ 0 & 1 & -2 & 1 \end{array}\bigg] \to \bigg[\begin{array}{cc|cc} 1 & 0 & 7 & -3 \\ 0 & 1 & -2 & 1 \end{array}\bigg]

(Once we have used Gauss’ elimination method to convert the original matrix to upper triangular form, we go on to use Jordan’s idea of eliminating entries in the upper right portion of the matrix.)

A1=[7321].A^{-1} = \begin{bmatrix*}[r] 7 & -3 \\ -2 & 1 \end{bmatrix*}.

As in the last lecture, we can write the results of the elimination method as the product of a number of elimination matrices EijE_{ij} with the matrix AA. Letting EE be the product of all the EijE_{ij}, we write the result of this Gauss-Jordan elimination using block matrices: E[AI]=[IE]E[\begin{array}{c|c} A & I \end{array}] = [\begin{array}{c|c} I & E \end{array}]. But if EA=IEA = I, then E=A1E = A^{−1}.

Problems and Solutions(习题及答案)

Problem 3.1: Add ABAB to ACAC and compare with A(B+C)A(B + C) :

A=[1234]B=[1000]C=[0056]A = \begin{bmatrix*}[r] 1 & 2 \\ 3 & 4 \end{bmatrix*} \quad B = \begin{bmatrix*}[r] 1 & 0 \\ 0 & 0 \end{bmatrix*} \quad C = \begin{bmatrix*}[r] 0 & 0 \\ 5 & 6 \end{bmatrix*}

Solution

We first add ABAB to ACAC :

AB=[1234][1000]=[1030],AB=[1234][0056]=[10122024]AB+AC=[1030]+[10122024]=[11122324].\begin{array}{c} AB=\begin{bmatrix*}[r] 1 & 2 \\ 3 & 4 \end{bmatrix*}\begin{bmatrix*}[r] 1 & 0 \\ 0 & 0 \end{bmatrix*} = \begin{bmatrix*}[r] 1 & 0 \\ 3 & 0 \end{bmatrix*}, AB=\begin{bmatrix*}[r] 1 & 2 \\ 3 & 4 \end{bmatrix*}\begin{bmatrix*}[r] 0 & 0 \\ 5 & 6 \end{bmatrix*} = \begin{bmatrix*}[r] 10 & 12 \\ 20 & 24 \end{bmatrix*} \\\\ \to AB + AC = \begin{bmatrix*}[r] 1 & 0 \\ 3 & 0 \end{bmatrix*} + \begin{bmatrix*}[r] 10 & 12 \\ 20 & 24 \end{bmatrix*} = \begin{bmatrix*}[r] 11 & 12 \\ 23 & 24 \end{bmatrix*}. \end{array}

We then compute A(B+C)A(B + C) :

B+C=[1000]+[0056]=[1056]B + C = \begin{bmatrix*}[r] 1 & 0 \\ 0 & 0 \end{bmatrix*} + \begin{bmatrix*}[r] 0 & 0 \\ 5 & 6 \end{bmatrix*} = \begin{bmatrix*}[r] 1 & 0 \\ 5 & 6 \end{bmatrix*}A(B+C)=[1234][1056]=[11122324]=AB+AC.\to A (B+C) = \begin{bmatrix*}[r] 1 & 2 \\ 3 & 4 \end{bmatrix*} \begin{bmatrix*}[r] 1 & 0 \\ 5 & 6 \end{bmatrix*} = \begin{bmatrix*}[r] 11 & 12 \\ 23 & 24 \end{bmatrix*} = AB + AC.

Therefore, AB+AC=A(B+C)AB + AC = A(B + C).

Problem 3.2: (2.5 #24. Introduction to Linear Algebra: Strang) Use GaussJordan elimination on [UI][U \: I] to find the upper triangular U1U^{−1} :

UU1=I[1ab01c001][x1x2x3]=[100010001].UU^{−1} = I \begin{bmatrix*}[r] 1 & a & b \\ 0 & 1 & c \\ 0 & 0 & 1 \end{bmatrix*} \begin{bmatrix*}[r] & & \\ x_1 & x_2 & x_3 \\ & & \end{bmatrix*} = \begin{bmatrix*}[r] 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix*}.

Solution

Row reduce [UI][U \: I] to get [IU1][I \: U^{−1}] as follows (here, Ri=R_i = row ii)

[1ab10001c010001001](R1=R1aR2)(R2=R2cR2)[10bac1a001001c001001]\begin{bmatrix*}[r] 1 & a & b && 1 & 0 & 0 \\ 0 & 1 & c && 0 & 1 & 0 \\ 0 & 0 & 1 && 0 & 0 & 1 \end{bmatrix*} \to \begin{array}{r} (R_1 = R_1 -aR_2) \\ (R_2 = R_2 - cR_2) \\ \quad \end{array} \begin{bmatrix*}[r] 1 & 0 & b-ac && 1 & -a & 0 \\ 0 & 1 & 0 && 0 & 1 & -c \\ 0 & 0 & 1 && 0 & 0 & 1 \end{bmatrix*}(R1=R1(bac)R3)[1001aacb01001c001001]=[IL1]\to \begin{array}{r} (R_1 = R_1 -(b-ac)R_3) \\ \quad \\ \quad \end{array} \begin{bmatrix*}[r] 1 & 0 & 0 && 1 & -a & ac-b \\ 0 & 1 & 0 && 0 & 1 & -c \\ 0 & 0 & 1 && 0 & 0 & 1 \end{bmatrix*} = [I \:\: L^{-1}]