Part I · Chapter 5

Tensor / Kronecker Product

Read ~20 min Prerequisites Ch. 1–4 Tools vector & matrix tensor builders, code cell Live

If you built anything in Ch. 3's two-qubit circuit widgets, you've already seen this sentence: "a tensor/Kronecker product, see Ch. 5." Here's the payoff. Every single-qubit gate you dragged onto one wire while leaving the other wire alone got silently expanded into a 4×4 matrix behind the scenes. This chapter is exactly how that expansion works, by hand.

Why two qubits need a new operation

A single qubit's state lives in a 2-entry vector. Naively, you might guess two qubits together need a 2+2 = 4-entry vector. They don't — they need 2×2 = 4. Combining independent systems multiplies dimensions, not adds them, and the operation that does this combining is the tensor product, written ⊗.

The Kronecker product of two vectors

For two 2-entry vectors a = (a₁,a₂) and b = (b₁,b₂), a⊗b stacks every possible pairwise product into a single 4-entry vector:

$$a\otimes b=\begin{bmatrix}a_1\\a_2\end{bmatrix}\otimes\begin{bmatrix}b_1\\b_2\end{bmatrix}=\begin{bmatrix}a_1b_1\\a_1b_2\\a_2b_1\\a_2b_2\end{bmatrix}$$
Fig. 5.1 — edit a and bwatch a⊗b assemble
a (treat as q1's state)
b (treat as q0's state)
Each output entry is one specific aᵢbⱼ product — there's no summing anywhere, unlike the inner product from Ch. 2. The four index labels are exactly the |00⟩, |01⟩, |10⟩, |11⟩ basis states from Ch. 3's two-qubit widgets.

This is where |00⟩, |01⟩, |10⟩, |11⟩ actually come from

Click the preset buttons above. |0⟩⊗|1⟩ gives (0,1,0,0) — index 1, which is exactly the |01⟩ row you watched light up in Ch. 3's probability charts. None of those four basis states were ever a separate definition; each one is just |0⟩ or |1⟩ tensored with |0⟩ or |1⟩, computed exactly the way Fig. 5.1 just computed it.

The Kronecker product of two matrices

Matrices tensor the same way, just with more entries. For 2×2 matrices A and B, A⊗B is a 4×4 matrix built by replacing every entry of A with that entry times the entire matrix B:

$$A\otimes B=\begin{bmatrix}a_{11}B&a_{12}B\\a_{21}B&a_{22}B\end{bmatrix}$$
Fig. 5.2 — edit A and B, or pick a presetA⊗B, by block
A (q1's gate)
B (q0's gate)
Each colored quadrant is one entry of A, scaling a whole copy of B. Try "I ⊗ X": this is the literal 4×4 matrix Ch. 3's circuit code built when you dragged X onto q0 alone — a single-qubit gate, tensored with identity on the untouched qubit.

Why CNOT can't be built this way

Try to find an A and B in Fig. 5.2 whose tensor product gives CNOT. You can't — and that's not a failure of the widget, it's the actual mathematical fact that makes CNOT special. CNOT is a genuinely 2-qubit operation that cannot be factored into "something happening to q1" ⊗ "something happening to q0." Composer's gate inspector mentioned this back in Ch. 3: CNOT's "control depends on the other qubit's value" behavior is precisely the kind of correlation a tensor product structurally cannot represent — which is exactly why CNOT (and not any single-qubit gate combination) is the gate that creates entanglement.

Fig. 5.3 — code, runs in your browser
np.kron is the function both Ch. 3's circuit code and this chapter's widgets compute by hand — same operation, now with a name.
Check your understanding

Why does combining two qubits give a 4-dimensional space rather than a 2-dimensional one?

Combining independent systems multiplies their dimensions rather than adding them — 2 × 2 = 4. That multiplicative scaling is exactly what the tensor product computes.

Check your understanding

What is (1,1)/√2 ⊗ (0,1) — i.e. |+⟩ ⊗ |1⟩?

(0, 1/√2, 0, 1/√2) — each entry of the first vector multiplies the whole second vector: (1/√2)(0,1) then (1/√2)(0,1), interleaved as (1/√2·0, 1/√2·1, 1/√2·0, 1/√2·1).

Check your understanding

If you want to apply gate G to q1 only, leaving q0 untouched, what matrix do you actually multiply the 4-entry state by?

G ⊗ I — G tensored with the identity on q0's side, matching the convention where the first kron factor corresponds to the more significant qubit.

Check your understanding

Why can't CNOT be written as A⊗B for any single-qubit matrices A and B?

A tensor product A⊗B can only represent independent actions on each qubit — what happens to one qubit can never depend on the other's value. CNOT's entire definition is "flip the target depending on the control," which a tensor product structurally cannot encode. That's exactly why CNOT creates entanglement and single-qubit-gate combinations never can.

Check your understanding

In A⊗B for 2×2 matrices, how many total entries does the result have, and how is each one computed?

16 entries (4×4). Each block is one entry of A times the entire matrix B — so entry (row, col) of the result is A[i][j]·B[p][q] for the appropriate i,j,p,q determined by which block and position within that block it falls in.

Review queue

Scroll back to a chapter's quiz cards to review them once they're due — a full cross-chapter queue view is a planned upgrade.