1. 二维向量

在二维平面中,一个二维向量可以用一个箭头来表示,这个箭头起始于原点,终点坐标 ( x , y ) (x, y) (x,y) 分别为向量中的两个元素,而 c v c\boldsymbol{v} cv d w d\boldsymbol{w} dw 的和则是向量 v \boldsymbol{v} v w \boldsymbol{w} w的线性组合。

2. 三维向量

三维向量和二维向量类似,可以表示为三维平面中的一个箭头,只不过坐标变成了 ( x , y , z ) (x, y, z) (x,y,z)

针对三维向量 u \boldsymbol{u} u v \boldsymbol{v} v w \boldsymbol{w} w,有

  • 所有 c u c\boldsymbol{u} cu 的组合会填满一条直线
  • 所有 c u + d v c\boldsymbol{u} + d\boldsymbol{v} cu+dv 的组合会填满一个平面,如果 u \boldsymbol{u} u v \boldsymbol{v} v 不在一条直线上
  • 所有 c u + d v + e w c\boldsymbol{u} + d\boldsymbol{v} + e\boldsymbol{w} cu+dv+ew 的组合会填满三维空间,如果 w \boldsymbol{w} w 不在 u \boldsymbol{u} u v \boldsymbol{v} v 组合成的平面上

3. 长度和点积

两个向量 v = ( v 1 , v 2 ) \boldsymbol v=(v_1, v_2) v=(v1,v2) w = ( w 1 , w 2 ) \boldsymbol w=(w_1, w_2) w=(w1,w2) 的点积或者内积 v w \boldsymbol{v \cdot w} vw 定义为:

v w = v 1 w 1 + v 2 w 2 \boldsymbol{v \cdot w} = v_1w_1 + v_2w_2 vw=v1w1+v2w2

如果两个的向量的点积为零,说明这两个向量是垂直的,它们之间的角度为 90°。

另一个重要的情况是一个向量和自己点积,这时候点积的结果就是向量长度的平方,或者说向量的长度就等于与自身点积的平方根。

L e n g t h = n o r m ( v ) = v = v v \boldsymbol{Length}=norm(v)=||v||=\sqrt{v\cdot v} Length=norm(v)=v=vv

单位向量就是向量长度为 1 的向量,也就是 u u = 1 \boldsymbol{u \cdot u}=1 uu=1 u = v / v \boldsymbol{u}=v/||v|| u=v/v 是一个和 v \boldsymbol{v} v 在一个方向上的单位向量。

沿着 x x x 轴和 y y y 轴 的单位向量称为 i \boldsymbol{i} i j \boldsymbol{j} j,在 x y xy xy 平面中,单位向量 u \boldsymbol{u} u x x x 轴构成一个夹角 θ \theta θ

i = [ <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> ] j = [ <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> ] u = [ <mstyle displaystyle="false" scriptlevel="0"> c o s θ </mstyle> <mstyle displaystyle="false" scriptlevel="0"> s i n θ </mstyle> ] \boldsymbol{i} = \begin{bmatrix}1 \\ 0\end{bmatrix},\boldsymbol{j} = \begin{bmatrix}0 \\ 1\end{bmatrix},\boldsymbol{u} = \begin{bmatrix}cos\theta \\ sin\theta\end{bmatrix} i=[10]j=[01]u=[cosθsinθ]

当两个向量之间的角度小于 90° 时,它们的点积大于 0;当两个向量之间的角度大于 90° 时,它们的点积小于 0;而当两个向量之间的角度等于 90° 时,它们的点积等于 0。

我们可以直观地看到这种情况,当这两个向量分别为单位向量 u = ( c o s θ , s i n θ ) \boldsymbol u=(cos\theta, sin\theta) u=(cosθ,sinθ) i = ( 1 , 0 ) \boldsymbol i=(1, 0) i=(1,0) 时,这时候 u i = c o s θ \boldsymbol{u \cdot i}=cos\theta ui=cosθ θ \theta θ 也就是这两个向量之间的角度。

当这两个向量分别旋转到 u = ( c o s β , s i n β ) \boldsymbol u=(cos\beta, sin\beta) u=(cosβ,sinβ) i = ( c o s α , s i n α ) \boldsymbol i=(cos\alpha, sin\alpha) i=(cosα,sinα) 时,它们的点积为:

u i = c o s β c o s α + s i n β s i n α = c o s ( β α ) = c o s θ \boldsymbol{u \cdot i} = cos\beta cos\alpha + sin\beta sin\alpha = cos(\beta-\alpha) = cos\theta ui=cosβcosα+sinβsinα=cos(βα)=cosθ

当两个向量不是单位向量的时候,我们就可以先除以向量的长度把它们变成单位向量,因此,同样地,就有:

v w v <mtext>   </mtext> w = c o s θ \frac{\boldsymbol{v \cdot w}}{||v|| \space ||w||} = cos\theta v wvw=cosθ

因为 c o s θ |cos\theta| cosθ不会超过 1,因此我们就得到了 施瓦茨不等式(Schwarz Inequality)三角不等式(Triangle inequality)

v w v <mtext>   </mtext> w |\boldsymbol{v \cdot w}| \leqslant ||v||\space ||w|| vwv w
v + w v + w ||\boldsymbol{v + w}|| \leqslant ||v|| + ||w|| v+wv+w

4. 矩阵

给出三个向量

u = [ <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> ] v = [ <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> ] w = [ <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> ] \boldsymbol{u} = \begin{bmatrix}1 \\ -1 \\ 0 \end{bmatrix},\boldsymbol{v} = \begin{bmatrix}0 \\ 1\\ -1 \end{bmatrix},\boldsymbol{w} = \begin{bmatrix}0\\ 0\\1 \end{bmatrix} u=110v=011w=001

它们的线性组合 c u + d v + e w c\boldsymbol{u} + d\boldsymbol{v} + e\boldsymbol{w} cu+dv+ew 为:

c [ <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> ] + d [ <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> ] + e [ <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> ] = [ <mstyle displaystyle="false" scriptlevel="0"> c </mstyle> <mstyle displaystyle="false" scriptlevel="0"> d c </mstyle> <mstyle displaystyle="false" scriptlevel="0"> e d </mstyle> ] c\begin{bmatrix}1 \\ -1 \\ 0 \end{bmatrix}+d\begin{bmatrix}0 \\ 1\\ -1 \end{bmatrix}+e\begin{bmatrix}0\\ 0\\1 \end{bmatrix} = \begin{bmatrix}c \\ d-c \\ e-d \end{bmatrix} c110+d011+e001=cdced

我们将 u v w \boldsymbol{u},\boldsymbol{v},\boldsymbol{w} uvw 作为矩阵 A A A 的列,然后上式可以重写为:

[ <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> ] [ <mstyle displaystyle="false" scriptlevel="0"> c </mstyle> <mstyle displaystyle="false" scriptlevel="0"> d </mstyle> <mstyle displaystyle="false" scriptlevel="0"> e </mstyle> ] = [ <mstyle displaystyle="false" scriptlevel="0"> c </mstyle> <mstyle displaystyle="false" scriptlevel="0"> d c </mstyle> <mstyle displaystyle="false" scriptlevel="0"> e d </mstyle> ] \begin{bmatrix}1 &amp; 0 &amp; 0\\ -1 &amp;1&amp;0\\ 0&amp;-1&amp;1 \end{bmatrix}\begin{bmatrix}c \\ d \\ e \end{bmatrix} = \begin{bmatrix}c \\ d-c \\ e-d \end{bmatrix} 110011001cde=cdced

c , d , e c, d, e c,d,e 换成 x 1 , x 2 , x 3 x_1, x_2, x_3 x1,x2,x3,我们可以得到:

A x = [ <mstyle displaystyle="false" scriptlevel="0"> </mstyle> <mstyle displaystyle="false" scriptlevel="0"> </mstyle> <mstyle displaystyle="false" scriptlevel="0"> </mstyle> <mstyle displaystyle="false" scriptlevel="0"> u </mstyle> <mstyle displaystyle="false" scriptlevel="0"> v </mstyle> <mstyle displaystyle="false" scriptlevel="0"> w </mstyle> <mstyle displaystyle="false" scriptlevel="0"> </mstyle> <mstyle displaystyle="false" scriptlevel="0"> </mstyle> <mstyle displaystyle="false" scriptlevel="0"> </mstyle> ] [ <mstyle displaystyle="false" scriptlevel="0"> x 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> x 2 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> x 3 </mstyle> ] = x 1 u + x 2 v + x 3 w = [ <mstyle displaystyle="false" scriptlevel="0"> x 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> x 2 x 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> x 3 x 2 </mstyle> ] Ax = \begin{bmatrix} &amp; &amp; \\ \boldsymbol{u} &amp;\boldsymbol{v}&amp;\boldsymbol{w}\\ &amp;&amp; \end{bmatrix}\begin{bmatrix}x_1 \\ x_2 \\ x_3 \end{bmatrix} =x_1\boldsymbol{u} + x_2\boldsymbol{v} + x_3\boldsymbol{w} = \begin{bmatrix}x_1 \\ x_2-x_1 \\ x_3-x_2\end{bmatrix} Ax=uvwx1x2x3=x1u+x2v+x3w=x1x2x1x3x2

这就是说, A x Ax Ax 的结果就是对矩阵 A A A 的列的线性组合

我们还可以将上面的乘积表示成另外一种形式,矩阵的行和向量的点积:

A x = [ <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 0 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> 1 </mstyle> ] [ <mstyle displaystyle="false" scriptlevel="0"> x 1 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> x 2 </mstyle> <mstyle displaystyle="false" scriptlevel="0"> x 3 </mstyle> ] = [ <mstyle displaystyle="false" scriptlevel="0"> ( 1 , 0 , 0 ) ( x 1 , x 2 , x 3 ) </mstyle> <mstyle displaystyle="false" scriptlevel="0"> ( 1 , 1 , 0 ) ( x 1 , x 2 , x 3 ) </mstyle> <mstyle displaystyle="false" scriptlevel="0"> ( 0 , 1 , 1 ) ( x 1 , x 2 , x 3 ) </mstyle> ] Ax=\begin{bmatrix}1 &amp; 0 &amp; 0\\ -1 &amp;1&amp;0\\ 0&amp;-1&amp;1 \end{bmatrix}\begin{bmatrix}x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix}(1, 0, 0) \cdot (x_1, x_2, x_3)\\ (-1, 1, 0) \cdot (x_1, x_2, x_3) \\ (0, -1, 1) \cdot (x_1, x_2, x_3) \end{bmatrix} Ax=110011001x1x2x3=(1,0,0)(x1,x2,x3)(1,1,0)(x1,x2,x3)(0,1,1)(x1,x2,x3)

获取更多精彩,请关注「seniusen」!