# 外积

两个向量的外积是这样一种运算：将第一个向量的每个元素与第二个向量的每个元素相乘，生成一个矩阵。对于向量 \( u \in \mathbb{R}^m \) 和 \( v \in \mathbb{R}^n \)，外积 \( u \otimes v \) 是一个 \( m \times n \) 的矩阵 \( W \)，其元素满足 \( w_{i,j} = u_i v_j \)<sup>[1](https://www.cfm.brown.edu/people/dobrush/cs52/Mathematica/Part5/vdot.html)</sup>。用矩阵记号写为 \( u v^T \)，即列向量与行向量之积。其结果秩至多为一，这使得外积成为矩阵秩理论、矩阵乘法算法和数值线性代数库的基本构件。<sup>[2](https://skim.math.msstate.edu/LectureNotes/Programming-Basics-and-AI-Lecture.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 对于 \( u \in \mathbb{R}^m \)、\( v \in \mathbb{R}^n \)，外积是元素为 \( w_{i,j} = u_i v_j \) 的 \( m \times n \) 矩阵，记作 \( u \otimes v \) 或 \( u v^T \)<sup>[1](https://www.cfm.brown.edu/people/dobrush/cs52/Mathematica/Part5/vdot.html)</sup> |
| 秩 | 非零向量的外积秩为一；若任一向量为零向量，则秩为零。每一个秩一矩阵都是某个外积 \( u v^T \)<sup>[3](https://math.stackexchange.com/questions/3440711/tensor-product-and-rank-of-matrix)</sup><sup> • </sup><sup>[2](https://skim.math.msstate.edu/LectureNotes/Programming-Basics-and-AI-Lecture.pdf)</sup> |
| 与内积的对比 | 两个向量的内积 \( \langle A \mid B \rangle \) 是一个标量；外积则是一个矩阵（在狄拉克记号中，是一个线性算子 \( \lvert B \rangle \langle A \rvert \)）<sup>[4](https://farside.ph.utexas.edu/teaching/qm/Quantumhtml/node10.html)</sup> |
| 矩阵乘法 | 对于 \( A \)（\( m \times n \)）和 \( B \)（\( n \times p \)），其乘积可写为 \( n \) 个外积之和，\( C = \sum_{k=1}^{n} \mathbf{a}_k \mathbf{b}^k \)<sup>[5](https://courses.math.wichita.edu/math511/ch2/1/MatrixArithmetic.html)</sup> |
| 高阶情形 | 秩一三阶张量是三个向量的外积，\( X(i,j,k) = a(i)b(j)c(k) \)；该定义可推广到任意多个向量<sup>[6](https://www.cs.ucr.edu/~epapalex/papers/tsp17-tensors.pdf)</sup> |
| 库支持 | NumPy 的 `numpy.outer(a, b)` 返回满足 `out[i, j] = a[i] * b[j]` 的数组，并将输入展平为一维<sup>[7](https://numpy.org/doc/2.0/reference/generated/numpy.outer.html)</sup> |
| BLAS 运算 | 秩一更新例程（BLAS `xGER`）在 \( O(m \times n) \) 时间内计算 \( A' = A + x y^T \)<sup>[8](https://www.staroceans.org/cxx/linalg.algs.blas2.rank1.html)</sup> |

## 定义与基本性质

给定两个坐标向量 \( u = [u_1, u_2, \ldots, u_m] \) 和 \( v = [v_1, v_2, \ldots, v_n] \)，外积 \( u \otimes v \) 是满足 \( w_{i,j} = u_i v_j \) 的 \( m \times n \) 矩阵 \( W \)<sup>[1](https://www.cfm.brown.edu/people/dobrush/cs52/Mathematica/Part5/vdot.html)</sup>。其每一行都是 \( v^T \) 的标量倍，每一列都是 \( u \) 的标量倍，因此当两个向量均非零时，该矩阵的秩为一；若任一向量为零向量，则秩为零。<sup>[3](https://math.stackexchange.com/questions/3440711/tensor-product-and-rank-of-matrix)</sup> 逆命题同样成立：每一个秩一矩阵都可以表示为两个向量的外积，因为其所有列都是某个单一列向量的倍数。<sup>[9](https://bsc-iitm.github.io/machine-learning-foundations/site/appendix/rank_one/)</sup>

这一联系使外积成为定义矩阵秩本身的一种方式：矩阵的秩是合成该矩阵所需秩一矩阵（即两个向量的外积）的最少个数。<sup>[6](https://www.cs.ucr.edu/~epapalex/papers/tsp17-tensors.pdf)</sup> 在张量文献中，张量的秩相应地有时被称为外积秩。<sup>[10](https://people.tamu.edu/~jml/Tbookintro.pdf)</sup>

外积在任何有意义的层面上都不满足交换律：\( u v^T \) 和 \( v u^T \) 通常具有不同的形状，即使结果都是方阵，除非两向量平行，否则两个矩阵也不相同。向量与自身的并矢积 \( \mathbf{v} \mathbf{v}^T \) 是对称的。<sup>[11](https://www3.nd.edu/~powers/ame.60635/notes.pdf)</sup>

## 与矩阵乘法的关系

矩阵乘法有两种对偶的分量级描述。内积形式将 \( C = AB \) 的每个元素写成 \( A \) 的行与 \( B \) 的列的 \( n \) 个内积之和。外积形式则将整个乘积矩阵写成 \( n \) 个矩阵之和：设 \( \mathbf{a}_k \) 为 \( A \) 的第 \( k \) 列，\( \mathbf{b}^k \) 为 \( B \) 的第 \( k \) 行，

\[ C = \sum_{k=1}^{n} \mathbf{a}_k \mathbf{b}^k. \]

每一项 \( \mathbf{a}_k \mathbf{b}^k \) 都是一个 \( m \times p \) 的外积，两种形式是同一运算的等价描述。<sup>[5](https://courses.math.wichita.edu/math511/ch2/1/MatrixArithmetic.html)</sup> 这种外积形式是奇异值分解的基础——在奇异值分解中，矩阵被写成奇异向量的秩一外积按奇异值加权之和——并应用于机器学习、数据压缩和信号处理。<sup>[5](https://courses.math.wichita.edu/math511/ch2/1/MatrixArithmetic.html)</sup>

## 向张量的推广

逐元素定义可直接推广到多于两个向量的情形。大小为 \( I \times J \times K \) 的秩一三阶张量 \( X \) 是三个向量的外积，\( X(i,j,k) = a(i)b(j)c(k) \)，记作 \( X = a \circ b \circ c \)；秩一 \( N \) 阶张量是 \( N \) 个向量的外积，\( X(i_1, \ldots, i_N) = a_1(i_1) \cdots a_N(i_N) \)<sup>[6](https://www.cs.ucr.edu/~epapalex/papers/tsp17-tensors.pdf)</sup>。在张量积文献中，这种 \( m \) 向量构造被称为塞格雷外积（Segre outer product），所得到的数组张成整个空间 \( \mathbb{F}^{n_1 \times \cdots \times n_m} \)；这样的秩一张量也称为可分解张量或纯张量。<sup>[12](https://mathweb.ucsd.edu/~njw/Teaching/Fa21_277TC/TCBook-Chap01.pdf)</sup>

在矩阵情形之外还有一点需要注意：对于三个或更多向量，逐元素定义仍然适用，但两向量情形下熟悉的“列向量乘以转置行向量”的表示不再保留。<sup>[6](https://www.cs.ucr.edu/~epapalex/papers/tsp17-tensors.pdf)</sup> 并非每个张量都是单个外积；一般张量是秩一张量的线性组合，其秩是所需此类项的最少个数。<sup>[12](https://mathweb.ucsd.edu/~njw/Teaching/Fa21_277TC/TCBook-Chap01.pdf)</sup><sup> • </sup><sup>[6](https://www.cs.ucr.edu/~epapalex/papers/tsp17-tensors.pdf)</sup>

## 在物理学中

在量子力学的狄拉克记号中，右矢与左矢的外积 \( \lvert B \rangle \langle A \rvert \) 是一个线性算子：作用于一般右矢 \( \lvert C \rangle \) 时，得到 \( \langle A \mid C \rangle \lvert B \rangle \)，即被内积 \( \langle A \mid C \rangle \) 缩放后的右矢<sup>[4](https://farside.ph.utexas.edu/teaching/qm/Quantumhtml/node10.html)</sup>。其伴随满足 \( (\lvert B \rangle \langle A \rvert)^{\dagger} = \lvert A \rangle \langle B \rvert \)<sup>[4](https://farside.ph.utexas.edu/teaching/qm/Quantumhtml/node10.html)</sup>。外积不应与内积 \( \langle A \mid B \rangle \) 混淆，后者只是一个数。<sup>[4](https://farside.ph.utexas.edu/teaching/qm/Quantumhtml/node10.html)</sup> 更广泛地说，复合量子系统由希尔伯特空间的张量积描述，而无法写成单个纯张量的态代表纠缠态，例如贝尔态 \( \frac{1}{\sqrt{2}}(\lvert 00 \rangle + \lvert 11 \rangle) \)<sup>[13](https://interactivetextbooks.tudelft.nl/mqp-v2/tensor-products.html)</sup>。

在经典电动力学中，同样的构造以并矢的形式出现：将两个向量按项分配相乘，得到 \( A_x B_x \, \mathbf{i}\mathbf{i} + A_x B_y \, \mathbf{i}\mathbf{j} + \cdots \) 之和，称为并矢，其中每一对单位向量是一个并矢项。<sup>[14](https://webhome.phy.duke.edu/~rgb/Class/Electrodynamics/Electrodynamics/node23.html)</sup> 并矢积可追溯到乔赛亚·威拉德·吉布斯（Josiah Willard Gibbs）的向量分析；并矢项的显式逐分量定义 \( \mathbf{a} \otimes \mathbf{b} = \sum_{i,j} a_i b_j \, \mathbf{e}_i \otimes \mathbf{e}_j \)（对九组基向量对求和）出现在 1901 年由其学生 E. B. 威尔逊（E. B. Wilson）整理的教材中。<sup>[15](https://www.tandfonline.com/doi/full/10.1080/26375451.2024.2393004)</sup>

## 计算

数值库直接提供外积，也通过秩一更新例程提供。

- **NumPy。** `numpy.outer(a, b)` 接受长度为 \( M \) 和 \( N \) 的向量，将任意高维输入展平为一维，返回满足 `out[i, j] = a[i] * b[j]` 的 \( (M, N) \) 数组；可选的 `out` 参数用于提供目标数组。<sup>[7](https://numpy.org/doc/2.0/reference/generated/numpy.outer.html)</sup> 更通用的 `ufunc.outer` 将任意 ufunc 应用于所有元素对，输出的维度为输入维度之和；`np.multiply.outer` 是乘法情形，而 `numpy.outer` 被描述为功能较弱的版本，它将输入展平为一维，主要为兼容旧代码而保留。<sup>[16](https://numpy.org/doc/2.3/reference/generated/numpy.ufunc.outer.html)</sup> 例如，`np.multiply.outer([1, 2, 3], [4, 5, 6])` 返回矩阵 [[4, 5, 6], [8, 10, 12], [12, 15, 18]]。<sup>[16](https://numpy.org/doc/2.3/reference/generated/numpy.ufunc.outer.html)</sup>
- **BLAS 与 C++。** BLAS 二级例程 `xGER`（实数）和 `xGERU`/`xGERC`（复数）执行秩一更新。C++ 线性代数规范中的 `matrix_rank_1_update` 以 \( O(x.extent(0) \times y.extent(0)) \) 的复杂度计算 \( A' = A + x y^T \)，另有一个共轭变体处理复向量。<sup>[8](https://www.staroceans.org/cxx/linalg.algs.blas2.rank1.html)</sup> LAPACK 的 `sger` 同样被记载为二级 BLAS 一般矩阵秩一更新。<sup>[17](https://www.netlib.org/lapack/explore-html/d8/d75/group__ger_ga95baec6bb0a84393d7bc67212b566ab0.html)</sup>

秩一更新也出现在迭代算法中。在神经网络训练中，损失对某一层权重矩阵的梯度是反向传播误差与输入激活的外积之和，\( \Delta \hat{w}^i = -\frac{\eta}{n} \sum_{j=1}^{n} \delta^{i,j} [x^{i,j}]^T \)；由于每一项都是秩一矩阵，用其最重要的低秩分量近似该更新可减少所执行的更新次数。<sup>[18](https://doi.org/10.3389/fnins.2019.00793.s001)</sup>

## References

1. [Linear Algebra, Part 5: Vector Products, Brown University](https://www.cfm.brown.edu/people/dobrush/cs52/Mathematica/Part5/vdot.html)
2. [Computation in Linear Algebra, Lecture Notes, Mississippi State University](https://skim.math.msstate.edu/LectureNotes/Programming-Basics-and-AI-Lecture.pdf)
3. [Tensor product and rank of matrix, Mathematics Stack Exchange](https://math.stackexchange.com/questions/3440711/tensor-product-and-rank-of-matrix)
4. [Outer Product, Farside Quantum Mechanics notes, University of Texas](https://farside.ph.utexas.edu/teaching/qm/Quantumhtml/node10.html)
5. [Matrix Arithmetic, Section 2.1.9 Outer Products, Wichita State University](https://courses.math.wichita.edu/math511/ch2/1/MatrixArithmetic.html)
6. [Papalexakis et al., Tensors for Data Mining and Machine Learning (TSP 2017)](https://www.cs.ucr.edu/~epapalex/papers/tsp17-tensors.pdf)
7. [numpy.outer, NumPy v2.0 Manual](https://numpy.org/doc/2.0/reference/generated/numpy.outer.html)
8. [C++ Numerics Library, BLAS 2 algorithms: Rank-1 (outer product) update](https://www.staroceans.org/cxx/linalg.algs.blas2.rank1.html)
9. [Rank-1 matrices, Machine Learning Foundations, IIT Madras](https://bsc-iitm.github.io/machine-learning-foundations/site/appendix/rank_one/)
10. [Introduction, Tensor book, Texas A&M University](https://people.tamu.edu/~jml/Tbookintro.pdf)
11. [Lecture Notes on Continuum Mechanics, dyadic product, University of Notre Dame](https://www3.nd.edu/~powers/ame.60635/notes.pdf)
12. [Chapter 1: Tensor Products, UC San Diego course notes](https://mathweb.ucsd.edu/~njw/Teaching/Fa21_277TC/TCBook-Chap01.pdf)
13. [Tensor Products, Mathematics for Quantum Physics, TU Delft](https://interactivetextbooks.tudelft.nl/mqp-v2/tensor-products.html)
14. [The Dyad and dyadic Forms, Electrodynamics notes, Duke University](https://webhome.phy.duke.edu/~rgb/Class/Electrodynamics/Electrodynamics/node23.html)
15. [The development of Gibbs's dyadic and implications for the gradient of a vector field, History of Mathematics (2024)](https://www.tandfonline.com/doi/full/10.1080/26375451.2024.2393004)
16. [numpy.ufunc.outer, NumPy v2.3 Manual](https://numpy.org/doc/2.3/reference/generated/numpy.ufunc.outer.html)
17. [LAPACK: sger, general matrix rank-1 update](https://www.netlib.org/lapack/explore-html/d8/d75/group__ger_ga95baec6bb0a84393d7bc67212b566ab0.html)
18. [Streaming Batch Eigenupdates for Hardware Neural Networks, Frontiers in Neuroscience (2019)](https://doi.org/10.3389/fnins.2019.00793.s001)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Linear and multilinear algebra › Multilinear and tensor algebra › Tensor products and tensor algebra

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/outer-product

English original: https://www.edgepedia.org/outer-product
