Try To Calculator logoTry To Calculator

Tensor Product Calculator

Last updated: March 7, 20251 people find this calculator helpful
Loading calculator…

If you have just stumbled upon this bizarre matrix operation called matrix tensor product or Kronecker product of matrices, look for help no further — tensor product calculator is here to teach you all you need to know about:

  • What the Kronecker product is;
  • What the main properties of Kronecker product are;
  • How to calculate tensor product of 2x2 matrices by hand; and
  • What the most general Kronecker product formula looks like.

As a bonus, we'll explain the relationship between the abstract tensor product vs the Kronecker product of two matrices!

⚠️ The Kronecker product is not the same as the usual matrix multiplication! If you're interested in the latter, visit matrix multiplication calculator. To discover even more matrix products, try our most general matrix calculator.

What is the tensor product of matrices?

Matrix tensor product, also known as Kronecker product or matrix direct product, is an operation that takes two matrices of arbitrary size and outputs another matrix, which is most often much bigger than either of the input matrices.

Let's say the input matrices are:

  • AA with rArA rows and cAcA columns, and
  • BB with rBrB rows and cBcB columns.

The resulting matrix then has rArBrArB rows and cAcBcAcB columns.

🔎 In particular, we can take matrices with one row or one column, i.e., vectors (whether they are a column or a row in shape). In this case, we call this operation the vector tensor product.

How to calculate the Kronecker product?

Once we have a rough idea of what the tensor product of matrices is, let's discuss in more detail how to compute it. The Kronecker product is defined as the following block matrix:

AB=a11BarA1Ba1cABarAcABAB=a11BarA1Ba1cABarAcAB

Hence, calculating the Kronecker product of two matrices boils down to performing a number-by-matrix multiplication many times. As you surely remember, the idea is to multiply each term of the matrix by this number while keeping the matrix shape intact:

aijB=aijb11aijbrB1aijb1cBaijbrBcBaijB=aijb11aijbrB1aijb1cBaijbrBcB

Tensor product of 2x2 matrices

Let's discuss what the Kronecker product is in the case of 2x2 matrices to make sure we really understand everything perfectly. Suppose that

A=[a11a21a12a22], B=[b11b21b12b22]A=[a11a21a12a22], B=[b11b21b12b22]

As we saw above, we have:

AB=[a11Ba21Ba12Ba22B]AB=[a11Ba21Ba12Ba22B]

Writing the terms of BB explicitly, we obtain:

AB=a11[b11b21b12b22]a21[b11b21b12b22]a12[b11b21b12b22]a22[b11b21b12b22]AB=a11[b11b21b12b22]a21[b11b21b12b22]a12[b11b21b12b22]a22[b11b21b12b22]

Performing the number-by-matrix multiplication, we arrive at the final result:

AB=a11b11a11b21a21b11a21b21a11b12a11b22a21b12a21b22a12b11a12b21a22b11a22b21a12b12a12b22a22b12a22b22AB=a11b11a11b21a21b11a21b21a11b12a11b22a21b12a21b22a12b11a12b21a22b11a22b21a12b12a12b22a22b12a22b22

Hence, the tensor product of 2x2 matrices is a 4x4 matrix. It is not hard at all, is it? But you can surely imagine how messy it'd be to explicitly write down the tensor product of much bigger matrices! Fortunately, there's a concise formula for the matrix tensor product — let's discuss it!

What is the formula for the Kronecker matrix product?

We can compute the element (AB)ij(AB)ij of the Kronecker product as:

ai/rB,j/cBb((i1)%rB+1),((j1)%cB+1)ai/rB,j/cBb((i1)%rB+1),((j1)%cB+1)

where xx is the ceiling function (i.e., it's the smallest integer that is greater than xx) and %% denotes the modulo operation. Recall also that rBrB and cBcB stand for the number of rows and columns of BB, respectively.

We have discussed two methods of computing tensor matrix product. There's a third method, and it is our favorite one — just use tensor product calculator!

How to use this tensor product calculator?

To compute the Kronecker product of two matrices with the help of our tool, just pick the sizes of your matrices and enter the coefficients in the respective fields.

⚠️ Be careful with the order of matrices — tensor product is not commutative, and generally, ABAB is not equal to BABA!

Properties of the Kronecker product

Associativity

Tensor matrix product is associative, i.e., for every A,B,CA,B,C we have

(AB)C=A(BC)(AB)C=A(BC)

Bilinearity

Tensor matrix product is also bilinear, i.e., it is linear in each argument separately:

(A+B)C=AC+BC,(xA)B=x(AB)(A+B)C=AC+BC,(xA)B=x(AB)

and

A(B+C)=AB+AC,A(xB)=x(AB)A(B+C)=AB+AC,A(xB)=x(AB)

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

(Conjugate) transposition

The transposition of the Kronecker product coincides with the Kronecker products of transposed matrices:

(AB)T=ATBT.(AB)T=ATBT.

The same is true for the conjugate transposition (i.e., adjoint matrices):

(AB)=AB.(AB)=AB.

Singular values and rank

💡 Don't worry if you're not yet familiar with the concept of singular values - feel free to skip this section or go to the singular values calculator.

If σ1,,σpAσ1,,σpA are non-zero singular values of AA and s1,,spBs1,,spB are non-zero singular values of BB, then the non-zero singular values of ABAB are σisjσisj with i=1,,pAi=1,,pA and j=1,,pBj=1,,pB.

Recall that the number of non-zero singular values of a matrix is equal to the rank of this matrix. In consequence, we obtain the rank formula:

rank(AB)=rank(A)rank(B)rank(AB)=rank(A)rank(B)

Inverse of tensor product

For the rest of this section, we assume that AA and BB are square matrices of size mm and nn, respectively.

If AA and BB are both invertible, then ABAB is invertible as well and

(AB)1=A1B1.(AB)1=A1B1.

Eigenvalues, trace, determinant

💡 Finding eigenvalues is yet another advanced topic. If you need a refresher, visit our eigenvalue and eigenvector calculator.

If α1,,αmα1,,αm and β1,,βnβ1,,βn are the eigenvalues of AA and BB (listed with multiplicities) respectively, then the eigenvalues of ABAB are of the form
αiβjαiβj with i=1,,mi=1,,m and j=1,,nj=1,,n.

Since the determinant corresponds to the product of eigenvalues and the trace to their sum, we have just derived the following relationships:

det(AB)=det(A)ndet(B)mdet(AB)=det(A)ndet(B)m
trace(AB)=trace(A)trace(B)trace(AB)=trace(A)trace(B)

FAQs

Is the Kronecker product associative?
Yes, the Kronecker matrix product is associative: (A ⊗ B) ⊗ C = A ⊗ (B ⊗ C) for all matrices A, B, C.
Is the Kronecker product commutative?
No, the Kronecker matrix product is not commutative: A ⊗ B ≠ B ⊗ A for some matrices A, B.
Is tensor product the same as Kronecker product?
The tensor product is a more general notion, but if we deal with finite-dimensional linear spaces, the matrix of the tensor product of two linear operators (with respect to the basis which is the tensor product of the initial bases) is given exactly by the Kronecker product of the matrices of these operators with respect to the initial bases.
How do I find the size of matrix tensor product?
To determine the size of tensor product of two matrices: Compute the product of the numbers of rows of the input matrices. Compute product of the numbers of columns of the input matrices. The output matrix will have as many rows as you got in Step 1, and as many columns as you got in Step 2. In particular, if you have matrices of the same size, the output matrix has its dimensions equal to the original dimensions squared.

Related calculators