Note for Linear Algebra 1


First Lecture: Geometric Interpretation of Systems of Equations

  • From three perspectives to view the system of equations: row graph, column graph, matrix
  • For example, for the system of equations:

\[ \begin{cases} 2x-y=0\\ -x+2y=3\\ \end{cases} \]

Image processing

  • Image of the line:

\[ \begin{bmatrix} 2 & -1 \\ -1 & 2 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ \end{bmatrix} = \begin{bmatrix} 0 \\ 3 \\ \end{bmatrix} \]

  • Can also be written as

\[ Ax=b \]

  • The intersection point of two lines in a two-dimensional plane is the solution to the equation, and this is generalized to n dimensions as the intersection point of n lines in an n-dimensional plane

List images

  • List of images:

    \[ x \begin{bmatrix} 2 \\ -1 \\ \end{bmatrix} +y \begin{bmatrix} -1 \\ 2 \\ \end{bmatrix} = \begin{bmatrix} 0 \\ 3 \\ \end{bmatrix} \]

  • The solution to the equation is the linear combination coefficients of the vector set, under which the vectors combine to form the target vector

Matrix

  • Consider the list of images, different x, y values can lead to different linear combinations. Does there exist a solution for any b, x? Or can the linear combination of these two vectors cover the entire space? Or are these two (or n) vectors linearly independent?
  • If so, then the matrix composed of these two (or n) vectors is called a nonsingular matrix, which is invertible; otherwise, it is called a singular matrix, which is not invertible

Second Lecture: Elimination, Back Substitution, and Replacement

Elimination

  • Consider the system of equations \[ \begin{cases} x+2y+z=2\\ 3x+8y+z=12\\ 4y+z=2\\ \end{cases} \]

  • His A matrix is

    \[ \begin{bmatrix} 1 & 2 & 1 \\ 3 & 8 & 1 \\ 0 & 4 & 1 \\ \end{bmatrix} \]

  • After row transformation becomes

    \[ \begin{bmatrix} 1 & 2 & 1 \\ 0 & 2 & -2 \\ 0 & 4 & 1 \\ \end{bmatrix} \]

  • Re-transformed into

    \[ \begin{bmatrix} 1 & 2 & 1 \\ 0 & 2 & -2 \\ 0 & 0 & 5 \\ \end{bmatrix} \]

  • This series of transformations is the elimination method

  • The rule of transformation is that the ith element of the ith row is set as the pivot (p), and through row transformations, the elements before the pivot in each row are successively eliminated, so that matrix A becomes matrix U (upper triangular matrix)

  • Matrix

    \[ \left[\begin{array}{c|c} A & X \\ \end{array}\right] \]

  • Augmented matrix. Applying the same transformation to b yields c.

Back-substitution

  • Solving the equation Ax=b is equivalent to solving the equation Ux=c, and solving Ux=c is very easy to obtain the solution, taking the three-term equation as an example
  • Because U is an upper triangular matrix, z can be easily obtained
  • Substitute z into the second row to find y
  • Substitute z, y into the first row to find x
  • This process is called back substitution

Replacement

\[ \begin{bmatrix} a & b & c \\ \end{bmatrix}*A \]

  • The meaning of this expression is to obtain a row matrix whose values are a times the first row of A, b times the second row of A, and c times the third row of A

Similarly \[ A*\begin{bmatrix} a \\ b \\ c \\ \end{bmatrix} \]

  • The meaning of this expression is to obtain a column matrix whose values are a times column 1 of A plus b times column 2 of A plus c times column 3 of A
  • It can be deduced that the matrix obtained by swapping two rows of matrix A is

\[ \begin{bmatrix} 0 & 1 \\ 1 & 0 \\ \end{bmatrix}*A \]

  • The matrix with columns A exchanged is

\[ A*\begin{bmatrix} 0 & 1 \\ 1 & 0 \\ \end{bmatrix} \]

  • The multiplication with a matrix completes row and column transformations; such a matrix is called a permutation matrix

  • In elimination, the row and column transformations required to eliminate the element at the i-th row and j-th column are represented as a permutation matrix, denoted as \(E_{ij}\)

  • Elimination can be written as

    \[ E_{32}E_{31}E_{21}A=U \]

Third Lecture: Multiplication and Inverse Matrices

Matrix multiplication

  • Consider matrix multiplication

    \[ A*B=C \]

  • First Algorithm: Dot Product \(C_{ij}=\sum_iA_{ik}B_{kj}\)

  • Second Algorithm: Viewed as matrix multiplication by a vector, the C column is a linear combination of the A columns, with the combination coefficients in the B matrix. For example, the elements in each row of the first column of B are the linear combination coefficients of the individual columns in A. After linear combination, the first column of C is obtained

  • Third algorithm: Viewed as a vector multiplying a matrix, the C row is a linear combination of the B row, with the combination coefficients in the A matrix; for example, each element in the first row of the A matrix is the linear combination coefficient for each row in B, and after the linear combination, the first row of C is obtained

  • Fourth algorithm: Multiply a column of A with a row of B to obtain a submatrix, and the sum of all submatrices is C

  • Fifth Algorithm: Matrix Blocking Algorithm

Invertible matrix

  • For the inverse matrix \(A^{-1}\) , there exists \(AA^{-1}=I\) , I is the identity matrix
  • The inverse matrix on the left and the inverse matrix on the right are the same
  • If there exists a non-zero matrix X such that \(AX=0\) , then A is not invertible
  • Gaussian Jordan idea for finding the inverse matrix: Treat A|I as an augmented matrix, and when transforming A to I, I is correspondingly transformed to the inverse matrix of A
    • Proof:

      \[ EA=I \\ E=A^{-1} \\ EI=A^{-1} \\ \]

Fourth Lecture: LU Decomposition of A

LU decomposition

  • \((AB)^{-1}=B^{-1}A^{-1}\)

  • The transpose matrix of A, denoted as \(A^T\) , can be easily obtained

    \[ AA^{-1}=I \\ (A^{-1})^TA^T=I \\ 所以(A^T)^{-1}=(A^{-1})^T \\ \]

  • For a single matrix, transpose and inverse can be interchanged

  • Matrix Decomposition: A = LU, where U is transformed back into A through a series of permutation matrices, and L is the cumulative permutation matrix. Taking a 3x3 matrix as an example

    \[ E_{32}E_{31}E_{21}A=U \\ 所以可得L: \\ L=E_{21}^{-1}E_{31}^{-1}E_{32}^{-1} \\ \]

  • Why study A=LU rather than EA=U: Because if there are no row transformations, the elimination coefficients can be directly written into L; conversely, if E is studied, the operation of the nth row is related to the operation of the already eliminated (n-1)th row, and the elimination coefficients cannot be written down intuitively

Elimination Consumption

  • A single multiplication and a single subtraction in the elimination process consume one element at a time (the unit of consumption is the product and subtraction of numbers rather than the product and subtraction of rows), with the total consumption being

    \[ \sum_{i=1}^{n}i*(i-1) \approx \sum_{i=1}^{n}i^2 \approx \frac 13 n^3 \]

  • For example, using a 3*3 unitary matrix, there are a total of 6 (i.e., permutation matrices)
  • For these matrices, \(P^{-1}=P^T\)
  • The permutations and inverses of these 6 matrices still lie within these 6 matrices, and are called a group
  • There are n! row permutation matrices for an n*n matrix

Lecture 5: Transposition, Permutation, Vector Space R

  • Replacement matrix is used to perform row exchanges
  • A = LU, L has 1s on the diagonal, below which are the elimination multipliers, and U has zeros below the diagonal
  • PA=LU is used to describe LU decomposition with row permutations
  • P(Permutation permutation matrix) is a unit matrix with rows rearranged, and there are n! permutations of n*n permutation matrices, which is the number of rearrangements of the rows. They are all invertible, and finding the inverse is equivalent to finding the transpose

Transpose

  • Row exchange is equivalent to transpose, denoted as \(A^T\) , \(A_{ij}=A_{ji}^T\)
  • \((AB)^T=B^TA^T\)
  • Symmetric matrix (symmetric), \(A^T=A\)
  • For any matrix A, \(AA^T\) is always symmetric, because \((A^TA)^T=(A^TA^{TT})=(A^TA)\)

Vector Space

  • Vectors can be added and subtracted, and can be dotted
  • A space represents a set of vectors, not all vectors, and a vector space is constrained, requiring the condition of closure under linear combinations
  • For example, \(R^2\) represents the two-dimensional vector space of all real numbers
  • Any vector in a vector space remains within the vector space after linear combination, thus the vector space must contain (0,0)
  • Not an example of a vector space: Only the first quadrant of \(R^2\) is taken, vector addition within any space remains within the space, but scalar multiplication is not necessarily so (it can be multiplied by a negative number), and vector spaces are closed
  • A straight line passing through the origin within \(R^2\) can be called the vector subspace \(R^2\) , which still satisfies the property of self-closedness (addition, subtraction, and scalar multiplication)
  • What are the subspaces of \(R^2\) ?
    • Itself
    • A straight line extending infinitely on both sides beyond the origin (note that this is different from \(R^1\) )
    • (0,0), abbreviated as Z
  • What are the subspaces of \(R^3\) ?
    • Itself
    • A straight line extending infinitely on both sides beyond the origin (note that this is different from \(R^1\) )
    • Infinite Plane Beyond Zero Point
    • (0,0,0)

Through matrix construction into quantum space

\[ A=\begin{bmatrix} 1 & 3 \\ 2 & 3 \\ 4 & 1 \\ \end{bmatrix} \]

  • Each column belongs to \(R^3\) , and any linear combination (scalar multiplication and addition) of these two columns should be in the subspace, which is called the column space, denoted as C(A). In three-dimensional space, this column space is a plane, passing through these two column vectors and (0,0,0) mark

Lecture 6: Column Space and Null Space

List space

  • The previous lecture mentioned two subspaces, the plane P and the line L. \(P \bigcup L\) is not a subspace, \(P \bigcap L\) is a subspace.

  • For any subspaces S, T, \(S \bigcap T\) is a subspace

  • Give an example

    \[ A=\begin{bmatrix} 1 & 1 & 2 \\ 2 & 1 & 3 \\ 3 & 1 & 5 \\ 4 & 1 & 5 \\ \end{bmatrix} \]

  • C(A) is the \(R^4\) subspace, and the linear combination of these three column vectors yields the subspace

  • The subspace is related to the linear system below

  • Are there solutions for Ax=b for any b? How can b make x have a solution?

    • The answer to the former is no, because with four equations and three unknowns, the linear combination of three column vectors cannot fill the entire \(R^4\) space, i.e., the column space cannot fill the entire four-dimensional space
    • The latter responds that obviously b=(0,0,0,0) is an answer, and b=(1,2,3,4) is also an answer, i.e., first write any solution (x1,x2,x3), and the calculated b is the b that makes x have a solution, which is equivalent to only when b is in the column space of A, x has a solution
  • If we remove the third column, we can still obtain the same column space, because these three columns are not linearly independent; the third column is the sum of the first two columns. At this point, we call the first two columns the main columns, so the column space in this case is a two-dimensional subspace

Zero Space

  • The null space (null space) is completely different from the column space; the null space of A contains all solutions x to Ax = 0

  • Column space concerns A, the null space concerns x (in the case where b=0), in the example above, the column space is a subspace of four-dimensional space, and the null space is a subspace of three-dimensional space

    \[ \begin{bmatrix} 1 & 1 & 2 \\ 2 & 1 & 3 \\ 3 & 1 & 5 \\ 4 & 1 & 5 \\ \end{bmatrix} \begin{bmatrix} X_1 \\ X_2 \\ X_3 \\ \end{bmatrix} \begin{bmatrix} 0 \\ 0 \\ 0 \\ 0 \\ \end{bmatrix} \]

  • Clearly, the zero space contains (0,0,0) and (1,1,-1), and these two vectors determine a line (c,c,-c), so this line is the zero space

  • Why can the zero space be called a space (satisfying the closure property of vector spaces?): namely, to prove that for any two solutions of Ax=0, their linear combination is still a solution. Because: ...matrix multiplication can be expanded... the distributive law...

\[ \begin{bmatrix} 1 & 1 & 2 \\ 2 & 1 & 3 \\ 3 & 1 & 5 \\ 4 & 1 & 5 \\ \end{bmatrix} \begin{bmatrix} X_1 \\ X_2 \\ X_3 \\ \end{bmatrix} \begin{bmatrix} 1 \\ 2 \\ 3 \\ 4 \\ \end{bmatrix} \]

  • We replaced b, and the solution is (1,0,0). Are there other solutions? If there are, can these solutions form a subspace?
  • Clearly not a subspace, as the solution does not contain (0,0,0), which does not satisfy the basic conditions of a vector space, as in this case, the two solutions (1,0,0), (0,-1,1), but the linear combination of these vectors does not pass through the origin, and they cannot form a vector space. Therefore, the discussion of the solution space or null space is based on the condition that b=0.
  • Two methods of constructing subspaces are the column space and the null space
    • From several vectors, a subspace is obtained through linear combination
    • From a system of equations, obtain a subspace by making x satisfy specific conditions

Lecture 7: Main Variables, Special Solutions

Main Variable

  • How to Solve Ax=0 with Algorithms

  • Give an example:

    \[ A=\begin{bmatrix} 1 & 2 & 2 & 2 \\ 2 & 4 & 6 & 8 \\ 3 & 6 & 8 & 10 \\ \end{bmatrix} \]

  • The third line is the sum of the first and second lines; they are linearly related, which will be reflected in the elimination process later

  • Elimination does not change the set of equations, because elimination modifies the column space, but not the solution space

  • After the first elimination, only the leading element in the first row of the first column is non-zero

\[ A=\begin{bmatrix} 1 & 2 & 2 & 2 \\ 0 & 0 & 2 & 4 \\ 0 & 0 & 2 & 4 \\ \end{bmatrix} \]

  • At this point, due to linear correlation between the second and third columns, the pivot of the second row has shifted to the third column, and the elimination process continues

    \[ A=\begin{bmatrix} 1 & 2 & 2 & 2 \\ 0 & 0 & 2 & 4 \\ 0 & 0 & 0 & 0 \\ \end{bmatrix}=U \]

  • If we separate the non-zero elements from the zeros, we obtain a step line, with the number of steps being the number of leading elements (non-zero), which is 2 in this case, and we call this the rank of the matrix (the number of equations remaining after elimination), the columns containing the leading elements are called leading columns (1,3), and the remaining columns are free columns (2,4)

  • Now we can solve Ux=0 and perform back substitution

  • The solutions corresponding to the free columns are the free variables x2, x4, which can be arbitrarily chosen. After selection, the main variables x1, x3 corresponding to the main columns can be solved out by back substitution

Special Solution

  • In this case, if we take x2=1, x4=0, we can obtain x=(-2,1,0,0), and (-2,1,0,0) multiplied by any real number is still a solution, thus determining a line. However, is this line the solution space? No. Because we have two free variables, we can determine more than one line, for example, taking x2=0, x4=1, we can obtain x=(2,0,-2,1).
  • So the algorithm first eliminates variables, obtaining the leading column and the free column, then assigns values (1,0) to the free variables to complete the solution (-2,1,0,0), and then assigns another set of values (0,1) to the free variables to obtain another complete solution (2,0,-2,1).
  • Two special values for the free variables (one being 1, the rest being 0, with none being 0, as that would result in a complete solution that is all zeros) yield two sets of solutions, which are called particular solutions. Based on the particular solutions, we can obtain the solution space: the linear combination of the two particular solutions, a*(-2,1,0,0) + b*(2,0,-2,1)
  • r represents the number of principal variables, i.e., the number of principal elements, and only r equations are active. The m*n matrix A has n-r free variables

Simplified row ladder form

  • U can be further simplified

    \[ U=\begin{bmatrix} 1 & 2 & 2 & 2 \\ 0 & 0 & 2 & 4 \\ 0 & 0 & 0 & 0 \\ \end{bmatrix} \]

  • In the reduced row echelon form (RREF), all entries above the leading pivot are also 0

    \[ U=\begin{bmatrix} 1 & 2 & 0 & -2 \\ 0 & 0 & 2 & 4 \\ 0 & 0 & 0 & 0 \\ \end{bmatrix} \]

  • And the leading element must be made into 1, because b=0, so the second row can be directly divided by 2

    \[ U=\begin{bmatrix} 1 & 2 & 0 & -2 \\ 0 & 0 & 1 & 2 \\ 0 & 0 & 0 & 0 \\ \end{bmatrix}=R \]

  • Simplified row 阶梯 form contains all the information of the matrix in its simplest form

  • The unit matrix is located at the intersection of the main row and the main column

  • An extremely simplified system of equations is obtained: Rx = 0 (columns can be arbitrarily interchanged), F represents free columns

    \[ R=\begin{bmatrix} I & F \\ 0 & 0 \\ \end{bmatrix} \]

    Among them, I is the unit matrix (principal column), F is the matrix corresponding to the free columns, R has r rows, I has r columns, and F has n-r columns

Zero-space matrix

  • Zero space matrix, whose columns are composed of particular solutions, denoted as N, it can be seen that if there are a number of free variables, then N has a columns, and if there are no free variables, N does not exist, x has only a unique solution or no solution

    \[ R*N=0 \]

    \[ N=\begin{bmatrix} -F \\ I \\ \end{bmatrix} \]

  • The entire equation can be written as

    \[ \begin{bmatrix} I & F \\ \end{bmatrix} \begin{bmatrix} x_{pivot} \\ x_{free} \\ \end{bmatrix}=0 \]

    \[ x_{pivot}=-F \]

Take an example to go through the algorithm again

  • Original Matrix

    \[ A=\begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 2 & 6 & 8 \\ 2 & 8 & 10 \\ \end{bmatrix} \]

  • First elimination

    \[ A=\begin{bmatrix} 1 & 2 & 3 \\ 0 & 0 & 0 \\ 0 & 2 & 2 \\ 0 & 4 & 4 \\ \end{bmatrix} \]

  • Second elimination (perform a row swap to make the second pivot element in the second row)

    \[ A=\begin{bmatrix} 1 & 2 & 3 \\ 0 & 2 & 2 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}=U \]

  • Clearly, r=2, 1 degree of freedom, let the degree of freedom be 1, obtain the particular solution x

    \[ x=\begin{bmatrix} -1 \\ -1 \\ 1 \\ \end{bmatrix} \]

  • Zero space is denoted as cx, a straight line, with x being the basis of the zero space

  • Next, continue to simplify U

    \[ U=\begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}=R= \begin{bmatrix} I & F \\ 0 & 0 \\ 0 & 0 \\ \end{bmatrix} \]

\[ F=\begin{bmatrix} 1 \\ 1 \\ \end{bmatrix}=U \]

\[ x=\begin{bmatrix} -F \\ I \\ \end{bmatrix}=N \]

Lecture 8: Solvability and the Structure of Solutions

Solvability

\[ \begin{cases} x_1+2x_2+2x_3+2x_4=b_1\\ 2x_1+4x_2+6x_3+8x_4=b_2\\ 3x_1+6x_2+8x_3+10x_4=b_3\\ \end{cases} \]

  • Written in the expanded matrix form:

    \[ \left[\begin{array}{c c c c|c} 1 & 2 & 2 & 2 & b_1 \\ 2 & 4 & 6 & 8 & b_2 \\ 3 & 6 & 8 & 10 & b_3 \\ \end{array}\right] \]

  • Elimination yields:

    \[ \left[\begin{array}{c c c c|c} 1 & 2 & 2 & 2 & b_1 \\ 0 & 0 & 2 & 4 & b_2-2b_1 \\ 0 & 0 & 0 & 0 & b_3-b_2-b_1 \\ \end{array}\right] \]

  • The first and third columns are the main columns, while the second and fourth columns are free columns

  • Solvability: What conditions must b satisfy when there is a solution? The easily obtainable condition is that b must be in the column space of A

  • If the linear combination of each row of A results in 0, what conditions must b satisfy? Then, the same combination of elements in b must also be zero

  • How to find all solutions of Ax=b?

    • First step: Find a particular solution, set all free variables to 0, and solve for all principal variables. In the example, \(x_2和x_4\) is set to 0, which yields \(x_1和x_3\) to be -2 and 1.5, respectively.

    • The second step: The complete solution is a particular solution plus any vector in the null space

    • \(Ax_{particular}=b \\ Ax_{nullspace}=0 \\ A(x_{particular}+x_{nullspace})=b\)

    • In this case, the particular solution is (-2,0,1.5,0), and the solutions in the null space are (-2,1,0,0) and (2,0,-2,1).

    • Complete solution is:

      \[ x_{complete}= \begin{bmatrix} -2 \\ 0 \\ 1.5 \\ 0 \\ \end{bmatrix}+ c_1\begin{bmatrix} -2 \\ 1\\ 0 \\ 0 \\ \end{bmatrix}+ c_2\begin{bmatrix} 2 \\ 0 \\ -2 \\ 1 \\ \end{bmatrix} \]

    • If its image is plotted in a four-dimensional space with four solutions as axes, it forms a plane, similar to a subspace translating from the zero point to a particular solution point

Structure of the Explanation

  • Consider an m*n matrix of rank r, where r <= m and r <= n, with the case when r is full rank, i.e., r = min(m, n)

  • Rank full: r=n

    \[ R=\begin{bmatrix} I \\ 0 \\ \end{bmatrix} \]

  • Rank full: r = m < n, at this time, no zero row will appear during elimination, and for any b, Ax = b has a solution. There are n - r, i.e., n - m, free variables. At this time, the form of r is

    \[ R=\begin{bmatrix} I & F \\ \end{bmatrix} \]

  • When r=m=n, A is a reversible matrix, R=I, N(A)={0}, and the system Ax=b has a solution for any b, and the solution is unique

An explanation from a netizen's perspective of the vector space

When the dimension r occupied by the vectors equals the number of vectors n and also equals the dimension m of the ambient space, these vectors can be combined to form any vector within the ambient space, that is, for any value of b, there is always a solution. However, since all vectors must be combined together to reach any coordinate point in the entire ambient space, the stretching of each vector must be a specific amount, meaning x has only one solution. When the dimension r occupied by the vectors equals the dimension m of the ambient space but is less than the number of vectors n, that is, the stretching and combination of some vectors in A can reach any coordinate point in the ambient space, there exist free vectors here. Regardless of the position b takes in the space, you can first arbitrarily stretch your free vector to obtain a new vector, and then combine this new vector with the part of vectors that can completely reach the ambient space through a specific contraction to obtain vector b. As long as the stretching amount of the free vector changes, the contraction amount of the other vectors must also change, so X has infinitely many solutions. (Expressed in terms of the x formula, this means you can use the stretching and combination of some vectors in A (m primitive vectors) to obtain b (this is the particular solution) and then use m primitive vectors and the other n-m free vectors to arbitrarily form a zero vector, thus obtaining infinitely many sets of x.) When the dimension occupied by the vectors equals the number of vectors but is less than the dimension of the ambient space, that is, the vectors in A can only cover a subspace of the ambient space but there are free vectors in this subspace, then if b is within this subspace, the situation is the same as the second point, X has infinitely many solutions; if b is outside the subspace, X cannot be contracted to reach it, so there is no solution.