From one qubit to two
Two classical bits have four possible values, 00, 01, 10 and 11. Two qubits have one complex amplitude for each of them:
With qubits there are amplitudes. This exponential growth is both the promise of quantum computing and the reason it is hard to simulate, which the next lesson quantifies. In this lesson we learn how to build such states from single qubits, how two-qubit gates act on them, and what new phenomenon appears: entanglement. Background for the whole lesson is in Nielsen and Chuang, Sections 1.3, 2.1.7 and 2.6.
Tensor products and the ordering convention
If qubit 0 is in and qubit 1 is in , the joint state is their tensor product
also written . For basis states this gives
. Convention used in this course: in
the leftmost label is qubit 0, and qubit 0 is the most
significant bit of the index. So is entry 1 and is entry 2 of
the vector, and numpy.kron(a, b) produces exactly this layout when a is
qubit 0. Some libraries use the opposite (little-endian) convention, in which
qubit 0 is the least significant bit; Qiskit does, and the KetQat SDK's
teleportation product states its own order in its output. Whenever you compare
numbers across tools, translate the ordering first.
Operators combine the same way. A gate on qubit 0 and nothing on qubit 1 is , a matrix, and . For example, .
Two-qubit gates
The workhorse is the controlled-NOT, : it flips the target (qubit 1) when the control (qubit 0) is 1, so . In our ordering,
multiplies by and does nothing else; it is symmetric in the two qubits, so "control" and "target" are interchangeable. Three identities, each checkable by multiplying matrices, connect them: ; ; and SWAP is three alternating CX gates. On basis states CX acts like the classical reversible XOR. On superpositions it does something no classical gate does.
Bell states
Apply to qubit 0 and then CX to :
Starting instead from , and gives the other three Bell states:
| Input | Output |
|---|---|
They form an orthonormal basis of the two-qubit space, because they are the image of the computational basis under a unitary.
Measure both qubits of in the computational basis: outcomes 00 and 11 each occur with probability , and 01 and 10 never. Measure only qubit 0 and get, say, 1: the state-update rule leaves , so qubit 1 now gives 1 with certainty. Each qubit on its own looks like a fair coin, but the two coins always agree.
Product states and entangled states
A two-qubit pure state is a product state if it can be written , and entangled otherwise. Here is a complete test for two qubits. Arrange the amplitudes in a matrix, rows indexed by qubit 0 and columns by qubit 1:
Claim. is a product state if and only if has rank 1, which for a non-zero matrix means .
Proof. For a product state, , so is an outer product and has rank 1. Conversely, a rank-1 matrix is an outer product of two non-zero vectors, which is the coefficient matrix of .
The general version is the Schmidt decomposition. The singular value decomposition gives
with orthonormal for qubit 0 and for qubit 1. The Schmidt coefficients do not depend on which local bases you start from. The state is a product state exactly when , and . When , as for every Bell state, the state is maximally entangled.
Worked example
- : , a product state. Indeed it is .
- : , entangled. Its Schmidt coefficients are , because and force . A single sign change turned a product state into a maximally entangled one.
- : , , maximally entangled.
import numpy as np
H = np.array([[1, 1], [1, -1]]) / np.sqrt(2)
CX = np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]) # control q0, target q1
X, Z = np.array([[0, 1], [1, 0]]), np.diag([1, -1])
phi_plus = CX @ np.kron(H, np.eye(2)) @ np.array([1, 0, 0, 0])
print(np.round(phi_plus, 4)) # [0.7071 0. 0. 0.7071]
print(np.linalg.svd(phi_plus.reshape(2, 2), compute_uv=False)) # Schmidt coefficients
print(np.linalg.svd((np.array([1, 1, 1, -1]) / 2).reshape(2, 2), compute_uv=False))
def A(t):
return np.cos(t) * Z + np.sin(t) * X
def E(psi, a, b):
return psi @ np.kron(A(a), A(b)) @ psi # real amplitudes here, so no conjugate needed
a0, a1, b0, b1 = 0, np.pi / 2, np.pi / 4, -np.pi / 4
S = E(phi_plus, a0, b0) + E(phi_plus, a0, b1) + E(phi_plus, a1, b0) - E(phi_plus, a1, b1)
print(round(S, 6), round(2 * np.sqrt(2), 6)) # 2.828427 2.828427
Both Schmidt computations print [0.70710678 0.70710678]. The last lines compute
the CHSH value, explained next.
Entanglement is more than correlation
Perfectly correlated outcomes are not, by themselves, evidence of anything quantum. Put two identical coins in two envelopes, both heads or both tails with probability , and send them to Alice and Bob: their results always agree, exactly like computational-basis measurements of . The difference appears only when the parties can choose between different measurements. This was Bell's insight (Bell, 1964); the form used in experiments is due to Clauser, Horne, Shimony and Holt (CHSH, 1969).
The game. Alice chooses one of two measurements, labelled or , and Bob one of or , independently and after the qubits have been separated. Each measurement returns . Let be the average of the product of their outcomes, and
Classical bound (theorem). Suppose each outcome is fixed in advance by some shared information (possibly random), and Alice's outcome does not depend on Bob's choice or vice versa. For each there are then predetermined values , and
One of the brackets is 0 and the other is , so the expression is . Averaging over cannot leave , so . The exercise confirms by enumeration that the 16 deterministic strategies reach exactly 2.
Quantum value. Let Alice and Bob share and measure the observable , a measurement along an axis at angle in the – plane of the Bloch sphere. Since and the mixed terms vanish,
With , , , , every term has magnitude and the signs line up: . No assignment of predetermined outcomes can reproduce these statistics.
Tsirelson's bound (theorem, stated without proof). No quantum state and no choice of quantum measurements gives (Tsirelson, 1980). The value we just found is therefore the quantum maximum. The exercise checks, on random states and angles, that product states stay within 2 and no state exceeds ; such checks are consistent with the theorems but do not prove them.
What a violation does and does not show. A measured rules out every model in which outcomes are predetermined by shared information and are independent of the distant party's choice of setting. Experiments must close "loopholes" (for example, detecting too few particles, or settings that are not chosen independently and fast enough). As one published example, Hensen et al. reported in 2015 a CHSH test free of the detection and locality loopholes, with from 245 trials (Hensen et al., 2015), a value quoted from that paper. A violation does not let Alice send a message to Bob: each of Bob's outcomes is a fair coin whatever Alice chooses, and the correlations become visible only when the two lists of results are brought together through an ordinary channel.
No-cloning
Classical information can be copied. Quantum information cannot.
Theorem (no-cloning). There is no unitary and fixed "blank" state such that for every state . (Wootters and Zurek, 1982; Dieks, 1982.)
Proof. Suppose such a copies two states and . Unitaries preserve inner products, so
With this says for , so or . A cloner can therefore copy only states that are identical or orthogonal; it cannot copy both and , whose overlap is .
You can see the failure concretely. CX copies basis states: . Feed it and linearity gives , not ; the "copy" is entangled with the original instead. No-cloning is why quantum error correction cannot simply keep backup copies, and why teleportation, in the lesson on introductory quantum algorithms, must destroy the original.
Common mistakes
- Mixing ordering conventions. In this course means qubit 0 is 1 and is vector index 2. A little-endian library puts the same state at index 1.
- Testing entanglement by looking at correlations in one basis. Classically correlated mixtures show the same computational-basis correlations as . For pure two-qubit states use the Schmidt test; to rule out classical models experimentally, use a Bell inequality with several settings.
- Reading a CHSH violation as faster-than-light signalling. Each party's local statistics are independent of the other's setting.
- Treating as a number found numerically. That no quantum strategy exceeds it is a theorem (Tsirelson); random sampling can only fail to find a counterexample.
- Claiming CX copies qubits. It copies computational-basis values, not states.
Summary
- qubits have amplitudes; tensor products build states and operators, with qubit 0 as the most significant bit in this course.
- CX, CZ and SWAP are the basic two-qubit gates; then CX turns into .
- A two-qubit pure state is entangled iff its coefficient matrix has rank 2 (); the Schmidt coefficients quantify it.
- Local predetermined models obey ; quantum mechanics reaches, and never exceeds, .
- Unknown quantum states cannot be cloned.
The exercise asks you to build the Bell states, implement the Schmidt test and compute CHSH values, including the classical maximum by enumeration. Next, Quantum circuits and simulation builds a state-vector simulator for many qubits.