內積與外積是怎麼來的?

本文的閱讀等級:初級

在歐幾里得空間 \mathbb{R}^3,兩個向量的內積與外積是怎麼來的?從決定論 (determinism) 的觀點,內積與外積之所以如此定義,可以用先前的數學發展和事態來解釋。愛爾蘭數學家哈密頓 (William Rowan Hamilton) 於1843年提出四元數 (quaternion) 的概念。一個四元數是一個實數加上三個虛部 (見“四元數”),記為 q=a+bi+cj+dk,其中 a,b,c,d 是實數,虛數單位 i,j,k 滿足基本公式 i^2=j^2=k^2=ijk=-1。1878年,英國數學家克利福德 (William Kingdon Clifford)[1] 出版 Elements of Dynamic,書中首次用純量積 (scalar product) 與向量積 (vector product) 表示兩個四元數的積。今天,我們習慣稱純量積為點積 (dot product) 或內積 (inner product),向量積則稱為外積或叉積 (cross product)。令 \mathbf{i}=(1,0,0)\mathbf{j}=(0,1,0)\mathbf{k}=(0,0,1)\mathbb{R}^3 的標準單位向量。一個四元數可用純量─向量和表示為 q=a+\mathbf{v},其中 a\in\mathbb{R}\mathbf{v}=b\mathbf{i}+c\mathbf{j}+d\mathbf{k}\in\mathbb{R}^3,並滿足單位向量乘法規則 \mathbf{i}^2=\mathbf{j}^2=\mathbf{k}^2=\mathbf{i}\mathbf{j}\mathbf{k}=-1。給定兩個四元數 q_1=a_1+\mathbf{v}_1q_2=a_2+\mathbf{v}_2,乘法運算結果如下 (見“四元數與三維空間旋轉”):

q_1q_2=(a_1+\mathbf{v}_1)(a_2+\mathbf{v}_2)=(a_1a_2-\mathbf{v}_1\cdot\mathbf{v}_2)+(a_1\mathbf{v}_2+a_2\mathbf{v}_1+\mathbf{v}_1\times\mathbf{v}_2)

其中 \mathbf{v}_1\cdot\mathbf{v}_2 為內積,\mathbf{v}_1\times\mathbf{v}_2 為外積。克利福德英年早逝,不及推廣他的內積與外積運算。1901年,美國物理學家吉布斯 (Josiah Willard Gibbs)[2] 的學生將他的課堂講義整理成書,名為《向量分析 (Vector Analysis)》。這本影響深遠的教科書不僅制定內積與外積符號並建立代數運算規則,從而推廣內積與外積至物理學與幾何學 (事實上,自1881年,吉布斯的講義即已廣泛流傳於歐美學界)。從目的論 (teleology) 的觀點,內積與外積之所以如現在這般,可以用它們的最終目的來解釋。不過,即便內積與外積在物理學與幾何學有廣泛的應用,但它們並不具備某個大眾認同的特定最終目的。撇開決定論與目的論,純粹從學習探索的角度,為尋思內積與外積的由來,本文通過設計滿足某些數學性質的函數來推導內積與外積的操作型定義。

 
考慮 \mathbb{R}^3 的兩個向量 \mathbf{x}\mathbf{y},與純量 c\in\mathbb{R}。向量有加法運算 \mathbf{x}+\mathbf{y},以及純量乘法運算 c\mathbf{x}。設想我們定義一個函數 f(\mathbf{x},\mathbf{y}) 傳回一純量 (實數)。我們對於 f 的實際作為沒有特定的想法,不妨引入一些美好的數學性質以便確立它的計算式。第一個性質是 f 具備對稱性,f(\mathbf{x},\mathbf{y})=f(\mathbf{y},\mathbf{x})。此外,當固定一個向量時,我們希望 f 是另一個向量的線性函數。具體地說,對於 \mathbf{x}_1,\mathbf{x}_2,\mathbf{y}_1,\mathbf{y}_2\in\mathbb{R}^3,與 c\in\mathbb{R}

\begin{aligned} f(\mathbf{x}_1+\mathbf{x}_2,\mathbf{y})&=f(\mathbf{x}_1,\mathbf{y})+f(\mathbf{x}_2,\mathbf{y})\\ f(\mathbf{x},\mathbf{y}_1+\mathbf{y}_2)&=f(\mathbf{x},\mathbf{y}_1)+f(\mathbf{x},\mathbf{y}_2)\\ f(c\mathbf{x},\mathbf{y})&=cf(\mathbf{x},\mathbf{y})\\ f(\mathbf{x},c\mathbf{y})&=cf(\mathbf{x},\mathbf{y}). \end{aligned}

滿足上述性質的 f 稱為雙線性形式 (bilinear form)。使用最末兩個性質,

f(c\mathbf{x},c\mathbf{x})=cf(\mathbf{x},c\mathbf{x})=c^2f(\mathbf{x},\mathbf{x})

也就是說,伸縮 \mathbf{x} 的長度 c 倍,f(\mathbf{x},\mathbf{x}) 的值將伸縮 c^2 倍,而且當 c=0f(\mathbf{0},\mathbf{0})=0。這個結果提示我們 f(\mathbf{x},\mathbf{x}) 符合 \mathbf{x} 的長度平方的度量,不妨大膽地令 f(\mathbf{x},\mathbf{x})=\Vert\mathbf{x}\Vert^2,其中 \Vert\cdot\Vert 表示向量長 (稍後即可驗證)。使用對稱性與雙線性,

\begin{aligned} \Vert\mathbf{x}+\mathbf{y}\Vert^2&=f(\mathbf{x}+\mathbf{y},\mathbf{x}+\mathbf{y})\\ &=f(\mathbf{x},\mathbf{x}+\mathbf{y})+f(\mathbf{y},\mathbf{x}+\mathbf{y})\\ &=f(\mathbf{x},\mathbf{x})+f(\mathbf{x},\mathbf{y})+f(\mathbf{y},\mathbf{x})+f(\mathbf{y},\mathbf{y})\\ &=\Vert\mathbf{x}\Vert^2+2f(\mathbf{x},\mathbf{y})+\Vert\mathbf{y}\Vert^2.\end{aligned}

剩下的工作是寫出 f(\mathbf{x},\mathbf{y}) 的簡明表達式。因為 \mathbf{x},\mathbf{y},\mathbf{x}+\mathbf{y} 構成三角形的三個邊 (見下圖),餘弦定理給出

\begin{aligned} \Vert\mathbf{x}+\mathbf{y}\Vert^2&=\Vert\mathbf{x}\Vert^2+\Vert\mathbf{y}\Vert^2-2\Vert\mathbf{x}\Vert\Vert\mathbf{y}\Vert\cos(\pi-\theta)\\ &=\Vert\mathbf{x}\Vert^2+\Vert\mathbf{y}\Vert^2+2\Vert\mathbf{x}\Vert\Vert\mathbf{y}\Vert\cos\theta,\end{aligned}

其中 \theta (0\le\theta\le\pi) 是 \mathbf{x}\mathbf{y} 的夾角。比較上面兩式,可得

f(\mathbf{x},\mathbf{y})=\Vert\mathbf{x}\Vert\Vert\mathbf{y}\Vert\cos\theta

另一方面,設座標向量 \mathbf{x}=(x_1,x_2,x_3)\mathbf{y}=(y_1,y_2,y_3),套用歐幾里得距離公式,

\displaystyle \begin{aligned} f(\mathbf{x},\mathbf{y})&=\frac{1}{2}\left(\Vert\mathbf{x}+\mathbf{y}\Vert^2-\Vert\mathbf{x}\Vert^2-\Vert\mathbf{y}\Vert^2\right)\\ &=\frac{1}{2}\left((x_1+y_1)^2+(x_2+y_2)^2+(x_3+y_3)^2-(x_1^2+x_2^2+x_3^2)-(y_1^2+y_2^2+y_3^2)\right)\\ &=x_1y_1+x_2y_2+x_3y_3. \end{aligned}

為便於識別,我們將 f(\mathbf{x},\mathbf{y}) 替換為下列運算符號,稱為內積:

\mathbf{x}\cdot\mathbf{y}=x_1y_1+x_2y_2+x_3y_3

明顯地,\mathbf{x}\cdot\mathbf{x}=x_1^2+x_2^2+x_3^2 即為 \mathbf{x} 的長度平方。注意,\mathbf{x}\cdot\mathbf{y}=0 等價於 \Vert\mathbf{x}+\mathbf{y}\Vert^2=\Vert\mathbf{x}\Vert^2+\Vert\mathbf{y}\Vert^2,此即畢氏定理,故知 \mathbf{x} 垂直於 \mathbf{y}。除了上面的作法,從兩向量夾角的餘弦亦可推得內積公式,詳見“內積的定義”。

cosine rule

餘弦定理

 
接著推導外積公式。考慮 \mathbb{R}^3 的三個向量 \mathbf{x},\mathbf{y}\mathbf{z} 交於原點且為平行六面體的三個邊。假設我們想要構造一個函數 g(\mathbf{x},\mathbf{y},\mathbf{z}) 傳回此平行六面體的 (有號) 體積。令標準單位向量 \mathbf{e}_1=(1,0,0)\mathbf{e}_2=(0,1,0)\mathbf{e}_3=(0,0,1)。基礎幾何學給出下面三個性質:

  1. 三個標準單位向量構成單位正立方體,故 g(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3)=1
  2. 若兩向量相同,平行六面體退化為平行四邊形,則體積為零,故 g(\mathbf{x},\mathbf{x},\mathbf{z})=g(\mathbf{x},\mathbf{y},\mathbf{y})=g(\mathbf{z},\mathbf{y},\mathbf{z})=0
  3. 在固定兩個向量的情況下,伸縮一個向量的長度,平行六面體體積等比例改變,且分解一個向量為兩個向量之和,平行六面體體積等於兩個平行六面體體積之和 (參閱“行列式的運算公式與性質”的圖示)。精確地說,g 是多重線性 (multilinear) 函數,即當固定兩個向量時,g 是另一個向量的線性函數。對於 \mathbf{x}_1,\mathbf{x}_2,\mathbf{y}_1,\mathbf{y}_2,\mathbf{z}_1,\mathbf{z}_2\in\mathbb{R}^3,與 c\in\mathbb{R}

    \begin{aligned} g(\mathbf{x}_1+\mathbf{x}_2,\mathbf{y},\mathbf{z})&=g(\mathbf{x}_1,\mathbf{y},\mathbf{z})+g(\mathbf{x}_2,\mathbf{y},\mathbf{z})\\ g(\mathbf{x},\mathbf{y}_1+\mathbf{y}_2,\mathbf{z})&=g(\mathbf{x},\mathbf{y}_1,\mathbf{z})+g(\mathbf{x},\mathbf{y}_2,\mathbf{z})\\ g(\mathbf{x},\mathbf{y},\mathbf{z}_1+\mathbf{z}_2)&=g(\mathbf{x},\mathbf{y},\mathbf{z}_1)+g(\mathbf{x},\mathbf{y},\mathbf{z}_2)\\ g(c\mathbf{x},\mathbf{y},\mathbf{z})&=cg(\mathbf{x},\mathbf{y},\mathbf{z})\\ g(\mathbf{x},c\mathbf{y},\mathbf{z})&=cg(\mathbf{x},\mathbf{y},\mathbf{z})\\ g(\mathbf{x},\mathbf{y},c\mathbf{z})&=cg(\mathbf{x},\mathbf{y},\mathbf{z}). \end{aligned}

如果置換 \mathbf{x}\mathbf{y},使用性質2和3,

\begin{aligned} g(\mathbf{y},\mathbf{x},\mathbf{z})&=g(\mathbf{x},\mathbf{x},\mathbf{z})+g(\mathbf{y},\mathbf{x},\mathbf{z})\\ &=g(\mathbf{x}+\mathbf{y},\mathbf{x},\mathbf{z})\\ &=g(\mathbf{x}+\mathbf{y},\mathbf{x},\mathbf{z})-g(\mathbf{x}+\mathbf{y},\mathbf{x}+\mathbf{y},\mathbf{z})\\ &=g(\mathbf{x}+\mathbf{y},-\mathbf{y},\mathbf{z})\\ &=-g(\mathbf{x}+\mathbf{y},\mathbf{y},\mathbf{z})\\ &=-g(\mathbf{x},\mathbf{y},\mathbf{z})-g(\mathbf{y},\mathbf{y},\mathbf{z})\\ &=-g(\mathbf{x},\mathbf{y},\mathbf{z}).\end{aligned}

同樣道理,置換任兩個向量將改變 g(\mathbf{x},\mathbf{y},\mathbf{z}) 的正負號,以下稱之為性質4。

 
我們利用上述四個性質推演 g 的表達式。設座標向量 \mathbf{x}=(x_1,x_2,x_3)\mathbf{y}=(y_1,y_2,y_3)\mathbf{z}=(z_1,z_2,z_3)。將 \mathbf{x}=\sum_{i=1}^3x_i\mathbf{e}_i 代入 g(\mathbf{x},\mathbf{y},\mathbf{z}),使用性質3,

\begin{aligned} g(\mathbf{x},\mathbf{y},\mathbf{z})&=g\left(\sum_{i=1}^3x_i\mathbf{e}_i,\mathbf{y},\mathbf{z}\right)\\ &=\sum_{i=1}^3g(x_i\mathbf{e}_i,\mathbf{y},\mathbf{z})\\ &=\sum_{i=1}^3x_i\,g(\mathbf{e}_i,\mathbf{y},\mathbf{z}). \end{aligned}

接著代入 \mathbf{y}=\sum_{j=1}^3y_j\mathbf{e}_j\mathbf{z}=\sum_{k=1}^3z_k\mathbf{e}_k,可得

\begin{aligned} g(\mathbf{x},\mathbf{y},\mathbf{z})&=\sum_{i=1}^3x_i\,g(\mathbf{e}_i,\mathbf{y},\mathbf{z})\\ &=\sum_{i=1}^3\sum_{j=1}^3x_iy_j\,g(\mathbf{e}_i,\mathbf{e}_j,\mathbf{z})\\ &=\sum_{i=1}^3\sum_{j=1}^3\sum_{k=1}^3 x_iy_jz_k\,g(\mathbf{e}_i,\mathbf{e}_j,\mathbf{e}_k). \end{aligned}

根據性質2,上式的 3^3=27g(\mathbf{e}_i,\mathbf{e}_j,\mathbf{e}_k) 僅有 6 個不為零 (指標 i,j,k 互異)。使用性質1和4,

\begin{aligned} g(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3)&=1\\ g(\mathbf{e}_1,\mathbf{e}_3,\mathbf{e}_2)&=-g(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3)=-1\\ g(\mathbf{e}_2,\mathbf{e}_3,\mathbf{e}_1)&=-g(\mathbf{e}_1,\mathbf{e}_3,\mathbf{e}_2)=1\\ g(\mathbf{e}_2,\mathbf{e}_1,\mathbf{e}_3)&=-g(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3)=-1\\ g(\mathbf{e}_3,\mathbf{e}_1,\mathbf{e}_2)&=-g(\mathbf{e}_1,\mathbf{e}_3,\mathbf{e}_2)=1\\ g(\mathbf{e}_3,\mathbf{e}_2,\mathbf{e}_1)&=-g(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3)=-1.\end{aligned}

合併以上結果,

\begin{aligned} g(\mathbf{x},\mathbf{y},\mathbf{z})&=x_1y_2z_3-x_1y_3z_2+x_2y_3z_1-x_2y_1z_3+x_3y_1z_2-x_3y_2z_1\\ &=(x_2y_3-x_3y_2)z_1+(x_3y_1-x_1y_3)z_2+(x_1y_2-x_2y_1)z_3\\&=\begin{vmatrix}x_2&x_3\\y_2&y_3\end{vmatrix}z_1+\begin{vmatrix}x_3&x_1\\y_3&y_1 \end{vmatrix}z_2+\begin{vmatrix} x_1&x_2\\y_1&y_2\end{vmatrix}z_3\\&=\begin{vmatrix}x_1&y_1&z_1\\x_2&y_2&z_2\\x_3&y_3&z_3\end{vmatrix}.\end{aligned}

最後一個等號源於行列式的餘因子公式 (見“行列式的運算公式與性質”)。出乎意料之外,g(\mathbf{x},\mathbf{y},\mathbf{z}) 就是 \mathbf{x},\mathbf{y},\mathbf{z} 組成的矩陣的行列式。觀察發現 g(\mathbf{x},\mathbf{y},\mathbf{z}) 可表示為兩個向量的內積。據此,令

g(\mathbf{x},\mathbf{y},\mathbf{z})=(\mathbf{x}\times\mathbf{y})\cdot\mathbf{z}

其中 \mathbf{x}\times\mathbf{y} 稱為外積,定義如下:

\mathbf{x}\times\mathbf{y}=\left(\begin{vmatrix}x_2&x_3\\y_2&y_3 \end{vmatrix}, \begin{vmatrix}x_3&x_1\\y_3&y_1 \end{vmatrix},\begin{vmatrix} x_1&x_2\\ y_1&y_2\end{vmatrix}\right)

 
透過外積與行列式的關係式很容易推得外積的代數法則,詳見“答張盛東──關於外積與行列式的關係”。因為 g(\mathbf{x},\mathbf{y},\mathbf{x})=0g(\mathbf{x},\mathbf{y},\mathbf{y})=0,即 (\mathbf{x}\times\mathbf{y})\cdot\mathbf{x}=0(\mathbf{x}\times\mathbf{y})\cdot\mathbf{y}=0,可知 \mathbf{x}\times\mathbf{y} 同時垂直於 \mathbf{x}\mathbf{y},換句話說,\mathbf{x}\times\mathbf{y}\mathbf{x}\mathbf{y} 所在的平面的法向量。若 \mathbf{x}\mathbf{y} 線性獨立 (非零向量且不共線),設單位法向量 \mathbf{n}=\mathbf{x}\times\mathbf{y}/\Vert\mathbf{x}\times\mathbf{y}\Vert,則 \mathbf{x}\mathbf{y} 所張的平行四邊形面積等於

\displaystyle g(\mathbf{x},\mathbf{y},\mathbf{n})=(\mathbf{x}\times\mathbf{y})\cdot\frac{\mathbf{x}\times\mathbf{y}}{\Vert\mathbf{x}\times\mathbf{y}\Vert}=\frac{\Vert\mathbf{x}\times\mathbf{y}\Vert^2}{\Vert\mathbf{x}\times\mathbf{y}\Vert}=\Vert\mathbf{x}\times\mathbf{y}\Vert

套用平行四邊形面積公式,\Vert\mathbf{x}\times\mathbf{y}\Vert=\Vert\mathbf{x}\Vert\Vert\mathbf{y}\Vert\sin\theta,其中 \theta\mathbf{x}\mathbf{y} 之間的夾角 (0\le\theta\le\pi)。以上結果給出外積的幾何定義:

\displaystyle \mathbf{x}\times\mathbf{y}=\Vert \mathbf{x}\Vert\Vert\mathbf{y}\Vert\sin\theta~\mathbf{n}

其中 \mathbf{n} 是垂直於 \mathbf{x}\mathbf{y} 所在平面並滿足右手定則的單位向量,這是因為我們默認採用右手座標系並在性質1設定 g(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3)=1。如果我們最初設 g(\mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3)=-1,則有左手定則。

 
既然 \mathbf{x}\times\mathbf{y} 的長度等於 \mathbf{x}\mathbf{y} 所張的平行四邊形面積,我們在推導外積之初何不設映射 h(\mathbf{x},\mathbf{y}) 傳回一個向量使得 \Vert h(\mathbf{x},\mathbf{y})\Vert=\Vert\mathbf{x}\Vert\Vert\mathbf{y}\Vert\sin\theta?上式等號兩邊平方,使用內積公式,

\begin{aligned} \Vert h(\mathbf{x},\mathbf{y})\Vert^2&=\Vert\mathbf{x}\Vert^2\Vert\mathbf{y}\Vert^2\sin^2\theta\\ &=\Vert\mathbf{x}\Vert^2\Vert\mathbf{y}\Vert^2(1-\cos^2\theta)\\ &=\Vert\mathbf{x}\Vert^2\Vert\mathbf{y}\Vert^2-\Vert\mathbf{x}\Vert^2\Vert\mathbf{y}\Vert^2\cos^2\theta\\ &=\Vert\mathbf{x}\Vert^2\Vert\mathbf{y}\Vert^2-(\mathbf{x}\cdot\mathbf{y})^2\\ &=(x_1^2+x_2^2+x_3^2)(y_1^2+y_2^2+y_3^2)-(x_1y_1+x_2y_2+x_3y_3)^2\\ &=x_1^2y_2^2+x_2^2y_1^2+x_2^2y_3^2+x_3^2y_2^2+x_3^2y_1^2+x_1^2y_3^2\\ &~~-2x_1x_2y_1y_2-2x_2x_3y_2y_3-2x_1y_1x_3y_3\\ &=\begin{vmatrix} x_1&x_2\\ y_1&y_2 \end{vmatrix}^2+\begin{vmatrix}x_2&x_3\\y_2&y_3\end{vmatrix}^2+\begin{vmatrix}x_3&x_1\\y_3&y_1 \end{vmatrix}^2.\end{aligned}

任意置換 h(\mathbf{x},\mathbf{y}) 的元或改變各元的正負號不會改變向量長,僅由向量長 \Vert h(\mathbf{x},\mathbf{y})\Vert 不足以決定 h(\mathbf{x},\mathbf{y}) 的形式。那麼基於甚麼理由,我們能夠斷言

h(\mathbf{x},\mathbf{y})=\left(\begin{vmatrix}x_2&x_3\\y_2&y_3 \end{vmatrix},\begin{vmatrix}x_3&x_1\\y_3&y_1\end{vmatrix},\begin{vmatrix} x_1&x_2\\y_1&y_2 \end{vmatrix}\right)

別無他技,一些中學數學課本只好搬出物理學來敷衍 (譬如,力矩),強將外積定義為右手屈伸的大拇指方向。表面上,這套論述繼承亞里斯多德的目的論,但中間缺少令人信服的數學原因。英國數學家哈代 (G. H. Hardy) 說[3]:「數學家的模式,如畫家或詩人的模式必須是美麗的;數學家的想法,如色彩或文字必須以和諧的方式結合在一起。美是首要的試金石:醜陋的數學不可能永存。」外積是美的數學,但醜陋的數學教材卻依然存在。

附註:
[1] 維基百科:William Kingdon Clifford
[2] 維基百科:Josiah Willard Gibbs
[3] 原文是:“The mathematician’s patterns, like the painter’s or the poet’s must be beautiful; the ideas, like the colours or the words must fit together in a harmonious way. Beauty is the first test: there is no permanent place in the world for ugly mathematics.”

Advertisement
This entry was posted in 線性代數專欄, 內積空間 and tagged , , , , . Bookmark the permalink.

3 Responses to 內積與外積是怎麼來的?

  1. Nicholas Qin says:

    读完此贴,顿时有茅塞顿开之感,感谢!

  2. LMK says:

    感謝老師的說明,數學真的好美

  3. LMK says:

    感謝老師的說明,數學真的好美

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s