参考:Introduction to Applied Linear Algebra – Vectors, Matrices, and Least Squares
Stephen Boyd and Lieven Vandenberghe
Website: https://web.stanford.edu/~boyd/vmls/
基底展开(Expansion in a Basis):概念、推导与应用
1. 基本概念
在线性代数中,“基底展开”指的是用一组线性无关的向量基底来表示一个向量。在一个线性空间中,基底是描述空间中任意向量的基本单位。给定一组基底,空间中的任何向量都可以唯一地表示为这些基底的线性组合。
设 ( A = [ a 1 , a 2 , … , a n ] A = [\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n] A=[a1,a2,…,an] ) 是一个 ( n × n n \times n n×n ) 的方阵,其中每一列 ( a i \mathbf{a}_i ai ) 是 ( R n \mathbb{R}^n Rn ) 中的一个向量,并且它们线性无关。这意味着 ( A A A ) 的列向量构成了 ( R n \mathbb{R}^n Rn ) 的一个基底。对于任意一个向量 ( b ∈ R n \mathbf{b} \in \mathbb{R}^n b∈Rn ),存在唯一的向量 ( x ∈ R n \mathbf{x} \in \mathbb{R}^n x∈Rn ),使得:
A x = b . A \mathbf{x} = \mathbf{b}. Ax=b.
在这个公式中,向量 ( x = [ x 1 , x 2 , … , x n ] T \mathbf{x} = [x_1, x_2, \dots, x_n]^T x=[x1,x2,…,xn]T ) 表示 ( b \mathbf{b} b ) 在基底 ( { a 1 , a 2 , … , a n } \{\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n\} {a1,a2,…,an} ) 下的系数(或坐标)。
2. 推导过程
(1)线性组合的定义
假设向量 ( b \mathbf{b} b ) 可以由基底 ( { a 1 , a 2 , … , a n } \{\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n\} {a1,a2,…,an} ) 表示为线性组合:
b = x 1 a 1 + x 2 a 2 + ⋯ + x n a n , \mathbf{b} = x_1 \mathbf{a}_1 + x_2 \mathbf{a}_2 + \cdots + x_n \mathbf{a}_n, b=x1a1+x2a2+⋯+xnan,
其中 ( x 1 , x 2 , … , x n x_1, x_2, \dots, x_n x1,x2,…,xn ) 是待求的系数。
可以用矩阵表示这个关系:
A x = b , A \mathbf{x} = \mathbf{b}, Ax=b,
其中:
- ( A = [ a 1 , a 2 , … , a n ] A = [\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n] A=[a1,a2,…,an] ) 是一个 ( n × n n \times n n×n ) 的基底矩阵;
- ( x = [ x 1 , x 2 , … , x n ] T \mathbf{x} = [x_1, x_2, \dots, x_n]^T x=[x1,x2,…,xn]T ) 是系数向量;
- ( b \mathbf{b} b ) 是目标向量。
(2)唯一解的存在性
由于 ( a 1 , a 2 , … , a n \mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n a1,a2,…,an ) 是线性无关的,矩阵 ( A A A ) 的列向量构成一个基底,因此 ( A A A ) 是可逆矩阵。对方程 ( A x = b A \mathbf{x} = \mathbf{b} Ax=b ):
x = A − 1 b . \mathbf{x} = A^{-1} \mathbf{b}. x=A−1b.
这说明对于任意给定的 ( b \mathbf{b} b ),都存在唯一的系数向量 ( x \mathbf{x} x ) 使得 ( A x = b A \mathbf{x} = \mathbf{b} Ax=b )。
(3)几何意义
系数向量 ( x \mathbf{x} x ) 给出了 ( b \mathbf{b} b ) 在基底 ( { a 1 , a 2 , … , a n } \{\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n\} {a1,a2,…,an} ) 下的坐标,即 ( b \mathbf{b} b) 在该基底中的“展开”。
3. 示例
示例 1:二维空间的基底展开
假设二维空间中的基底为:
a 1 = [ 1 0 ] , a 2 = [ 1 1 ] . \mathbf{a}_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad \mathbf{a}_2 = \begin{bmatrix} 1 \\ 1 \end{bmatrix}. a1=[10],a2=[11].
基底矩阵为:
A = [ 1 1 0 1 ] . A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}. A=[1011].
目标向量为:
b = [ 3 2 ] . \mathbf{b} = \begin{bmatrix} 3 \\ 2 \end{bmatrix}. b=[32].
我们希望找到 ( x = [ x 1 x 2 ] \mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} x=[x1x2] ),使得:
A x = b . A \mathbf{x} = \mathbf{b}. Ax=b.
即:
[ 1 1 0 1 ] [ x 1 x 2 ] = [ 3 2 ] . \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 3 \\ 2 \end{bmatrix}. [1011][x1x2]=[32].
解方程:
- 展开为:
{ x 1 + x 2 = 3 , x 2 = 2. \begin{cases} x_1 + x_2 = 3, \\ x_2 = 2. \end{cases} {x1+x2=3,x2=2. - 解得:
x 1 = 1 , x 2 = 2. x_1 = 1, \quad x_2 = 2. x1=1,x2=2.
因此,向量 ( b \mathbf{b} b ) 的基底展开为:
b = 1 ⋅ a 1 + 2 ⋅ a 2 . \mathbf{b} = 1 \cdot \mathbf{a}_1 + 2 \cdot \mathbf{a}_2. b=1⋅a1+2⋅a2.
示例 2:编程实现
用 Python 实现上述计算:
import numpy as np# 定义基底矩阵 A 和目标向量 b
A = np.array([[1, 1], [0, 1]])
b = np.array([3, 2])# 求解 x
x = np.linalg.solve(A, b)print("The coefficients vector x is:", x)
输出:
The coefficients vector x is: [1. 2.]
4. 应用场景
基底展开在数学、物理、工程和计算机科学中都有广泛的应用。以下是一些常见的场景:
(1)计算机图形学
在图形变换中,通常需要将点的坐标从一个基底转换到另一个基底。例如,将世界坐标系中的点转换到相机坐标系。
(2)数据科学和机器学习
在主成分分析(PCA)中,数据向量被投影到一组正交基上,这些基是数据协方差矩阵的特征向量。
(3)量子力学
量子态通常表示为某个基底下的展开。例如,一个量子态可以用希尔伯特空间中的基向量展开。
(4)信号处理
在傅里叶分析中,信号被展开为一组正交基(傅里叶基)的线性组合,用于频率分析。
5. 总结
基底展开是线性代数中的一个重要概念,它提供了一种用基底来唯一表示向量的方法。通过基底展开,可以将复杂的向量操作简化为基底下的系数运算。在实际应用中,基底展开不仅具有深刻的理论意义,还在科学计算、机器学习、物理建模等领域发挥了重要作用。
在编程中,可以利用数值计算工具(如 Python 的 NumPy 或 MATLAB)快速实现基底展开的相关计算,方便解决实际问题。
英文版
Expansion in a Basis: Concept, Derivation, and Applications
1. Concept
In linear algebra, expansion in a basis refers to expressing a vector in a vector space as a linear combination of a set of basis vectors. A basis is a set of linearly independent vectors that span the entire vector space. With respect to a given basis, any vector in the space can be uniquely represented as a weighted sum of the basis vectors.
Let ( A = [ a 1 , a 2 , … , a n ] A = [\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n] A=[a1,a2,…,an] ) be an ( n × n n \times n n×n ) square matrix whose columns ( a 1 , a 2 , … , a n \mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n a1,a2,…,an ) are linearly independent and form a basis of ( R n \mathbb{R}^n Rn ). For any vector ( b ∈ R n \mathbf{b} \in \mathbb{R}^n b∈Rn ), there exists a unique vector ( x ∈ R n \mathbf{x} \in \mathbb{R}^n x∈Rn ) such that:
A x = b . A \mathbf{x} = \mathbf{b}. Ax=b.
Here, the vector ( x \mathbf{x} x ) contains the coefficients of ( b \mathbf{b} b ) when expanded in the basis ( { a 1 , a 2 , … , a n } \{\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n\} {a1,a2,…,an} ).
2. Derivation
(1) Linear Combination
If a vector ( b \mathbf{b} b ) can be expressed as a linear combination of the basis vectors ( { a 1 , a 2 , … , a n } \{\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n\} {a1,a2,…,an} ), then:
b = x 1 a 1 + x 2 a 2 + ⋯ + x n a n , \mathbf{b} = x_1 \mathbf{a}_1 + x_2 \mathbf{a}_2 + \cdots + x_n \mathbf{a}_n, b=x1a1+x2a2+⋯+xnan,
where ( x 1 , x 2 , … , x n x_1, x_2, \dots, x_n x1,x2,…,xn ) are the coefficients to be determined.
This can be rewritten in matrix form as:
A x = b , A \mathbf{x} = \mathbf{b}, Ax=b,
where:
- ( A = [ a 1 , a 2 , … , a n ] A = [\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n] A=[a1,a2,…,an] ) is the basis matrix,
- ( x = [ x 1 , x 2 , … , x n ] T \mathbf{x} = [x_1, x_2, \dots, x_n]^T x=[x1,x2,…,xn]T ) is the coefficient vector,
- ( b \mathbf{b} b ) is the target vector.
(2) Existence and Uniqueness
Since the columns of ( A A A ) are linearly independent, the matrix ( A A A ) is invertible. Thus, for any ( b \mathbf{b} b ), the equation ( A x = b A \mathbf{x} = \mathbf{b} Ax=b ) has a unique solution:
x = A − 1 b . \mathbf{x} = A^{-1} \mathbf{b}. x=A−1b.
(3) Geometric Interpretation
The vector ( x \mathbf{x} x ) represents the coordinates of ( b \mathbf{b} b ) in the basis ( { a 1 , a 2 , … , a n } \{\mathbf{a}_1, \mathbf{a}_2, \dots, \mathbf{a}_n\} {a1,a2,…,an} ). In other words, ( x \mathbf{x} x ) gives the unique decomposition of ( b \mathbf{b} b ) in terms of the basis vectors.
3. Examples
Example 1: Basis Expansion in 2D
Let’s consider a 2D space with the basis:
a 1 = [ 1 0 ] , a 2 = [ 1 1 ] . \mathbf{a}_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad \mathbf{a}_2 = \begin{bmatrix} 1 \\ 1 \end{bmatrix}. a1=[10],a2=[11].
The basis matrix is:
A = [ 1 1 0 1 ] . A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}. A=[1011].
Suppose the target vector is:
b = [ 3 2 ] . \mathbf{b} = \begin{bmatrix} 3 \\ 2 \end{bmatrix}. b=[32].
We want to find ( x = [ x 1 x 2 ] \mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} x=[x1x2] ) such that:
A x = b . A \mathbf{x} = \mathbf{b}. Ax=b.
Solving:
- Expand the equation:
[ 1 1 0 1 ] [ x 1 x 2 ] = [ 3 2 ] . \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} 3 \\ 2 \end{bmatrix}. [1011][x1x2]=[32].
This gives:
{ x 1 + x 2 = 3 , x 2 = 2. \begin{cases} x_1 + x_2 = 3, \\ x_2 = 2. \end{cases} {x1+x2=3,x2=2. - Solve for ( x 1 x_1 x1 ) and ( x 2 x_2 x2 ):
x 2 = 2 , x 1 = 1. x_2 = 2, \quad x_1 = 1. x2=2,x1=1.
Thus, the vector ( b \mathbf{b} b ) can be written as:
b = 1 ⋅ a 1 + 2 ⋅ a 2 . \mathbf{b} = 1 \cdot \mathbf{a}_1 + 2 \cdot \mathbf{a}_2. b=1⋅a1+2⋅a2.
Example 2: Python Implementation
Here’s how to compute the basis expansion in Python:
import numpy as np# Define the basis matrix A and the target vector b
A = np.array([[1, 1], [0, 1]])
b = np.array([3, 2])# Solve for x
x = np.linalg.solve(A, b)print("The coefficients vector x is:", x)
Output:
The coefficients vector x is: [1. 2.]
4. Applications
(1) Computer Graphics
In computer graphics, basis expansion is used to transform points between coordinate systems, such as converting world coordinates to camera coordinates.
(2) Data Science and Machine Learning
In Principal Component Analysis (PCA), data vectors are projected onto a set of orthogonal basis vectors (principal components) to reduce dimensionality while preserving variance.
(3) Quantum Mechanics
In quantum mechanics, quantum states are represented as linear combinations of basis vectors in a Hilbert space.
(4) Signal Processing
In Fourier analysis, signals are expressed as sums of sinusoidal basis functions, allowing analysis in the frequency domain.
5. Summary
Expansion in a basis is a fundamental concept in linear algebra that allows any vector to be expressed uniquely in terms of a given set of basis vectors. This concept has profound implications in mathematics, physics, engineering, and computer science.
The process of expanding a vector in a basis involves solving a system of linear equations, which can be efficiently computed using numerical tools like Python’s numpy
or MATLAB. Understanding this concept enables us to work more effectively with vector spaces and their applications in a wide range of fields.
后记
2024年12月20日14点34分于上海, 在GPT4o大模型辅助下完成。