Linear Algebra Nut Shell
Linear Algebra Nut Shell
685
Now we take a deeper look at linear equations, without proving every statement we make. The goal is to discover what Ax = b really means. One reference is my textbook Introduction to Linear Algebra, published by Wellesley-Cambridge Press. That book has a much more careful development with many examples (you could look at the course page, with videos of the lectures, on ocw.mit.edu or web.mit.edu/18.06). The key is to think of every multiplication Ax, a matrix A times a vector x, as a combination of the columns of A: Matrix Multiplication by Columns 1 2 3 6 C D =C 1 3 +D 2 6 = combination of columns .
Multiplying by rows, the rst component C + 2D comes from 1 and 2 in the rst row
of A. But I strongly recommend to think of Ax a column at a time. Notice how
686
x = (1, 0) and x = (0, 1) will pick out single columns of A: 1 2 3 6 1 0 = rst column 1 2 3 6 0 1 = last column .
Suppose A is an m by n matrix. Then Ax = 0 has at least one solution, the all-zeros vector x = 0. There are certainly other solutions in case n > m (more unknowns than equations). Even if m = n, there might be nonzero solutions to Ax = 0; then A is square but not invertible. It is the number r of independent rows and columns that counts. That number r is the rank of A (r m and r n). The nullspace of A is the set of all solutions x to Ax = 0. This nullspace N (A) contains only x = 0 when the columns of A are independent. In that case the matrix A has full column rank r = n: independent columns. For our 2 by 2 example, the combination with C = 2 and D = 1 produces the zero vector. Thus x = (2, 1) is in the nullspace, with Ax = 0. The columns (1, 3) and (2, 6) are linearly dependent. One column is a multiple of the other column. The rank is r = 1. The matrix A has a whole line of vectors cx = c(2, 1) in its nullspace: Nullspace is a line 1 2 3 6 2 1 = 0 0 and also 1 2 3 6 2c c = 0 0 .
If Ax = 0 and Ay = 0, then every combination cx + dy is in the nullspace. Always Ax = 0 asks for a combination of the columns of A that produces the zero vector: x in nullspace x1 (column 1) + + xn (column n)= zero vector
When those columns are independent, the only way to produce Ax = 0 is with x1 = 0, x2 = 0, . . ., xn = 0. Then x = (0, . . . , 0) is the only vector in the nullspace of A. Often this will be our requirement (independent columns) for a good matrix A. In that case, AT A also has independent columns. The square n by n matrix AT A is then invertible and symmetric and positive denite. If A is good then AT A is even better. I will extend this review (still optional ) to the geometry of Ax = b.
We can only solve Ax = b when the vector b is on that line. For b = (1, 4) there is no solution, it is o the line. For b = (5, 15) there are many solutions (5 times column 1 gives b, and this b is on the line). The big step is to look at a space of vectors:
687
Denition: The column space contains all combinations of the columns. In other words, C (A) contains all possible products A times x. Therefore Ax = b is solvable exactly when the vector b is in the column space C (A). For an m by n matrix, the columns have m components. The column space of A is in m-dimensional space. The word space indicates that the key operation of linear algebra is allowed: Any combination of vectors in the space stays in the space. The zero combination is allowed, so the vector x = 0 is in every space. How do we write down all solutions, when b belongs to the column space of A ? Any one solution to Ax = b is a particular solution xp. Any vector xn in the nullspace solves Ax = 0. Adding Axp = b to Axn = 0 gives A(xp + xn ) = b. The complete solution to Ax = b has this form x = xp + xn : Complete solution x = xparticular + xnullspace = (one xp ) + (all xn ) .
In the example, b = (5, 15) is 5 times the rst column, so one particular solution is xp = (5, 0). To nd all other solutions, add to xp any vector xn in the nullspace which is the line through (2, 1). Here is xp + (all xn ): 2c 5 1 2 C 5 C . + = = gives xcomplete = c 0 D 3 6 D 15 This line of solutions is drawn in Figure A1. It is not a subspace. It does not contain (0, 0), because it is shifted over by the particular solution (5, 0). We only have a space of solutions when b is zero (then the solutions ll the nullspace). D
1 2
= shortest solution pinv(A) b is in the row space line of all solutions xp + all xn (not a subspace)
5 0
Axn = 0 : nullspace
xn
May I collect three important comments on linear equations Ax = b. 1. Suppose A is a square invertible matrix (the most common case in practice). Then the nullspace only contains xn = 0. The particular solution xp = A1 b is the only solution. The complete solution xp + xn is A1 b + 0. Thus x = A1 b.
688
2.
Linear Algebra In A Nutshell Ax = b has innitely many solutions in Figure A1. The shortest x always lies in the row space of A. That particular solution (1, 2) is found by the pseudoinverse pinv (A). The backslash A\b nds an x with at most m nonzeros. Suppose A is tall and thin (m > n). The n columns are likely to be independent. But if b is not in the column space, Ax = b has no solution. The least squares method minimizes b Ax 2 by solving AT Ax = AT b.
3.
The four subspaces N (A), C (A), N (AT ), C (AT ) combine beautifully into the big picture of linear algebra. Figure A2 shows how the nullspace N (A) is perpendicular to the row space C (AT ). Every input vector x splits into a row space part xr and a nullspace part xn . Multiplying by A always(!) produces a vector in the column space. Multiplication goes from left to right in the picture, from x to Ax = b.
Axr = b b Ax =
xr x = xr + xn
Axn = 0
1 2 A= 3 6
Figure A2: The four fundamental subspaces (lines) for the singular matrix A.
689
On the right side are the column space C (A) and the fourth space N (AT ). Again they are perpendicular. The columns are multiples of (1, 3) and the y s are multi ples of (3, 1). If A were an m by n matrix, its columns would be in m-dimensional space Rm and so would the solutions to AT y = 0. Our singular 2 by 2 example has m = n = 2, and all four fundamental subspaces in Figure A2 are lines in R2 . This gure needs more words. Each subspace contains innitely many vectors, or only the zero vector x = 0. If u is in a space, so are 10u and 100u (and most importantly 0u). We measure the dimension of a space not by the number of vectors, which is innite, but by the number of independent vectors. In this example each dimension is 1. A line has one independent vector but not two
Here are particular bases for Rn among all the choices we could make: Standard basis = General basis = Orthonormal basis = columns of the identity matrix columns of any invertible matrix columns of any orthogonal matrix
Dierence Matrices
Dierence matrices with boundary conditions give exceptionally good examples of the four subspaces (and there is a physical meaning behind them). We choose forward and backward dierences that produce 2 by 3 and 3 by 2 matrices: 1 0 Forward + 1 1 0 and AT = 1 1 . A= 0 1 1 Backward 0 1 A is imposing no boundary conditions (no rows are chopped o). Then AT must impose two boundary conditions and it does: +1 disappeared in the rst row and 1 in the third row. AT w = f builds in the boundary conditions w0 = 0 and w3 = 0. The nullspace of A contains x = (1, 1, 1). Every constant vector x = (c, c, c) solves Ax = 0, and the nullspace N (A) is a line in three-dimensional space. The row space of A is the plane through the rows (1, 1, 0) and (0, 1, 1). Both vectors are perpendicular to (1, 1, 1) so the whole row space is perpendicular to the nullspace. Those two spaces are on the left side (the 3D side) of Figure A3.
690
Perpendicular xT AT w = 0
x in Nullspace Ax = 0 N (A)
w in Nullspace of AT AT w = 0 N (AT )
Figure A3: Dimensions and orthogonality for any m by n matrix A of rank r. Figure A3 shows the Fundamental Theorem of Linear Algebra: 1. 2. 3. 4. The row space in Rn and column space in Rm have the same dimension r. The nullspaces N (A) and N (AT ) have dimensions n r and m r. N (A) is perpendicular to the row space C (AT ). N (AT ) is perpendicular to the column space C (A).
The dimension r of the column space is the rank of the matrix. It equals the number of (nonzero) pivots in elimination. The matrix has full column rank when r = n and the columns are linearly independent; the nullspace only con tains x = 0. Otherwise some nonzero combination x of the columns produces Ax = 0. The dimension of the nullspace is n r. There are n unknowns in Ax = 0, and there are really r equations. Elimination leaves n r columns without pivots. The corresponding unknowns are free (give them any values). This produces n r independent solutions to Ax = 0, a basis for the nullspace. A good basis makes scientic computing possible: 1 Sines and cosines 2 Finite elements 3 Splines 4 Wavelets