Outer product

Jump to navigation Jump to search

In linear algebra, the outer product of two coordinate vectors is a matrix. If the two vectors have dimensions n and m, then their outer product is an n × m matrix. If the first vector is taken as a column vector, then the outer product is the matrix of columns proportional to this vector, where the proportionality of each column is a component of the second vector.

The outer product introduces tensor algebra since the outer product of two vectors ${\displaystyle \mathbf {u} }$ and ${\displaystyle \mathbf {v} }$ is their tensor product ${\displaystyle \mathbf {u} \otimes \mathbf {v} ,}$ which is the matrix ${\displaystyle \mathbf {w} }$ given by ${\displaystyle w_{ij}=u_{i}v_{j}}$. More generally, the outer product is an instance of Kronecker products.

The outer product contrasts with the dot product, which takes as input a pair of coordinate vectors and produces a scalar.

The outer product is also a related function in some computer programming languages.

Definition (matrix multiplication)

The outer product uv is equivalent to a matrix multiplication uvT, provided that u is represented as a m × 1 column vector and v as a n × 1 column vector (which makes vT a row vector).[1] For instance, if m = 4 and n = 3, then

{\displaystyle {\begin{aligned}\mathbf {u} \otimes \mathbf {v} =\mathbf {u} \mathbf {v} ^{\top }={\begin{bmatrix}u_{1}\\u_{2}\\u_{3}\\u_{4}\end{bmatrix}}{\begin{bmatrix}v_{1}&v_{2}&v_{3}\end{bmatrix}}={\begin{bmatrix}u_{1}v_{1}&u_{1}v_{2}&u_{1}v_{3}\\u_{2}v_{1}&u_{2}v_{2}&u_{2}v_{3}\\u_{3}v_{1}&u_{3}v_{2}&u_{3}v_{3}\\u_{4}v_{1}&u_{4}v_{2}&u_{4}v_{3}\end{bmatrix}}.\end{aligned}}}[2]

Or in index notation:

${\displaystyle (\mathbf {u} \mathbf {v} ^{\top })_{ij}=u_{i}v_{j}}$

For complex vectors, it is customary to use the conjugate transpose of v, denoted ${\displaystyle \mathbf {v} ^{\dagger }}$or ${\displaystyle (\mathbf {v} ^{\top })^{*}}$:

${\displaystyle \mathbf {u} \otimes \mathbf {v} =\mathbf {u} \mathbf {v} ^{\dagger }=\mathbf {u} (\mathbf {v} ^{\top })^{*}\ }$.

Contrast with Euclidean inner product

If m = n, then one can take the matrix product the other way, yielding a scalar (or 1 × 1 matrix):

${\displaystyle \left\langle \mathbf {u} ,\mathbf {v} \right\rangle =\mathbf {u} ^{\top }\mathbf {v} }$

which is the standard inner product for Euclidean vector spaces, better known as the dot product. The inner product is the trace of the outer product.[3] Unlike the inner product, the outer product is not commutative.

Rank of an outer product

If u and v are both nonzero then the outer product matrix uvT always has matrix rank 1. Indeed, the columns of the outer product are all proportional to the first column, thus they are all linearly dependent on that one column, hence the matrix is of rank one.

("Matrix rank" should not be confused with "tensor order", or "tensor degree", which is sometimes referred to as "rank".)

Definition (vectors and tensors)

Vector multiplication

Given the vectors

${\displaystyle \mathbf {u} =(u_{1},u_{2},\dots ,u_{m})}$
${\displaystyle \mathbf {v} =(v_{1},v_{2},\dots ,v_{n})}$

their outer product uv is defined as the m × n matrix A obtained by multiplying each element of u by each element of v:[4][5]

${\displaystyle \mathbf {u} \otimes \mathbf {v} =\mathbf {A} ={\begin{bmatrix}u_{1}v_{1}&u_{1}v_{2}&\dots &u_{1}v_{n}\\u_{2}v_{1}&u_{2}v_{2}&\dots &u_{2}v_{n}\\\vdots &\vdots &\ddots &\vdots \\u_{m}v_{1}&u_{m}v_{2}&\dots &u_{m}v_{n}\end{bmatrix}}}$

For complex vectors, outer product can be defined as above, or with the conjugate transpose of ${\displaystyle \mathbf {v} }$ (denoted ${\displaystyle \mathbf {v} ^{\dagger }}$o ${\displaystyle \mathbf {v} ^{\text{H}}}$). Namely, matrix A is obtained by multiplying each element of u by the conjugate transpose of each element of ${\displaystyle \mathbf {v} }$.

Tensor multiplication

The outer product on tensors is typically referred to as the tensor product. Given a tensor a of order q with dimensions (i1, ..., iq), and a tensor b of order r with dimensions (j1, ..., jr), their outer product c is of order q + r with dimensions (k1, ..., kq+r) which are the i  dimensions followed by the j  dimensions. It is denoted in coordinate-free notation using ⊗ and components are defined in index notation by:[6]

${\displaystyle \mathbf {c} =\mathbf {a} \otimes \mathbf {b} ,\quad c_{ij}=a_{i}b_{j}}$

similarly for higher order tensors:

${\displaystyle \mathbf {T} =\mathbf {a} \otimes \mathbf {b} \otimes \mathbf {d} ,\quad T_{ijk}=a_{i}b_{j}d_{k}}$

For example, if A is of order 3 with dimensions (3, 5, 7) and B is of order 2 with dimensions (10, 100), their outer product c is of order 5 with dimensions (3, 5, 7, 10, 100). If A has a component A[2, 2, 4] = 11 and B has a component B[8, 88] = 13, then the component of C formed by the outer product is C[2, 2, 4, 8, 88] = 143.

To understand the matrix definition of outer product in terms of the definition of tensor product:

1. The vector v can be interpreted as an order-1 tensor with dimension M, and the vector u as an order-1 tensor with dimension N. The result is an order-2 tensor with dimension (M, N).
2. The order of the result of an inner product between two tensors of order q and r is the greater of q + r − 2 and 0. Thus, the inner product of two matrices has the same order as the outer product (or tensor product) of two vectors.
3. It is possible to add arbitrarily many leading or trailing 1 dimensions to a tensor without fundamentally altering its structure. These 1 dimensions would alter the character of operations on these tensors, so any resulting equivalences should be expressed explicitly.
4. The inner product of two matrices V with dimensions (d, e) and U with dimensions (e, f) is ${\displaystyle \sum _{j=1}^{e}V_{ij}U_{jk}}$, where i = 1, 2, ..., d and k = 1, 2, ..., f. For the case where e = 1, the summation is trivial (involving only a single term).
5. The outer product of two matrices V with dimensions (m, n) and U with dimensions (p, q) is ${\displaystyle C_{st}=V_{ij}U_{hk}}$, where s = 1, 2, ..., mp − 1, mp and t = 1, 2, ..., nq − 1, nq.

Definition (abstract)

Let V and W be two vector spaces, and let W be the dual space of W. Given vectors xV and yW, then the tensor product yx corresponds to the map A : W → V given by

${\displaystyle w\mapsto y(w)x.}$

Here y(w) denotes the value of the linear functional y (which is an element of the dual space of W) when evaluated at the element wW. This scalar in turn is multiplied by x to give as the final result an element of the space V.

If V and W are finite-dimensional, then the space of all linear transformations from W to V, denoted Hom(W, V), is generated by such outer products; in fact, the rank of a matrix is the minimal number of such outer products needed to express it as a sum (this is the tensor rank of a matrix). In this case Hom(W, V) is isomorphic to WV.

Contrast with duality pairing

If W = V, then one can pair the covector wV with the vector vV via the map (w, v) ↦ w(v), which is the duality pairing between V and its dual.

In programming languages

In some programming languages, given a two-argument function f (or a binary operator), the outer product of f and two one-dimensional arrays A and B is a two-dimensional array C such that C[i,j] = f(A[i],B[j]); this is syntactically represented in various ways: in APL, as the infix binary operator °.f; in R, as the function outer(A, B, f);[7] in Mathematica, as Outer[f,A,B]. In MATLAB, the function kron(A,B) is used for this product; these often generalize to multi-dimensional arguments, and more than two arguments.

Python with NumPy

In the Python library NumPy, the outer product can be computed with function np.outer() [8]


>>> import numpy as np
>>> a = np.array([1, 2, 3])
>>> b = np.array([2, 4, 8])
>>> np.outer(a, b)

Out[*]:  array([[ 2,  4,  8],
[ 4,  8, 16],
[ 6, 12, 24]])

# in contrast np.kron, generalization of outer product, results in a flat array
>>> np.kron(a, b)

Out[*]:  array([ 2, 4, 8, 4, 8, 16, 6, 12, 24])


Properties

The outer product satisfies the following properties:

${\displaystyle (\mathbf {u} \otimes \mathbf {v} )^{\top }=(\mathbf {v} \otimes \mathbf {u} )}$
${\displaystyle (\mathbf {v} +\mathbf {w} )\otimes \mathbf {u} =\mathbf {v} \otimes \mathbf {u} +\mathbf {w} \otimes \mathbf {u} }$
${\displaystyle \mathbf {u} \otimes (\mathbf {v} +\mathbf {w} )=\mathbf {u} \otimes \mathbf {v} +\mathbf {u} \otimes \mathbf {w} }$
${\displaystyle c(\mathbf {v} \otimes \mathbf {u} )=(c\mathbf {v} )\otimes \mathbf {u} =\mathbf {v} \otimes (c\mathbf {u} )}$

Applications

As the outer product is a special case of the Kronecker product, some of the applications of the Kronecker product use outer products; some of these applications to quantum theory, signal processing, and image compression are found in chapter 3, "Applications", in a book by Willi-Hans Steeb and Yorick Hardy.[9]

Spinors

Suppose s,t,w,z ∈ ℂ so that (s,t) and (w,z) are in ℂ2. Then the outer product of these complex 2-vectors is an element of M(2,ℂ), the 2 × 2 complex matrices:

${\displaystyle {\begin{pmatrix}sw&tw\\sz&tz\end{pmatrix}}.}$ The determinant of this matrix is swtzsztw = 0 because of the commutative property of ℂ.

In the theory of spinors in three dimensions, these matrices are associated with isotropic vectors due to this null property. Élie Cartan described this construction in 1937[10] but it was introduced by Wolfgang Pauli in 1927[11] so that M(2,ℂ) has come to be called Pauli algebra.

Concepts

The block form of outer products is useful in classification. Concept analysis is a study that depends on certain outer products:

When a vector has only zeros and ones as entries it is called a logical vector, a special case of a logical matrix; the logical operation and takes the place of multiplication. The outer product of two logical vectors (ui) and (vj) is given by the logical matrix ${\displaystyle (a_{ij})\ =\ (u_{i}\land v_{j})}$. This type of matrix is used in the study of binary relations and is called a rectangular relation or a cross-vector.[12]

References

1. ^ Lipschutz, S.; Lipson, M. (2009). Linear Algebra. Schaum’s Outlines (4th ed.). McGraw-Hill. ISBN 978-0-07-154352-1.
2. ^ James M. Ortega (1987) Matrix Theory: A Second Course, page 7, Plenum Press ISBN 0-306-42433-9
3. ^ Stengel, Robert F. (1994). Optimal Control and Estimation. New York: Dover Publications. p. 26. ISBN 0-486-68200-5.
4. ^ "Kronecker Product". Wolfram MathWorld.
5. ^ Lerner, R. G.; Trigg, G. L. (1991). Encyclopaedia of Physics (2nd ed.). VHC. ISBN 0-89573-752-3.
6. ^ Riley, K. F.; Hobson, M. P.; Bence, S. J. (2010). Mathematical Methods for Physics and Engineering. Cambridge University Press. ISBN 978-0-521-86153-3.
7. ^ "outer function". RDocumentation.
8. ^ https://docs.scipy.org/doc/numpy/reference/generated/numpy.outer.html
9. ^ Willi-Hans Steeb and Yorick Hardy (2011) Matrix Calculus and Kronecker Product: A Practical Approach to Linear and Multilinear Algebra, second edition, World Scientific ISBN 981-4335-31-2
10. ^ Élie Cartan (1937) Lecons sur la theorie des spineurs, translated 1966: The Theory of Spinors, Hermann, Paris
11. ^ Pertti Lounesto (1997) Clifford Algebras and Spinors, page 51, Cambridge University Press ISBN 0-521-59916-4
12. ^ Ki Hang Kim (1982) Boolean Matrix Theory and Applications, page 37, Marcel Dekker ISBN 0-8247-1788-0