# Tensor Product 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 — Omni's **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 Omni's matrix multiplication 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:

- $A$ with $r_A$ rows and $c_A$ columns, and
- $B$ with $r_B$ rows and $c_B$ columns.

The resulting matrix then has $r_A \cdot r_B$ rows and $c_A \cdot c_B$ 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**:

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:

## 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

As we saw above, we have:

Writing the terms of $B$ explicitly, we obtain:

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

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 $(A\otimes B)_{ij}$ of the Kronecker product as:

where $\lceil x \rceil$ is the ceiling function (i.e., it's the smallest integer that is greater than $x$) and $\%$ denotes the modulo operation. Recall also that $r_B$ and $c_B$ stand for the number of rows and columns of $B$, respectively.

We have discussed two methods of computing tensor matrix product. There's a third method, and it is our favorite one — just use Omni's 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.

🙋 Oops, you've messed up the order of matrices? No worries — our tensor product calculator allows you to choose whether you want to multiply $A \otimes B$ or $B \otimes A$. Enjoy!

## Properties of the Kronecker product

#### Associativity

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

#### Bilinearity

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

and

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

#### (Conjugate) transposition

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

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

#### Singular values and rank

If $\sigma_1, \ldots, \sigma_{p_A}$ are **non-zero** singular values of $A$ and $s_1, \ldots, s_{p_B}$ are **non-zero** singular values of $B$, then the **non-zero** singular values of $A \otimes B$ are $\sigma_{i}s_j$ with $i=1, \ldots, p_{A}$ and $j=1, \ldots, p_{B}$.

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:

#### Inverse of tensor product

For the rest of this section, we assume that $A$ and $B$ are square matrices of size $m$ and $n$, respectively.

If $A$ and $B$ are both invertible, then $A\otimes B$ is invertible as well and

#### Eigenvalues, trace, determinant

If $\alpha_1, \ldots, \alpha_m$ and $\beta_1, \ldots, \beta_n$ are the eigenvalues of $A$ and $B$ (listed with multiplicities) respectively, then the eigenvalues of $A \otimes B$ are of the form

$\alpha_{i}\beta_{j}$ with $i=1,\ldots ,m$ and $j=1,\ldots ,n$.

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

## FAQ

### 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.