Tensor Products
Tensor Products
How do we describe two qubits? Not as a pair of separate vectors — as a single vector in a larger space, the tensor product. This one construction explains the exponential dimension of quantum state spaces (, not ), is the precise origin of entanglement, and is the reason simulating quantum systems is hard classically. It is the capstone of Course 0.1 and the direct gateway to multi-qubit quantum mechanics.
Learning Objectives
After this lesson you will be able to:
- Construct the tensor product and its basis, and explain why multiplies.
- Compute tensor products of vectors and operators via the Kronecker product.
- Apply the mixed-product identity .
- Distinguish product (separable) from entangled states.
- Map all of this to multi-qubit registers in NumPy and (preview) AWS Braket, respecting big-endian ordering.
Intuition
If system can be in any of basis states and system in any of , the joint system can be in any combination — there are such combinations, and the joint state space is their span. Crucially, the joint space contains not just the "both definite" combinations but all superpositions of them, including ones that cannot be pulled apart into "a state of " times "a state of ." Those inseparable states are entangled — the resource behind teleportation, dense coding, and quantum speedups. The tensor product is the machinery that makes "all superpositions of joint configurations" precise.
The dimension count is the headline: qubits ⇒ . Ten qubits already need a -dimensional complex vector; fifty qubits exceed the memory of any classical computer. That exponential is both the promise and the simulation difficulty of quantum computing.
Theory
Definition
Given finite-dimensional spaces (dim , basis ) and (dim , basis ), the tensor product is the -dimensional space with basis the formal symbols
The product is bilinear:
and likewise in the second slot. A general element is — note the coefficients form a matrix , not two separate vectors. Hence
For qubits, .
Inner product on the tensor product
Inner products factor on product vectors and extend bilinearly:
So is orthonormal when each factor basis is: $\langle i j| i' j'\rangle = \delta_{ii'}\delta_{jj'}\mathcal{H}_A\otimes\mathcal{H}_B$ a Hilbert space.
The Kronecker product (coordinates)
In coordinates the tensor product is the Kronecker product. For vectors,
i.e. "scale the whole second vector by each component of the first, stacked." For the qubit basis (our big-endian convention, qubit 0 first — Appendix C):
The index of is the integer whose binary digits are — exactly how Braket labels amplitudes and reports bit-strings.
Tensor products of operators
If acts on and on , then acts on the product space by
with matrix the Kronecker product of the matrices. "Local" operations are tensor products: applying gate to qubit 0 and leaving qubit 1 alone is . The single most useful algebra rule:
proved by acting on product vectors: both sides send to , and linearity extends it to all vectors. Consequences: ; tensor of unitaries is unitary; eigenvalues multiply (if , then $(A\otimes B)(|u\rangle\otimes|v\rangle) = ab,|u\rangle\otimes|v\rangle\operatorname{Tr}(A\otimes B) = \operatorname{Tr}(A)\operatorname{Tr}(B)$.
Product vs entangled states
A joint pure state is a product (separable) state if it factors:
Otherwise it is entangled. The canonical example is the Bell state
which cannot be written as . Proof of inseparability. Expanding the product gives coefficients $\alpha\gamma,|00\rangle + \alpha\delta,|01\rangle + \beta\gamma,|10\rangle + \beta\delta,|11\rangle|\Phi^+\rangle$ requires and (no ) but $\alpha\gamma = \beta\delta = \tfrac1{\sqrt2}\neq0\alpha\delta = 0\alpha=0\alpha\gamma$) or (killing ) — contradiction either way. So no factorization exists. ∎
Separability test via the coefficient matrix. Write and form the matrix . The state is a product state iff . The number of nonzero singular values of (the Schmidt rank) quantifies entanglement — developed in Term 1.4 · Schmidt Decomposition. For , has rank ⇒ entangled.
Partial trace (preview)
To describe just subsystem of a joint state, we "trace out" with the partial trace , defined by $\operatorname{Tr}_B(|a\rangle\langle a'|\otimes |b\rangle\langle b'|) = |a\rangle\langle a'|,\langle b'|b\rangle$ and linear extension. For an entangled pure state this yields a mixed — the signature of entanglement. We make this precise in Term 1.5 · Partial Trace; it's flagged here so you know where leads.
Worked Examples
Example 1 — Building a two-qubit state and applying a local gate
Prepare and then apply to qubit 1 (i.e. ).
Apply (flip qubit 1): , so each ket's second slot flips:
Still a product state — local gates never create entanglement; you need a genuinely two-qubit gate like CNOT (Term 2.1) for that.
Example 2 — CNOT turns a product state into a Bell state
Recall CNOT (control = qubit 0) acts as . Start from :
The input was separable; the output is the maximally entangled Bell state (we proved it's non-factorable above). This two-line computation is the heart of Bell-state preparation, which you'll run on Braket in Term 2.
Hands-on (Python)
import numpy as np
from functools import reduce
ket0 = np.array([1, 0], dtype=complex)
ket1 = np.array([0, 1], dtype=complex)
def tensor(*ops):
"""Kronecker product of any number of vectors/operators (big-endian: first arg = qubit 0)."""
return reduce(np.kron, ops)
# Two-qubit basis states:
ket00 = tensor(ket0, ket0) # [1,0,0,0]
ket11 = tensor(ket1, ket1) # [0,0,0,1]
print(ket00, ket11)
# Local gate on qubit 1 of a 2-qubit register is I ⊗ X:
I = np.eye(2, dtype=complex)
X = np.array([[0, 1], [1, 0]], dtype=complex)
plus = (ket0 + ket1) / np.sqrt(2)
state = tensor(plus, ket0)
print(np.round(tensor(I, X) @ state, 3)) # |+>|1> = (|01>+|11>)/√2# CNOT (control=qubit 0) and Bell-state creation:
CNOT = np.array([[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0]], dtype=complex)
bell = CNOT @ tensor(plus, ket0)
print(np.round(bell, 3)) # [0.707, 0, 0, 0.707] = |Φ+>
# Mixed-product identity (A⊗B)(C⊗D) = AC⊗BD:
A, B, C, D = X, I, I, X
lhs = tensor(A, B) @ tensor(C, D)
rhs = tensor(A @ C, B @ D)
print(np.allclose(lhs, rhs)) # True# Separability test via the coefficient matrix's rank (Schmidt rank):
def schmidt_rank(state_2q):
C = state_2q.reshape(2, 2) # c_{ij} for a 2-qubit state
return np.linalg.matrix_rank(C, tol=1e-9)
print(schmidt_rank(tensor(plus, ket0))) # 1 -> product (separable)
print(schmidt_rank(bell)) # 2 -> entangledBraket preview. In Term 2 you'll write
Circuit().h(0).cnot(0, 1)and the simulator returns a length- amplitude vector indexed exactly astensor(...)produces here (big-endian). Everything a multi-qubit simulator does is Kronecker products and matrix–vector multiplication on this space.
Exercises
E1 (easy). Compute as a 4-vector and identify which computational basis kets appear.
Solution
$|1\rangle\otimes\tfrac1{\sqrt2}(|0\rangle+|1\rangle) = \tfrac1{\sqrt2}(|10\rangle + |11\rangle) = \tfrac1{\sqrt2}(0,0,1,1)^T|10\rangle|11\rangle$ appear, each with amplitude .
E2 (easy). Show of qubits is and compute it for . Why does this make classical simulation hard?
Solution
Each qubit contributes a factor of , so : , , . Storing a 50-qubit complex state vector needs bytes PB — infeasible. The exponential dimension is why classical simulation blows up (and motivates tensor-network methods like Braket's TN1 for structured cases — Term 5.2).
E3 (medium). Prove the mixed-product identity by acting on an arbitrary product vector, then argue it holds on all vectors.
Solution
On a product vector: $(A\otimes B)(C\otimes D)(|\psi\rangle\otimes|\phi\rangle) = (A\otimes B)(C|\psi\rangle\otimes D|\phi\rangle) = AC|\psi\rangle\otimes BD|\phi\rangle = (AC\otimes BD)(|\psi\rangle\otimes|\phi\rangle)$. Product vectors form a basis, and both sides are linear operators agreeing on a basis, so they are equal everywhere. ∎
E4 (medium). Determine whether is entangled. Factor it if separable.
Solution
Coefficient matrix C = \tfrac12\begin{psmallmatrix}1&1\\1&1\end{psmallmatrix} has rank ⇒ separable. Factor: . (Equal superposition over all bit-strings is just — not entangled.)
E5 (hard). Prove the separability ⟺ rank-1 coefficient matrix criterion for a bipartite pure state .
Solution
(⇒) If with , , then , so is an outer product — rank . (⇐) If , write for some vectors ; then and — separable. More generally, the SVD gives the Schmidt decomposition , and the count of nonzero (Schmidt rank) iff separable. ∎ (Full treatment: Term 1.4.)
Checkpoint
- Why does rather than ?
- Write the Kronecker product of and , and state the big-endian index rule.
- State the mixed-product identity and one consequence.
- Define a product state vs. an entangled state; give the rank test.
- What operation gives the state of one subsystem alone, and what's notable about it for entangled states?
Answers
- A joint state is a superposition over all pairs of basis states — there are of them — and its coefficients form a matrix.
- ; sits at the index equal to the binary number (qubit 0 most significant).
- ; e.g. tensor products of unitaries are unitary, eigenvalues multiply.
- Product: ; entangled: not factorable. Separable iff the coefficient matrix has rank (Schmidt rank ).
- The partial trace ; for an entangled pure state it yields a mixed reduced state.
Further Reading
- [NC] Nielsen & Chuang, §2.1.7 (tensor products) and §2.2.8 / §2.5 (entanglement, Schmidt decomposition).
- [Pre] Preskill, Ph219, Ch. 2–4 — tensor products and bipartite entanglement.
- [Wat] Watrous, Theory of Quantum Information, Ch. 2 — rigorous tensor-product formalism.
← Prev: Special Operators · Up: Term 0 · Next: 0.2.1 Probability Spaces →