User:StevenDH/Kronecker product temp

In mathematics, the Kronecker product, denoted by $$\otimes$$, is an operation on two matrices of arbitrary size resulting in a block matrix. It is a special case of a tensor product. The Kronecker product should not be confused with the usual matrix multiplication, which is an entirely different operation. It is named after German mathematician Leopold Kronecker.

Definition
If A is an m-by-n matrix and B is a p-by-q matrix, then the Kronecker product $$A \otimes B$$ is the mp-by-nq block matrix
 * $$ A \otimes B = \begin{bmatrix} a_{11} B & \cdots & a_{1n}B \\ \vdots & \ddots & \vdots \\ a_{m1} B & \cdots & a_{mn} B \end{bmatrix}. $$

More explicitly, we have
 * $$ A \otimes B = \begin{bmatrix}

a_{11} b_{11} & a_{11} b_{12} & \cdots & a_{11} b_{1q} & \cdots & \cdots & a_{1n} b_{11} & a_{1n} b_{12} & \cdots & a_{1n} b_{1q} \\ a_{11} b_{21} & a_{11} b_{22} & \cdots & a_{11} b_{2q} & \cdots & \cdots & a_{1n} b_{21} & a_{1n} b_{22} & \cdots & a_{1n} b_{2q} \\ \vdots & \vdots & \ddots & \vdots & & & \vdots & \vdots & \ddots & \vdots \\ a_{11} b_{p1} & a_{11} b_{p2} & \cdots & a_{11} b_{pq} & \cdots & \cdots & a_{1n} b_{p1} & a_{1n} b_{p2} & \cdots & a_{1n} b_{pq} \\ \vdots & \vdots & & \vdots & \ddots & & \vdots & \vdots & & \vdots \\ \vdots & \vdots & & \vdots & & \ddots & \vdots & \vdots & & \vdots \\ a_{m1} b_{11} & a_{m1} b_{12} & \cdots & a_{m1} b_{1q} & \cdots & \cdots & a_{mn} b_{11} & a_{mn} b_{12} & \cdots & a_{mn} b_{1q} \\ a_{m1} b_{21} & a_{m1} b_{22} & \cdots & a_{m1} b_{2q} & \cdots & \cdots & a_{mn} b_{21} & a_{mn} b_{22} & \cdots & a_{mn} b_{2q} \\ \vdots & \vdots & \ddots & \vdots & & & \vdots & \vdots & \ddots & \vdots \\ a_{m1} b_{p1} & a_{m1} b_{p2} & \cdots & a_{m1} b_{pq} & \cdots & \cdots & a_{mn} b_{p1} & a_{mn} b_{p2} & \cdots & a_{mn} b_{pq} \end{bmatrix}. $$

Examples


\begin{bmatrix} 1 & 2 \\    3 & 4 \\   \end{bmatrix} \otimes \begin{bmatrix} 0 & 5 \\    6 & 7 \\   \end{bmatrix} = \begin{bmatrix} 1\cdot 0 & 1\cdot 5 & 2\cdot 0 & 2\cdot 5 \\ 1\cdot 6 & 1\cdot 7 & 2\cdot 6 & 2\cdot 7 \\ 3\cdot 0 & 3\cdot 5 & 4\cdot 0 & 4\cdot 5 \\ 3\cdot 6 & 3\cdot 7 & 4\cdot 6 & 4\cdot 7 \\ \end{bmatrix}

= \begin{bmatrix} 0 & 5 & 0 & 10 \\    6 & 7 & 12 & 14 \\    0 & 15 & 0 & 20 \\    18 & 21 & 24 & 28  \end{bmatrix} $$.



\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ a_{31} & a_{32} \end{bmatrix} \otimes \begin{bmatrix} b_{11} & b_{12} & b_{13} \\ b_{21} & b_{22} & b_{23} \end{bmatrix} = \begin{bmatrix} a_{11} b_{11} & a_{11} b_{12} & a_{11} b_{13} & a_{12} b_{11} & a_{12} b_{12} & a_{12} b_{13} \\ a_{11} b_{21} & a_{11} b_{22} & a_{11} b_{23} & a_{12} b_{21} & a_{12} b_{22} & a_{12} b_{23} \\ a_{21} b_{11} & a_{21} b_{12} & a_{21} b_{13} & a_{22} b_{11} & a_{22} b_{12} & a_{22} b_{13} \\ a_{21} b_{21} & a_{21} b_{22} & a_{21} b_{23} & a_{22} b_{21} & a_{22} b_{22} & a_{22} b_{23} \\ a_{31} b_{11} & a_{31} b_{12} & a_{31} b_{13} & a_{32} b_{11} & a_{32} b_{12} & a_{32} b_{13} \\ a_{31} b_{21} & a_{31} b_{22} & a_{31} b_{23} & a_{32} b_{21} & a_{32} b_{22} & a_{32} b_{23} \end{bmatrix} $$.

Bilinearity and associativity
The Kronecker product is a special case of the tensor product, so it is bilinear and associative:
 * $$ A \otimes (B+C) = A \otimes B + A \otimes C \qquad, $$
 * $$ (A+B) \otimes C = A \otimes C + B \otimes C \qquad, $$
 * $$ (kA) \otimes B = A \otimes (kB) = k(A \otimes B), $$
 * $$ (A \otimes B) \otimes C = A \otimes (B \otimes C), $$

where A, B and C are matrices and k is a scalar.

The Kronecker product is not commutative: in general, A $$\otimes$$ B and B $$\otimes$$ A are different matrices. However, A $$\otimes$$ B and B $$\otimes$$ A are permutation equivalent, meaning that there exist permutation matrices P and Q such that
 * $$ A \otimes B = P \, (B \otimes A) \, Q. $$

If A and B are square matrices, then A $$\otimes$$ B and B $$\otimes$$ A are even permutation similar, meaning that we can take P = QT.

The mixed-product property
If A, B, C and D are matrices of such size that one can form the matrix products AC and BD, then
 * $$ (A \otimes B)(C \otimes D) = AC \otimes BD. $$

This is called the mixed-product property, because it mixes the ordinary matrix product and the Kronecker product. It follows that A $$\otimes$$ B is invertible if and only if A and B are invertible, in which case the inverse is given by
 * $$ (A \otimes B)^{-1} = A^{-1} \otimes B^{-1}. $$

Kronecker sum and exponentiation
If A is n-by-n, B is m-by-m and  $$I_k$$ denotes the k-by-k identity matrix then we can define the Kronecker sum, $$\oplus$$, by
 * $$ A \oplus B = A \otimes I_m + I_n \otimes B. $$

We have the following formula for the matrix exponential which is useful in the numerical evaluation of certain continuous-time Markov processes,
 * $$ e^{A \oplus B} = e^A \otimes e^B. $$

Spectrum
Suppose that A and B are square matrices of size n and q respectively. Let &lambda;1, ..., &lambda;n be the eigenvalues of A and &mu;1, ..., &mu;q be those of B (listed according to multiplicity). Then the eigenvalues of A $$\otimes$$ B are
 * $$ \lambda_i \mu_j, \qquad i=1,\ldots,n ,\, j=1,\ldots,q. $$

It follows that the trace and determinant of a Kronecker product are given by
 * $$ \operatorname{tr}(A \otimes B) = \operatorname{tr} A \, \operatorname{tr} B \quad\mbox{and}\quad \det(A \otimes B) = (\det A)^q (\det B)^n. $$

Singular values
If A and B are rectangular matrices, then one can consider their singular values. Suppose that A has rA nonzero singular values, namely
 * $$ \sigma_{A,i}, \qquad i = 1, \ldots, r_A. $$

Similarly, denote the nonzero singular values of B by
 * $$ \sigma_{B,i}, \qquad i = 1, \ldots, r_B. $$

Then the Kronecker product A $$\otimes$$ B has rArB nonzero singular values, namely
 * $$ \sigma_{A,i} \sigma_{B,j}, \qquad i=1,\ldots,r_A ,\, j=1,\ldots,r_B. $$

Since the rank of a matrix equals the number of nonzero singular values, we find that
 * $$ \operatorname{rank}(A \otimes B) = \operatorname{rank} A \, \operatorname{rank} B. $$

Relation to the abstract tensor product
The Kronecker product of matrices corresponds to the abstract tensor product of linear maps. Specifically, if the matrices A and B represent linear transformations V1 &rarr; W1 and V2 &rarr; W2, respectively, then the matrix A $$\otimes$$ B represents the tensor product of the two maps, V1 $$\otimes$$ V2 &rarr; W1 $$\otimes$$ W2.

Relation to products of graphs
The Kronecker product of the adjacency matrices of two graphs is the adjacency matrix of the tensor product graph. The Kronecker sum of the adjacency matrices of two graphs is the adjacency matrix of the Cartesian product graph. See, answer to Exercise 96.

Transpose
The operation of transposition is distributive over the Kronecker product:
 * $$(A\otimes B)^T = A^T \otimes B^T.$$

Matrix equations
The Kronecker product can be used to get a convenient representation for some matrix equations. Consider for instance the equation AXB = C, where A, B and C are given matrices and the matrix X is the unknown. We can rewrite this equation as
 * $$ (B^\top \otimes A) \, \operatorname{vec}(X) = \operatorname{vec}(AXB) = \operatorname{vec}(C). $$

It now follows from the properties of the Kronecker product that the equation AXB = C has a unique solution if and only if A and B are nonsingular.

Here, vec(X) denotes the vectorization of the matrix X formed by stacking the columns of X into a single column vector.

If X is row-ordered into the column vector x then $$ AXB $$ can be also be written as $$ (A \otimes B^\top)x $$

History
The Kronecker product is named after Leopold Kronecker, even though there is little evidence that he was the first to define and use it. Indeed, in the past the Kronecker product was sometimes called the Zehfuss matrix, after Johann Georg Zehfuss.

Related matrix operators
Two related matrix operators are the Tracy-Singh and Khatri-Rao products which operate on partitioned matrices. Let the $$m$$-by-$$n$$ matrix $$A$$ be partitioned into the $$m_i$$-by-$$n_j$$ blocks $$A_{ij}$$ and $$p$$-by-$$q$$ matrix $$B$$ into the $$p_k$$-by-$$q_l$$ blocks Bkl with of course $$ \Sigma_i m_i = m$$, $$\Sigma_j n_j = n$$, $$\Sigma_k p_k = p$$ and $$ \Sigma_l q_l = q .$$ We then define the Tracy-Singh product to be
 * $$ A \circ B = (A_{ij}\circ B)_{ij} = ((A_{ij} \otimes B_{kl})_{kl})_{ij}$$

which means that the $$(ij)$$th subblock of the $$mp$$-by-$$nq$$ product $$ A\circ B$$ is the $$m_i p$$-by-$$n_j q$$ matrix $$A_{ij} \circ B$$, of wich the $$(kl)$$th subblock equals the $$m_i p_k$$-by-$$n_j q_l$$ matrix $$A_{ij} \otimes B_{kl}$$. For example, if $$A$$ and $$B$$ both are $$2$$-by-$$2$$ partitioned matrices e.g.:
 * $$ A =

\left[ \begin{array} {c | c} A_{11} & A_{12} \\ \hline A_{21} & A_{22} \end{array} \right] = \left[ \begin{array} {c c | c} 1 & 2 & 3 \\ 4 & 5 & 6 \\ \hline 7 & 8 & 9 \end{array} \right] ,\quad B = \left[ \begin{array} {c | c} B_{11} & B_{12} \\ \hline B_{21} & B_{22} \end{array} \right] = \left[ \begin{array} {c | c c} 1 & 4 & 7 \\ \hline 2 & 5 & 8 \\ 3 & 6 & 9 \end{array} \right] , $$ we get:

A \circ B = \left[ \begin{array} {c | c} A_{11} \circ B & A_{12} \circ B \\ \hline A_{21} \circ B & A_{22} \circ B \end{array} \right] = \left[ \begin{array} {c | c | c | c } A_{11} \otimes B_{11} & A_{11} \otimes B_{12} & A_{12} \otimes B_{11} & A_{12} \otimes B_{12} \\ \hline A_{11} \otimes B_{21} & A_{11} \otimes B_{22} & A_{12} \otimes B_{21} & A_{12} \otimes B_{22} \\ \hline A_{21} \otimes B_{11} & A_{21} \otimes B_{12} & A_{22} \otimes B_{11} & A_{22} \otimes B_{12} \\ \hline A_{21} \otimes B_{21} & A_{21} \otimes B_{22} & A_{22} \otimes B_{21} & A_{22} \otimes B_{22} \end{array} \right] $$

= \left[ \begin{array} {c c | c c c c | c | c c} 1 & 2 & 4 & 7 & 8 & 14 & 3 & 12 & 21 \\ 4 & 5 & 16 & 28 & 20 & 35 & 6 & 24 & 42 \\ \hline 2 & 4 & 5 & 8 & 10 & 16 & 6 & 15 & 24 \\ 3 & 6 & 6 & 9 & 12 & 18 & 9 & 18 & 27 \\ 8 & 10 & 20 & 32 & 25 & 40 & 12 & 30 & 48 \\ 12 & 15 & 24 & 36 & 30 & 45 & 18 & 36 & 54 \\ \hline 7 & 8 & 28 & 49 & 32 & 56 & 9 & 36 & 63 \\ \hline 14 & 16 & 35 & 56 & 40 & 64 & 18 & 45 & 72 \\ 21 & 24 & 42 & 63 & 48 & 72 & 27 & 54 & 81 \end{array} \right] $$

The Khatri-Rao product is defined as
 * $$ A \ast B = (A_{ij}\otimes B_{ij})_{ij}$$

in which the $$(ij)$$th block is the $$m_ip_i$$-by-$$n_jq_j$$-sized Kronecker product of the corresponding blocks of $$A$$ and $$B$$, assuming that the 'horizontal' and 'vertical' number of subblocks of both matrices is equal. The size of the product is then $$\Sigma_i m_ip_i$$-by-$$\Sigma_j n_jq_j$$. Proceeding with the same matrices as the previous example we obtain:

A \ast B = \left[ \begin{array} {c | c} A_{11} \otimes B_{11} & A_{12} \otimes B_{12} \\ \hline A_{21} \otimes B_{21} & A_{22} \otimes B_{22} \end{array} \right] = \left[ \begin{array} {c c | c c} 1 & 2 & 12 & 21 \\ 4 & 5 & 24 & 42 \\ \hline 14 & 16 & 45 & 72 \\ 21 & 24 & 54 & 81 \end{array} \right] $$

A column-wise Kronecker product,also called the Khatri-Rao product of two matrices assumes the partitions of the matrices as their columns. In this case $$m_1=m$$, $$p_1=p$$, $$n=q$$ and $$\forall j: n_j=p_j=1$$. The resulting product is a $$mp$$-by-$$n$$ matrix of which each column is the Kronecker product of the corresponding columns of $$A$$ and $$B$$. We can only use the matrices from the previous examples if we change the partitions:

C = \left[ \begin{array} { c | c | c} C_1 & C_2 & C_3 \end{array} \right] = \left[ \begin{array} {c | c | c} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right] ,\quad D = \left[ \begin{array} { c | c | c } D_1 & D_2 & D_3 \end{array} \right] = \left[ \begin{array} { c | c | c } 1 & 4 & 7 \\ 2 & 5 & 8 \\ 3 & 6 & 9 \end{array} \right] , $$ so that:

C \ast D = \left[ \begin{array} { c | c | c } C_1 \otimes D_1 & C_2 \otimes D_2 & C_3 \otimes D_3 \end{array} \right] = \left[ \begin{array} { c | c | c } 1 & 8 & 21 \\ 2 & 10 & 24 \\ 3 & 12 & 27 \\ 4 & 20 & 42 \\ 8 & 25 & 48 \\ 12 & 30 & 54 \\ 7 & 32 & 63 \\ 14 & 40 & 72 \\ 21 & 48 & 81 \end{array} \right] $$