Advertisement
Advertisement
LINEAR ALGEBRA

Tensor Product Calculator — the Kronecker product of two matrices

Enter two matrices or vectors of any shape and get their tensor product, written out block by block with its dimensions and norm.

One row per line, entries separated by spaces or commas. A single line is a row vector; one number per line is a column vector.
Any shape. Unlike matrix multiplication, the tensor product places no compatibility condition on the two shapes.
Switch the order to see for yourself that the tensor product is not commutative — the two results are permutation-equivalent but rarely equal.
Result dimensions
 
Rows in the result
Columns in the result
Entries
Frobenius norm
Result:
Advertisement

The tensor product calculator computes the Kronecker product of two matrices — the block matrix formed by multiplying every entry of the first matrix by the whole of the second. It is the concrete, coordinate-level realisation of the tensor product of two linear maps, and it turns up wherever two independent systems have to be described together: quantum state spaces, image filters written as separable kernels, signal processing, statistics, and the algebra behind many fast transforms.

Arb Digital publishes it as part of a free linear algebra library that already covers inversion, rank and the cofactor matrix. This page handles the one operation that grows a matrix rather than reducing it, and it does so for any pair of shapes, because the tensor product imposes no compatibility condition at all.

What This Tensor Product Calculator Does

Paste two matrices, one row per line, and the tool returns the full Kronecker product written out, together with its dimensions, its entry count and its Frobenius norm. Vectors are just matrices with one row or one column, so the same input box handles the tensor product of two vectors without any special mode.

Because the result of even modest inputs is large — a 3×3 with a 3×3 gives a 9×9 with 81 entries — the dimension readout is deliberately the headline figure. It is the number people get wrong most often when they first meet the operation.

This is a distinct job from the tools we already publish. The matrix calculator handles ordinary addition and multiplication, where inner dimensions must agree; the dot product calculator collapses two vectors to a scalar and the cross product calculator returns a vector in three dimensions. The tensor product does the opposite of all three: it enlarges.

How to Use It

  1. Type or paste matrix A with one row per line. Separate entries with spaces, tabs or commas.
  2. Type or paste matrix B in the same format. It does not have to match A in either dimension.
  3. Choose the order. A ⊗ B and B ⊗ A are different matrices; the selector lets you compare them.
  4. Set the decimal places if your entries are not whole numbers.
  5. Read the block structure in the result panel: each block is one entry of the first matrix times the whole of the second.

The Formula

If A is m×n and B is p×q, the Kronecker product A ⊗ B is the (mp)×(nq) matrix built by replacing each entry aij of A with the block aijB. Wolfram MathWorld states it entrywise in its entry on the Kronecker product, indexing the result so that the entry in position (α, β) equals aijbkl with α = p(i−1)+k and β = q(j−1)+l.

A worked example is the fastest way to see it. Take A = [[1, 2], [3, 4]] and B = [[0, 5], [6, 7]]. The top-left block is 1×B = [[0, 5], [6, 7]]; the top-right is 2×B = [[0, 10], [12, 14]]; the bottom-left is 3×B = [[0, 15], [18, 21]]; the bottom-right is 4×B = [[0, 20], [24, 28]]. Assembled, the 4×4 result reads 0 5 0 10 / 6 7 12 14 / 0 15 0 20 / 18 21 24 28. Those are the default values in the calculator, so you can check the arithmetic against this paragraph directly.

Advertisement

Why the Frobenius Norm Is Reported

The Frobenius norm — the square root of the sum of the squares of every entry — is multiplicative across the tensor product. The norm of A ⊗ B is exactly the norm of A times the norm of B, which gives you a cheap independent check that the tool has assembled the blocks correctly.

In the worked example above, A has Frobenius norm √30 and B has √110. Their product is √3300, roughly 57.4456, and summing the squares of all sixteen entries of the result gives 3300 exactly. If you ever build a Kronecker product by hand and this identity fails, you have misplaced a block.

Tensor Product Versus Tensor Product

The phrase is used at two levels and conflating them causes real confusion. Abstractly, the tensor product of two vector spaces V and W is a new space V ⊗ W whose dimension is the product of the two dimensions, as MathWorld sets out under vector space tensor product. Concretely, once you fix bases for both spaces, the matrix of the tensor product of two linear maps in the induced basis is the Kronecker product of their matrices.

So the Kronecker product is not an approximation of the tensor product or a special case of it; it is the tensor product expressed in coordinates. What the coordinate version adds is an ordering convention, and that convention matters: reverse it and you get B ⊗ A, which is the same operator seen through a permuted basis.

The Properties Worth Memorising

Four identities do most of the work in practice. The mixed-product property says (A ⊗ B)(C ⊗ D) = AC ⊗ BD whenever the ordinary products are defined — this is the reason Kronecker structure survives composition and why it is so useful computationally. The transpose distributes: (A ⊗ B)ₜ = Aₜ ⊗ Bₜ. So does the inverse, when both factors are invertible: (A ⊗ B)⁻¹ = A⁻¹ ⊗ B⁻¹. And rank is multiplicative: rank(A ⊗ B) = rank(A) × rank(B), which you can sanity-check against the matrix rank calculator on the two factors.

For square factors there are two more that people reach for constantly. The trace is multiplicative, and the determinant of an n×n tensored with an m×m is det(A)m det(B)n. Note the exponents cross over; getting them the wrong way round is a classic slip, and the matrix inverse calculator is a quick way to test a small case.

Where the Result Size Bites

Tensor products grow multiplicatively in both directions, so the entry count grows as the product of four numbers. Two 10×10 matrices give a 100×100 result with ten thousand entries. Three 4×4 matrices tensored together give a 64×64 with over four thousand. This is exactly why quantum state spaces become computationally hopeless so quickly: n two-level systems live in a space of dimension 2ⁿ, and that 2ⁿ is a repeated tensor product.

The practical response in numerical work is never to form the product at all. The mixed-product property lets you apply A ⊗ B to a vector by reshaping the vector into a matrix and multiplying by A and B separately, which costs far less than building the big matrix. This calculator does form the result, because seeing the block structure is the point of a teaching tool, so keep the inputs modest.

Reading the Block Structure

The result panel prints the product as a plain grid, but it is worth training your eye to see it as a grid of grids. If A is 2×3 and B is 4×4, the answer is 8×12 and it divides into six blocks of 4×4, laid out two blocks tall and three blocks wide, matching the shape of A exactly. Every block is a scaled copy of B, and the scale factor is the corresponding entry of A.

That reading makes several facts obvious that look mysterious in index notation. A zero entry in A produces an entire zero block, which is why a sparse first factor gives a very sparse product. Repeated entries in A produce identical blocks, so any symmetry in A is inherited as a block-level symmetry in the result. And if B is the identity matrix, the product is A with each entry spread along a diagonal of its block, which is the standard trick for lifting an operator to act on one component of a composite system while leaving the other untouched. Set B to a small identity in the calculator and the pattern is immediately visible.

Numerical Caveats

The arithmetic here is elementwise multiplication only, so it is as accurate as double-precision floating point allows and involves no accumulation of rounding across a long chain. That makes the Kronecker product unusually well behaved compared with, say, an inversion or an eigendecomposition.

Two things still deserve care. First, the condition number of A ⊗ B is the product of the two condition numbers, so tensoring two mildly ill-conditioned matrices produces a badly conditioned one. Second, if your entries span very different magnitudes, the products span the square of that range, and the display rounding you choose can hide small but structurally important entries. Increase the decimal places before concluding an entry is zero.

Need technical content that experts do not roll their eyes at?

Arb Digital builds free reference tools and explainers that earn search traffic because the mathematics is right. Browse the library, or tell us what your readers keep searching for.

Browse Free Tools Talk to Arb Digital

Common Mistakes to Avoid

  • Assuming the shapes must be compatible. They never do — any m×n tensors with any p×q.
  • Treating A ⊗ B and B ⊗ A as the same matrix. They are related by a permutation, not equal.
  • Confusing it with the elementwise (Hadamard) product, which requires identical shapes and returns a matrix of that same shape.
  • Swapping the exponents in the determinant identity — the exponent on det(A) is the size of B, not of A.
  • Forming the full product in code when the mixed-product property would let you avoid ever building it.

Related Free Tools From Arb Digital

Use the matrix calculator for ordinary products and sums, the matrix rank calculator to verify that rank multiplies, the cofactor matrix calculator for the adjugate route to inverses, the vector calculator for basic vector arithmetic, and the matrix norm calculator to check the multiplicative Frobenius identity. The free online tools hub lists every linear algebra tool we publish.

Frequently Asked Questions

Is the tensor product the same as the Kronecker product?

For matrices, yes. The Kronecker product is the tensor product of two linear maps written out in the basis induced by the bases of the two spaces. The abstract tensor product is basis-free; the Kronecker product is what it looks like in coordinates.

Do the two matrices need matching dimensions?

No. Any m by n matrix can be tensored with any p by q matrix, and the result is mp by nq. This is one of the main differences from ordinary matrix multiplication.

Is the tensor product commutative?

No. A tensor B and B tensor A contain the same set of products but arranged differently, so they are equal only in special cases. They are always related by permutation matrices acting on rows and columns.

How do I take the tensor product of two vectors?

Enter each vector as a matrix with one row or one column. A column of length m tensored with a column of length n gives a column of length mn, in which the entries run through every pairwise product.

What is the rank of a Kronecker product?

The product of the ranks of the two factors. This means a tensor product with a rank-one factor is itself rank-deficient no matter how well conditioned the other factor is.

Why is the result so large?

Both dimensions multiply, so the entry count is the product of four numbers. Two ten-by-ten matrices already produce a hundred-by-hundred result with ten thousand entries, which is why repeated tensoring becomes intractable quickly.

Can I check the answer without redoing it by hand?

Yes. The Frobenius norm of the result must equal the product of the Frobenius norms of the two factors. The calculator reports that norm so you can test the identity on your own inputs.

Advertisement
Advertisement

Take it further