Ugly Duckling Theorem Calculator
Explore the Ugly Duckling Theorem with binary feature vectors. Compare objects using Hamming distance, shared features, Jaccard similarity, and matching coefficients. Includes preset examples, feat...
Compute the tensor (Kronecker) product of two matrices with step-by-step block decomposition, heatmap visualization, dimension analysis, and property verification table.
A (2×2)
| 1.0000 | 2.0000 |
| 3.0000 | 4.0000 |
B (2×2)
| 5.0000 | 6.0000 |
| 7.0000 | 8.0000 |
| 5.0000 | 6.0000 | 10.0000 | 12.0000 |
| 7.0000 | 8.0000 | 14.0000 | 16.0000 |
| 15.0000 | 18.0000 | 20.0000 | 24.0000 |
| 21.0000 | 24.0000 | 28.0000 | 32.0000 |
| Block Position | Scalar × B | Block Result |
|---|---|---|
| A[1,1]·B = 1.0000·B | 5.00, 6.00 | 7.00, 8.00 | 4 elements |
| A[1,2]·B = 2.0000·B | 10.00, 12.00 | 14.00, 16.00 | 4 elements |
| A[2,1]·B = 3.0000·B | 15.00, 18.00 | 21.00, 24.00 | 4 elements |
| A[2,2]·B = 4.0000·B | 20.00, 24.00 | 28.00, 32.00 | 4 elements |
| Property | Formula | Verified |
|---|---|---|
| Dimensions | (m₁·m₂) × (n₁·n₂) | (2·2) × (2·2) = 4×4 ✓ |
| Trace | tr(A⊗B) = tr(A)·tr(B) | 65.0000 = 5.0000·13.0000 = 65.0000 ✓ |
| Bilinear | (cA)⊗B = c(A⊗B) | Scalar factors out of either matrix |
| Mixed-product | (A⊗B)(C⊗D) = (AC)⊗(BD) | When dimensions match for AC and BD |
| Not commutative | A⊗B ≠ B⊗A in general | Order matters unless both are scalars |
The tensor product — also called the Kronecker product when applied to finite matrices — is a fundamental operation in linear algebra, physics, and computer science. Given an m×n matrix A and a p×q matrix B, the Kronecker product A⊗B is the large mp×nq block matrix formed by replacing each entry aᵢⱼ of A with the scalar multiple aᵢⱼ·B. The result captures every possible pairwise product of entries from A and B, arranged in a structured block format.
In quantum computing, the tensor product is used to combine individual qubit states and gate operations into multi-qubit systems. The Hadamard gate ⊗ I₂ creates the two-qubit gate that applies Hadamard to the first qubit and identity to the second. In physics, tensors describe stress, strain, and electromagnetic fields. In signal processing, Kronecker products appear in multi-dimensional filtering and separable transforms.
This calculator handles matrices up to 6×6, computes the full Kronecker product, and verifies key algebraic properties: the trace identity tr(A⊗B) = tr(A)·tr(B), bilinearity, the mixed-product property, and the non-commutativity warning. A color-coded heatmap visualizes the magnitude of each entry in the result, and the step-by-step table shows how each block aᵢⱼ·B contributes to the final matrix. Six presets — including identity, Pauli matrices, Hadamard, and non-square examples — let you explore immediately.
The Kronecker product of even small matrices produces a large block matrix that is laborious to fill in by hand — a 3×3 ⊗ 3×3 yields 81 entries. This calculator builds the result, showing the block structure so you can see how each aᵢⱼ·B sub-block maps into the output. It also computes key properties — trace, Frobenius norm, eigenvalues (for square inputs), and rank — and verifies identities like tr(A⊗B) = tr(A)·tr(B). Quantum-computing students use it to build multi-qubit gates, while linear-algebra courses use it to explore the mixed-product property.
(A ⊗ B)_{(i-1)p+k, (j-1)q+l} = A_{i,j} · B_{k,l}
Result dimensions: (m·p) × (n·q) for A(m×n) and B(p×q)
tr(A⊗B) = tr(A)·tr(B)
‖A⊗B‖_F = ‖A‖_F · ‖B‖_F
(A⊗B)(C⊗D) = (AC)⊗(BD)Result: 4×4 matrix: [[5,6,10,12],[7,8,14,16],[15,18,20,24],[21,24,28,32]]
Block (1,1) = 1·B = [[5,6],[7,8]]. Block (1,2) = 2·B = [[10,12],[14,16]]. Block (2,1) = 3·B = [[15,18],[21,24]]. Block (2,2) = 4·B = [[20,24],[28,32]]. Assembled into a 4×4 matrix.
The Kronecker product A ⊗ B replaces each entry aᵢⱼ of A with the scalar multiple aᵢⱼ·B, forming a block matrix. If A is m×n and B is p×q, the result is (mp)×(nq). For the 2×2 example [[1,2],[3,4]] ⊗ [[5,6],[7,8]], the four 2×2 blocks are 1·B, 2·B, 3·B, and 4·B, assembled into a 4×4 matrix. Visualising this block structure is the fastest route to understanding tensor products.
The Kronecker product is bilinear and associative but NOT commutative. The mixed-product property (A⊗B)(C⊗D) = (AC)⊗(BD) is the most powerful computational shortcut — it lets you decompose large Kronecker-structured systems into smaller factor problems. Other identities include tr(A⊗B) = tr(A)·tr(B), det(A⊗B) = det(A)^q · det(B)^m (for square matrices), and ‖A⊗B‖_F = ‖A‖_F · ‖B‖_F.
In quantum computing, the state of a two-qubit system is the tensor product of the individual qubit states: |ψ⟩ ⊗ |φ⟩. Gates that act on the composite system are built the same way: CNOT is not a simple Kronecker product, but identity and single-qubit gates are (I ⊗ H applies Hadamard to the second qubit). Beyond quantum, Kronecker products appear in multilinear algebra, image processing (separable filters), and the vectorization of matrix equations (vec(AXB) = (Bᵀ ⊗ A) vec(X)).
Last updated:
For finite-dimensional matrices, they are the same operation. "Tensor product" is the abstract algebraic concept; "Kronecker product" is its concrete matrix form.
No — matrix multiplication requires compatible inner dimensions and sums products, while the Kronecker product always works and produces a larger block matrix.
Multi-qubit systems are described by tensor products of individual qubit state vectors and gate operators. A two-qubit gate is a 4×4 matrix built from two 2×2 gates via ⊗.
No — A⊗B and B⊗A generally differ. However, they are related by a permutation (the "perfect shuffle" matrices).
If A is m×n and B is p×q, then A⊗B is (m·p)×(n·q).
Yes — unlike many matrix operations, the Kronecker product works for any pair of matrices regardless of shape.
(A⊗B)(C⊗D) = (AC)⊗(BD), provided AC and BD are defined. This is extremely useful for simplifying tensor expressions.
Explore the Ugly Duckling Theorem with binary feature vectors. Compare objects using Hamming distance, shared features, Jaccard similarity, and matching coefficients. Includes preset examples, feat...
Interactive explorer of 12 real-world modulo applications: clock arithmetic, even/odd, cyclic indexing, day of week, hashing, digit extraction, color cycling, leap year, and more.
Solve systems of 2 or 3 congruences with the Chinese Remainder Theorem. Normalize residues, merge non-coprime systems, verify every modulus, and list the full solution family.