# Outer Product of Two Matrices?

How would I go about calculating the outer product of two matrices of 2 dimensions each? From what I can find, outer product seems to be the product of two vectors, $u$ and the transpose of another vector, $v^T$.

As an example, how would I calculate the outer product of $A$ and $B$, where $$A = \begin{pmatrix}1 & 2 \\ 3 & 4\end{pmatrix} \qquad B = \begin{pmatrix}5 & 6 & 7 \\ 8 & 9 & 10\end{pmatrix}$$

The outer product usually refers to the tensor product of vectors. If you want something like the outer product between a $$m \times n$$ matrix $$A$$ and a $$p\times q$$ matrix $$B$$, you can see the generalization of outer product, which is the Kronecker product. It is noted $$A \otimes B$$ and equals: $$A \otimes B = \begin{pmatrix}a_{11}B & \dots & a_{1n}B \\ \vdots & \ddots & \vdots \\ a_{m1}B & \dots & a_{mn}B\end{pmatrix}$$

• I think this answer would benefit by contrasting the outer product of a tensor algebra, and the kronecker product. See comment in tylers answer. Apr 23, 2020 at 9:39

$$A\otimes B= \left( \begin{array}{cc} \left( \begin{array}{ccc} 5 & 6 & 7 \\ 8 & 9 & 10 \\ \end{array} \right) & \left( \begin{array}{ccc} 10 & 12 & 14 \\ 16 & 18 & 20 \\ \end{array} \right) \\ \left( \begin{array}{ccc} 15 & 18 & 21 \\ 24 & 27 & 30 \\ \end{array} \right) & \left( \begin{array}{ccc} 20 & 24 & 28 \\ 32 & 36 & 40 \\ \end{array} \right) \\ \end{array} \right)$$

I think @davcha and @Sandu Ursu 's answers are wrong. They have calculated the Kronecker Product. According to the definition of outer product, the outer product of A and B should be a $$2×2×2×3$$ tensor. You can follow this answer to compute it using numpy.

• This is a valid point. One should be careful with the term "outer product" since it can be understood as different things. Does one expect 2 or 4 indices? Apr 23, 2020 at 9:41
• This is not entirely accurate. Sandu Ursu's answer is actually correct: what he described is indeed a $2 \times 2 \times 2 \times 3$ tensor; davcha's answer is just ambiguous -- it can either be treated as a $m \times n \times p \times q$ tensor or as a matrix with block notation. Sep 7, 2021 at 3:24