前言

略

课程链接

线性系统以及解的形式

For a Linear System, we can form like this:
A x = b (1) A\textbf{x}=b\tag{1} Ax=b(1)
where A A A refers to a matrix, x is parameters needs to be determined, and b is the bias.

As for the Existence and Solutions

If A ∈ R M × N A\in \textbf{R}^{M\times N} A∈RM×N, we have:

  1. If M = N M=N M=N, and matrix A A A is nonsingular and square, we have a unique solution.
  2. If M < N M<N M<N, there are infinitely many solutions. We can find the null space of A A A ( A x = 0 ) Ax=0) Ax=0) using SVD.
  3. If M > N M>N M>N, we can ask for a least-square solution(If we couldn’t get the reasonable solution), e.g., from the normal equation ( A T A ) x = ( A T b ) (A^TA)x=(A^Tb) (ATA)x=(ATb)

Additionally, If we have M = N M=N M=N, but the matrix A A A is singular ( det ⁡ A = 0 \det{A}=0 detA=0), this situation is equal the situation 2, for we can delete useless equations to make M M M smaller.

Concepts in Linear Algebra

  • Vector Space: Which means that for any x x x, y y y in the space, we have x + y x+y x+y and c x cx cx in the space, too, where c c c is a number.
  • Linear independent: Easy to understand.
  • Dimension: The max number of linearly independent vectors; Rank of A A A is the dimension of the range of A A A.
  • Null Space of A A A: the set of all x, such that A x = 0 Ax=0 Ax=0
  • Range of A A A: the set of all A x Ax Ax
  • Rank of A A A: max number of linearly independent rows or columns
  • r a n k A + r a n k ( N u l l S p a c e ( A ) ) = N rankA + rank(Null Space(A))=N rankA+rank(NullSpace(A))=N, where N is the number of columns of A A A.

Cramer Rules

在这里插入图片描述
where A j A_j Aj​ means that we replace the j-th column by the b b b vector.

More advanced Computation Methods

Gauss Elimination

This method is used to find the inverse matrix or the solutions.
For a set of equations { L i } n \{L_i\}_n {Li​}n​, first we need to construct the Augmented matrix, then we need to reduce all the elements in columns one to 0 except for the first row. Then We repeat it. and reduce the left n columns of the augmented matrix to an identity matrix.

The result is the last column of the augmented matrix.

Link

Notice: LU equivalent to Gauss Elimination

LU Decomposition

NOTICE: Not all real square matrixes have LU decomposition. More normally, we have:
P A = L U (2) PA=LU\tag{2} PA=LU(2)
where P P P is a permutation matrix which records the row change information.

With the computational complexity is O ( N 3 ) O(N^3) O(N3) and memory complexity is O ( N 2 ) O(N^2) O(N2)
在这里插入图片描述

Crout’s Algorithm for LU Decomposition

在这里插入图片描述
在这里插入图片描述

In summary, we can finish the Crout’s alg. in a column order.

Pivoting

在这里插入图片描述

Combination of Cramer’s Rule and LU Decomp to Get Solution

For an linear equation A x = b Ax=b Ax=b,

  • Do LU Dcomp for A A A, L U = A LU=A LU=A
  • Forward steps: Using Cramer’s Rule to solute L y = b Ly=b Ly=b, where y = U x y=Ux y=Ux
  • Backward stsp: Using Cramer’s Rule to solute U x = y Ux=y Ux=y

One more thing

det ⁡ ( A ) = det ⁡ ( U ) \det(A)=\det(U) det(A)=det(U)

One more thing

在这里插入图片描述

Tutorial Result

在这里插入图片描述
(a)
L = [ 1 0 0 − 1 1 0 6 − 3 1 ] , U = [ 1 2 5 0 4 8 0 0 − 5 ] L = \begin{bmatrix} 1 & 0 & 0 \\ -1 & 1 & 0 \\ 6 & -3 & 1 \end{bmatrix}, U=\begin{bmatrix} 1 & 2& 5\\ 0& 4 & 8 \\ 0 & 0 & -5 \end{bmatrix} L= ​1−16​01−3​001​ ​,U= ​100​240​58−5​ ​
x = [ 0.5 , 2.25 , − 1 ] T x=[0.5, 2.25, -1]^T x=[0.5,2.25,−1]T
(b)
A − 1 = [ − 0.1 0.1 0.2 − 0.95 1.45 0.4 0.6 − 0.6 − 0.2 ] A^{-1} = \begin{bmatrix} -0.1 & 0.1 & 0.2 \\ -0.95 & 1.45 & 0.4 \\ 0.6 & -0.6 & -0.2 \end{bmatrix} A−1= ​−0.1−0.950.6​0.11.45−0.6​0.20.4−0.2​ ​

©
det ⁡ ( A ) = det ⁡ ( U ) = − 20 \det(A)=\det(U)=-20 det(A)=det(U)=−20

Logo

码道开发者社区,聚焦华为云码道 CodeArts 代码智能体,沉淀 Agent、Skill、鸿蒙开发实战内容,供开发者查阅资料、交流技术、分享工程实践

更多推荐