QuantumCore

Lesson 12 · 55 min · core

Postulate 4: Composite Systems

Loading progress…

The fourth postulate says that the state space of a composite system is the tensor product of the state spaces of its parts. This lesson turns that sentence into working rules: local operations UA⊗IBU_A\otimes I_B and their matrices, the marginal rule PA(a)=∑b∣⟨ab∣ψ⟩∣2=⟨ψ∣(Pa⊗I)∣ψ⟩P_A(a)=\sum_b\lvert\langle ab\vert\psi\rangle\rvert^2=\langle\psi\vert(P_a\otimes I)\vert\psi\rangle, factorisation P(a,b)=PA(a)PB(b)P(a,b)=P_A(a)P_B(b) for product states, no-signalling under local unitaries, and the qubit-ordering conventions (big-endian here, little-endian in Qiskit) with a full 3-qubit bit-reversal table.

Prerequisites: Tensor (Kronecker) Products, Postulate 3: Projective Measurement & the Born Rule

Objectives and key results
  • Build joint states and local operators with ⊗\otimes, e.g. write HH on qubit 0 of two qubits as the 4×44\times4 matrix H⊗IH\otimes I.

  • Compute joint and marginal probabilities with PA(a)=∑b∣⟨ab∣ψ⟩∣2=⟨ψ∣(Pa⊗I)∣ψ⟩P_A(a)=\sum_b\lvert\langle ab\vert\psi\rangle\rvert^2=\langle\psi\vert(P_a\otimes I)\vert\psi\rangle.

  • Prove that product states have factorising distributions P(a,b)=PA(a)PB(b)P(a,b)=P_A(a)P_B(b) and recognise when a distribution does not factorise.

  • Convert between the platform's big-endian index k=2q0+q1k=2q_0+q_1 and Qiskit's little-endian index k=q0+2q1k=q_0+2q_1 by bit reversal.

definition · Postulate 4 (composite systems)
HAB=HA⊗HB,∣ψA⟩,∣ψB⟩ ↦ ∣ψA⟩⊗∣ψB⟩\mathcal H_{AB}=\mathcal H_A\otimes\mathcal H_B,\qquad\lvert\psi_A\rangle,\lvert\psi_B\rangle\ \mapsto\ \lvert\psi_A\rangle\otimes\lvert\psi_B\rangle
formula · Local operation on subsystem A
UA⊗IB,(UA⊗IB)(∣a⟩⊗∣b⟩)=UA∣a⟩⊗∣b⟩U_A\otimes I_B,\qquad(U_A\otimes I_B)(\lvert a\rangle\otimes\lvert b\rangle)=U_A\lvert a\rangle\otimes\lvert b\rangle
theorem · Marginal rule
PA(a)=∑b∣⟨ab∣ψ⟩∣2=⟨ψ∣(Pa⊗IB)∣ψ⟩P_A(a)=\sum_b\lvert\langle ab\vert\psi\rangle\rvert^2=\langle\psi\vert(P_a\otimes I_B)\vert\psi\rangle
theorem · Product states factorise
∣ψ⟩=∣α⟩⊗∣β⟩ ⇒ P(a,b)=PA(a) PB(b)\lvert\psi\rangle=\lvert\alpha\rangle\otimes\lvert\beta\rangle\ \Rightarrow\ P(a,b)=P_A(a)\,P_B(b)
identity · Qiskit index by bit reversal
kQiskit=rev⁡n(k)=∑j=0n−1qj2 j,k=∑j=0n−1qj2 n−1−jk_{\text{Qiskit}}=\operatorname{rev}_n(k)=\sum_{j=0}^{n-1}q_j2^{\,j},\qquad k=\sum_{j=0}^{n-1}q_j2^{\,n-1-j}

The joint state space and local operations#

A quantum computer is not one qubit but many, and the interesting physics happens between them. Postulates 1–3 describe a single system; the fourth postulate tells us how to describe several at once. Its answer — the tensor product, not the Cartesian product — is the origin of both the exponential size of the state space and of entanglement. The Kronecker machinery was built in the tensor-products lesson; here we attach physical meaning to it: which operators act on one part only, what probabilities an observer who looks at only one part sees, and how the platform numbers the 2n2^n basis states.

Definition

Postulate 4: composite systems

The state space of a composite physical system is the tensor product HAB=HA⊗HB\mathcal H_{AB}=\mathcal H_A\otimes\mathcal H_B of the state spaces of its components. If system AA is prepared in ∣α⟩\lvert\alpha\rangle and, independently, system BB in ∣β⟩\lvert\beta\rangle, the joint state is ∣α⟩⊗∣β⟩\lvert\alpha\rangle\otimes\lvert\beta\rangle. For nn systems, H=H1⊗⋯⊗Hn\mathcal H=\mathcal H_1\otimes\cdots\otimes\mathcal H_n. With orthonormal bases {∣a⟩}\lbrace\lvert a\rangle\rbrace of HA\mathcal H_A and {∣b⟩}\lbrace\lvert b\rangle\rbrace of HB\mathcal H_B, the vectors ∣ab⟩=∣a⟩⊗∣b⟩\lvert ab\rangle=\lvert a\rangle\otimes\lvert b\rangle form an orthonormal basis of HAB\mathcal H_{AB} and every joint state is ∣ψ⟩=∑a,bψab∣ab⟩\lvert\psi\rangle=\sum_{a,b}\psi_{ab}\lvert ab\rangle with ∑a,b∣ψab∣2=1\sum_{a,b}\lvert\psi_{ab}\rvert^2=1.

Derivation

Dimension count and why the product is not a pair

  1. Step 1:
    ⟨ab∣a′b′⟩=⟨a∣a′⟩⟨b∣b′⟩=δaa′δbb′\langle ab\vert a'b'\rangle=\langle a\vert a'\rangle\langle b\vert b'\rangle=\delta_{aa'}\delta_{bb'}
    Inner products of product vectors factorise (tensor-products lesson), so the dAdBd_Ad_B vectors ∣ab⟩\lvert ab\rangle are orthonormal.
  2. Step 2:
    dim⁡HAB=dA dB,dim⁡(C2)⊗n=2n\dim\mathcal H_{AB}=d_A\,d_B,\qquad\dim(\mathbb C^2)^{\otimes n}=2^n
    An orthonormal basis indexed by all pairs (a,b)(a,b); by induction, nn qubits need 2n2^n complex amplitudes.
  3. Step 3:
    dim⁡(HA×HB)=dA+dB\dim\big(\mathcal H_A\times\mathcal H_B\big)=d_A+d_B
    A description by a pair of vectors would need only dA+dBd_A+d_B amplitudes. For nn qubits a list of nn single-qubit vectors has 2n2n amplitudes versus 2n2^n in the joint space: 2020 vs. 10241024 for ten qubits.
  4. Step 4:
    ∣α⟩⊗∣β⟩∈HAB,but∣Φ+⟩=12(∣00⟩+∣11⟩)≠∣α⟩⊗∣β⟩\lvert\alpha\rangle\otimes\lvert\beta\rangle\in\mathcal H_{AB},\quad\text{but}\quad\lvert\Phi^+\rangle=\tfrac1{\sqrt2}(\lvert00\rangle+\lvert11\rangle)\ne\lvert\alpha\rangle\otimes\lvert\beta\rangle
    Product vectors form a small subset; the rest (such as the Bell state, proven non-product in the tensor-products lesson) are entangled.

Result

HAB=span⁡{∣a⟩⊗∣b⟩},dim⁡HAB=dAdB\boxed{\mathcal H_{AB}=\operatorname{span}\lbrace\lvert a\rangle\otimes\lvert b\rangle\rbrace,\qquad\dim\mathcal H_{AB}=d_Ad_B}
Proposition

Local unitaries: UA⊗IBU_A\otimes I_B is unitary and does not change BB's statistics

If UAU_A is unitary on HA\mathcal H_A, then UA⊗IBU_A\otimes I_B is unitary on HAB\mathcal H_{AB}, it acts on product states as UA∣α⟩⊗∣β⟩U_A\lvert\alpha\rangle\otimes\lvert\beta\rangle, and for every joint state ∣ψ⟩\lvert\psi\rangle and every projector QbQ_b on HB\mathcal H_B the probability ⟨ψ∣(IA⊗Qb)∣ψ⟩\langle\psi\vert(I_A\otimes Q_b)\vert\psi\rangle is unchanged by UA⊗IBU_A\otimes I_B (no-signalling).

Proof (4 steps)
  1. Step 1:
    (UA⊗IB)(∣α⟩⊗∣β⟩)=UA∣α⟩⊗IB∣β⟩=UA∣α⟩⊗∣β⟩(U_A\otimes I_B)(\lvert\alpha\rangle\otimes\lvert\beta\rangle)=U_A\lvert\alpha\rangle\otimes I_B\lvert\beta\rangle=U_A\lvert\alpha\rangle\otimes\lvert\beta\rangle
    Definition of the tensor product of operators on product vectors.
  2. Step 2:
    (UA⊗IB)†(UA⊗IB)=(UA†⊗IB)(UA⊗IB)=UA†UA⊗IB=IA⊗IB(U_A\otimes I_B)^\dagger(U_A\otimes I_B)=(U_A^\dagger\otimes I_B)(U_A\otimes I_B)=U_A^\dagger U_A\otimes I_B=I_A\otimes I_B
    Adjoint rule (A⊗B)†=A†⊗B†(A\otimes B)^\dagger=A^\dagger\otimes B^\dagger and the mixed-product property.
  3. Step 3:
    (UA†⊗IB)(IA⊗Qb)(UA⊗IB)=UA†IAUA⊗IBQbIB=IA⊗Qb(U_A^\dagger\otimes I_B)(I_A\otimes Q_b)(U_A\otimes I_B)=U_A^\dagger I_AU_A\otimes I_BQ_bI_B=I_A\otimes Q_b
    Mixed-product property twice; UA†UA=IAU_A^\dagger U_A=I_A.
  4. Step 4:
    ⟨ψ∣(UA⊗I)†(I⊗Qb)(UA⊗I)∣ψ⟩=⟨ψ∣(I⊗Qb)∣ψ⟩\langle\psi\vert(U_A\otimes I)^\dagger(I\otimes Q_b)(U_A\otimes I)\vert\psi\rangle=\langle\psi\vert(I\otimes Q_b)\vert\psi\rangle
    Born rule for BB's outcome after the local operation: whatever Alice does to her qubit, Bob's outcome probabilities do not change, so no information is sent.

∎

The matrix of a local gate. With qubit 0 as the left factor, a Hadamard on qubit 0 of a two-qubit register is H⊗IH\otimes I. Its Kronecker block form is (12I12I12I−12I)\begin{pmatrix}\tfrac1{\sqrt2}I&\tfrac1{\sqrt2}I\\\tfrac1{\sqrt2}I&-\tfrac1{\sqrt2}I\end{pmatrix}: it mixes index 00 with 22 (∣00⟩↔∣10⟩\lvert00\rangle\leftrightarrow\lvert10\rangle) and index 11 with 33 (∣01⟩↔∣11⟩\lvert01\rangle\leftrightarrow\lvert11\rangle) — pairs that differ only in qubit 0 — and leaves the value of qubit 1 untouched. A Hadamard on qubit 1 would instead be I⊗H=diag(H,H)I\otimes H=\mathrm{diag}(H,H), mixing 0↔10\leftrightarrow1 and 2↔32\leftrightarrow3.

H⊗I=12(1010010110−10010−1)H\otimes I=\frac1{\sqrt2}\begin{pmatrix}1&0&1&0\\0&1&0&1\\1&0&-1&0\\0&1&0&-1\end{pmatrix}
H ⊗ I (Hadamard on qubit 0)4×4

Unitary verified: U†U=IU^\dagger U = I (max deviation 2.2e-16)

Quick check

Which 4×44\times4 matrix applies XX to qubit 1 (the right factor, least significant bit) of a two-qubit register?

Select one answer

Joint and marginal probabilities#

Measuring both qubits of ∣ψ⟩=∑a,bψab∣ab⟩\lvert\psi\rangle=\sum_{a,b}\psi_{ab}\lvert ab\rangle in the computational basis is a projective measurement with projectors ∣ab⟩⟨ab∣\lvert ab\rangle\langle ab\rvert, so the joint distribution is P(a,b)=∣ψab∣2P(a,b)=\lvert\psi_{ab}\rvert^2 by the Born rule. Often only one subsystem is measured — for example the ancilla of a phase-estimation circuit, or the readout qubit of a classifier. What does an observer who looks only at AA see?

Theorem

Marginal rule

Measuring only subsystem AA of ∣ψ⟩∈HA⊗HB\lvert\psi\rangle\in\mathcal H_A\otimes\mathcal H_B in the basis {∣a⟩}\lbrace\lvert a\rangle\rbrace is the projective measurement {Pa⊗IB}\lbrace P_a\otimes I_B\rbrace with Pa=∣a⟩⟨a∣P_a=\lvert a\rangle\langle a\rvert, and its outcome probabilities are the marginals of the joint distribution: PA(a)=⟨ψ∣(Pa⊗IB)∣ψ⟩=∑b∣⟨ab∣ψ⟩∣2=∑bP(a,b)P_A(a)=\langle\psi\vert(P_a\otimes I_B)\vert\psi\rangle=\sum_b\lvert\langle ab\vert\psi\rangle\rvert^2=\sum_bP(a,b). The post-measurement state is (Pa⊗IB)∣ψ⟩/PA(a)=∣a⟩⊗∑bψab∣b⟩/PA(a)(P_a\otimes I_B)\lvert\psi\rangle/\sqrt{P_A(a)}=\lvert a\rangle\otimes\sum_b\psi_{ab}\lvert b\rangle/\sqrt{P_A(a)}.

Proof (6 steps)
  1. Step 1:
    (Pa⊗IB)†=Pa⊗IB,(Pa⊗IB)(Pa′⊗IB)=δaa′Pa⊗IB,∑aPa⊗IB=IA⊗IB(P_a\otimes I_B)^\dagger=P_a\otimes I_B,\quad(P_a\otimes I_B)(P_{a'}\otimes I_B)=\delta_{aa'}P_a\otimes I_B,\quad\sum_aP_a\otimes I_B=I_A\otimes I_B
    Adjoint rule, mixed-product property with PaPa′=δaa′PaP_aP_{a'}=\delta_{aa'}P_a, and completeness ∑aPa=IA\sum_aP_a=I_A: these are the projectors of a legitimate projective measurement (the observable Aobs⊗IBA_{\text{obs}}\otimes I_B).
  2. Step 2:
    IB=∑b∣b⟩⟨b∣ ⇒ Pa⊗IB=∑b∣a⟩⟨a∣⊗∣b⟩⟨b∣I_B=\sum_b\lvert b\rangle\langle b\rvert\ \Rightarrow\ P_a\otimes I_B=\sum_b\lvert a\rangle\langle a\rvert\otimes\lvert b\rangle\langle b\rvert
    Resolution of the identity on HB\mathcal H_B, then bilinearity of ⊗\otimes.
  3. Step 3:
    ∣a⟩⟨a∣⊗∣b⟩⟨b∣=(∣a⟩⊗∣b⟩)(⟨a∣⊗⟨b∣)=∣ab⟩⟨ab∣\lvert a\rangle\langle a\rvert\otimes\lvert b\rangle\langle b\rvert=\big(\lvert a\rangle\otimes\lvert b\rangle\big)\big(\langle a\rvert\otimes\langle b\rvert\big)=\lvert ab\rangle\langle ab\rvert
    Mixed-product property applied to column times row vectors.
  4. Step 4:
    ⟨ψ∣(Pa⊗IB)∣ψ⟩=∑b⟨ψ∣ab⟩⟨ab∣ψ⟩=∑b∣⟨ab∣ψ⟩∣2\langle\psi\vert(P_a\otimes I_B)\vert\psi\rangle=\sum_b\langle\psi\vert ab\rangle\langle ab\vert\psi\rangle=\sum_b\lvert\langle ab\vert\psi\rangle\rvert^2
    Sandwich between ⟨ψ∣\langle\psi\rvert and ∣ψ⟩\lvert\psi\rangle and use ⟨ψ∣ab⟩=⟨ab∣ψ⟩‾\langle\psi\vert ab\rangle=\overline{\langle ab\vert\psi\rangle}.
  5. Step 5:
    =∑b∣ψab∣2=∑bP(a,b)=\sum_b\lvert\psi_{ab}\rvert^2=\sum_bP(a,b)
    ⟨ab∣ψ⟩=ψab\langle ab\vert\psi\rangle=\psi_{ab} is the amplitude of ∣ab⟩\lvert ab\rangle; the Born rule of the joint measurement gives P(a,b)=∣ψab∣2P(a,b)=\lvert\psi_{ab}\rvert^2.
  6. Step 6:
    (Pa⊗IB)∣ψ⟩=∑a′,bψa′b Pa∣a′⟩⊗∣b⟩=∣a⟩⊗∑bψab∣b⟩(P_a\otimes I_B)\lvert\psi\rangle=\sum_{a',b}\psi_{a'b}\,P_a\lvert a'\rangle\otimes\lvert b\rangle=\lvert a\rangle\otimes\sum_b\psi_{ab}\lvert b\rangle
    Pa∣a′⟩=δaa′∣a⟩P_a\lvert a'\rangle=\delta_{aa'}\lvert a\rangle; dividing by PA(a)\sqrt{P_A(a)} gives the collapsed state, in which BB is left in the normalised "conditional state" ∑bψab∣b⟩/PA(a)\sum_b\psi_{ab}\lvert b\rangle/\sqrt{P_A(a)}.

∎

Proposition

Product states have factorising distributions

If ∣ψ⟩=∣α⟩⊗∣β⟩\lvert\psi\rangle=\lvert\alpha\rangle\otimes\lvert\beta\rangle, then for all a,ba,b: P(a,b)=PA(a) PB(b)P(a,b)=P_A(a)\,P_B(b) with PA(a)=∣⟨a∣α⟩∣2P_A(a)=\lvert\langle a\vert\alpha\rangle\rvert^2 and PB(b)=∣⟨b∣β⟩∣2P_B(b)=\lvert\langle b\vert\beta\rangle\rvert^2. The outcomes on AA and BB are statistically independent.

Proof (5 steps)
  1. Step 1:
    ⟨ab∣ψ⟩=(⟨a∣⊗⟨b∣)(∣α⟩⊗∣β⟩)=⟨a∣α⟩ ⟨b∣β⟩\langle ab\vert\psi\rangle=\big(\langle a\rvert\otimes\langle b\rvert\big)\big(\lvert\alpha\rangle\otimes\lvert\beta\rangle\big)=\langle a\vert\alpha\rangle\,\langle b\vert\beta\rangle
    Inner products of product vectors factorise.
  2. Step 2:
    P(a,b)=∣⟨a∣α⟩⟨b∣β⟩∣2=∣⟨a∣α⟩∣2 ∣⟨b∣β⟩∣2P(a,b)=\lvert\langle a\vert\alpha\rangle\langle b\vert\beta\rangle\rvert^2=\lvert\langle a\vert\alpha\rangle\rvert^2\,\lvert\langle b\vert\beta\rangle\rvert^2
    Born rule for the joint measurement and multiplicativity ∣zw∣=∣z∣∣w∣\lvert zw\rvert=\lvert z\rvert\lvert w\rvert.
  3. Step 3:
    PA(a)=∑bP(a,b)=∣⟨a∣α⟩∣2∑b∣⟨b∣β⟩∣2=∣⟨a∣α⟩∣2 ∥β∥2=∣⟨a∣α⟩∣2P_A(a)=\sum_bP(a,b)=\lvert\langle a\vert\alpha\rangle\rvert^2\sum_b\lvert\langle b\vert\beta\rangle\rvert^2=\lvert\langle a\vert\alpha\rangle\rvert^2\,\lVert\beta\rVert^2=\lvert\langle a\vert\alpha\rangle\rvert^2
    Marginal rule, Parseval's identity ∑b∣⟨b∣β⟩∣2=∥β∥2\sum_b\lvert\langle b\vert\beta\rangle\rvert^2=\lVert\beta\rVert^2, and normalisation of ∣β⟩\lvert\beta\rangle.
  4. Step 4:
    PB(b)=∑aP(a,b)=∣⟨b∣β⟩∣2P_B(b)=\sum_aP(a,b)=\lvert\langle b\vert\beta\rangle\rvert^2
    Same computation with the roles of AA and BB exchanged.
  5. Step 5:
    P(a,b)=PA(a) PB(b)P(a,b)=P_A(a)\,P_B(b)
    Combine the second, third and fourth lines.

∎

Derivation

Worked example: RY(π/3)R_Y(\pi/3) on qubit 0 and HH on qubit 1

  1. Step 1:
    RY(π3)∣0⟩=cos⁡π6∣0⟩+sin⁡π6∣1⟩=32∣0⟩+12∣1⟩R_Y(\tfrac\pi3)\lvert0\rangle=\cos\tfrac\pi6\lvert0\rangle+\sin\tfrac\pi6\lvert1\rangle=\tfrac{\sqrt3}2\lvert0\rangle+\tfrac12\lvert1\rangle
    First column of RY(θ)=(cos⁡θ2−sin⁡θ2sin⁡θ2cos⁡θ2)R_Y(\theta)=\begin{pmatrix}\cos\frac\theta2&-\sin\frac\theta2\\\sin\frac\theta2&\cos\frac\theta2\end{pmatrix} at θ=π/3\theta=\pi/3.
  2. Step 2:
    H∣0⟩=12∣0⟩+12∣1⟩H\lvert0\rangle=\tfrac1{\sqrt2}\lvert0\rangle+\tfrac1{\sqrt2}\lvert1\rangle
    First column of HH.
  3. Step 3:
    (RY(π3)⊗H)∣00⟩=(32∣0⟩+12∣1⟩)⊗(12∣0⟩+12∣1⟩)\big(R_Y(\tfrac\pi3)\otimes H\big)\lvert00\rangle=\Big(\tfrac{\sqrt3}2\lvert0\rangle+\tfrac12\lvert1\rangle\Big)\otimes\Big(\tfrac1{\sqrt2}\lvert0\rangle+\tfrac1{\sqrt2}\lvert1\rangle\Big)
    The two gates act on different qubits, so the circuit is the local operator RY⊗HR_Y\otimes H acting on the product state ∣0⟩⊗∣0⟩\lvert0\rangle\otimes\lvert0\rangle.
  4. Step 4:
    =322∣00⟩+322∣01⟩+122∣10⟩+122∣11⟩=\tfrac{\sqrt3}{2\sqrt2}\lvert00\rangle+\tfrac{\sqrt3}{2\sqrt2}\lvert01\rangle+\tfrac1{2\sqrt2}\lvert10\rangle+\tfrac1{2\sqrt2}\lvert11\rangle
    Bilinearity of ⊗\otimes; indices k=2q0+q1=0,1,2,3k=2q_0+q_1=0,1,2,3 in this order.
  5. Step 5:
    P(00)=P(01)=(322)2=38,P(10)=P(11)=(122)2=18P(00)=P(01)=\Big(\tfrac{\sqrt3}{2\sqrt2}\Big)^2=\tfrac38,\qquad P(10)=P(11)=\Big(\tfrac1{2\sqrt2}\Big)^2=\tfrac18
    Born rule: squared moduli of the four real amplitudes; the sum is 38+38+18+18=1\tfrac38+\tfrac38+\tfrac18+\tfrac18=1.
  6. Step 6:
    Pq0(0)=38+38=34,Pq0(1)=14,Pq1(0)=38+18=12,Pq1(1)=12P_{q_0}(0)=\tfrac38+\tfrac38=\tfrac34,\quad P_{q_0}(1)=\tfrac14,\qquad P_{q_1}(0)=\tfrac38+\tfrac18=\tfrac12,\quad P_{q_1}(1)=\tfrac12
    Marginal rule: sum over the other qubit's bit (rows 0x0x vs. 1x1x for qubit 0, columns x0x0 vs. x1x1 for qubit 1).
  7. Step 7:
    Pq0(0)Pq1(0)=34⋅12=38=P(00),Pq0(1)Pq1(1)=14⋅12=18=P(11)P_{q_0}(0)P_{q_1}(0)=\tfrac34\cdot\tfrac12=\tfrac38=P(00),\quad P_{q_0}(1)P_{q_1}(1)=\tfrac14\cdot\tfrac12=\tfrac18=P(11)
    Factorisation, as the proposition guarantees for a product state; the other two entries check the same way.

Result

(P(00),P(01),P(10),P(11))=(38,38,18,18)\boxed{\big(P(00),P(01),P(10),P(11)\big)=\big(\tfrac38,\tfrac38,\tfrac18,\tfrac18\big)}

Circuit · 2 qubits

Quantum circuit on 2 qubitsRY(π/3) on q0; H on q1q0q1RY(π/3)H

RY(π/3)R_Y(\pi/3) on qubit 0 and HH on qubit 1: amplitudes (0.6124,0.6124,0.3536,0.3536)(0.6124,0.6124,0.3536,0.3536) and joint distribution (38,38,18,18)(\tfrac38,\tfrac38,\tfrac18,\tfrac18) over 00,01,10,1100,01,10,11.

∣ψ⟩=0.6124∣00⟩+0.6124∣01⟩+122∣10⟩+122∣11⟩\lvert\psi\rangle = 0.6124\lvert 00\rangle + 0.6124\lvert 01\rangle + \tfrac{1}{2\sqrt{2}}\lvert 10\rangle + \tfrac{1}{2\sqrt{2}}\lvert 11\rangle
  • |00⟩0.375
  • |01⟩0.375
  • |10⟩0.125
  • |11⟩0.125

Quick check

For the joint distribution (P(00),P(01),P(10),P(11))=(38,38,18,18)(P(00),P(01),P(10),P(11))=(\tfrac38,\tfrac38,\tfrac18,\tfrac18), what is the probability that qubit 0 reads 11?

tolerance ±0.001

Qubit-ordering conventions: big-endian vs. Qiskit#

The postulate fixes the space H0⊗H1⊗⋯\mathcal H_0\otimes\mathcal H_1\otimes\cdots but not how we number its basis vectors. Two conventions are in common use, and mixing them up is the single most frequent bug in quantum software. The platform — simulator, circuit diagrams, labs and this curriculum — puts qubit 0 in the leftmost tensor factor, which makes it the most significant bit of the basis index. Qiskit puts qubit 0 in the rightmost factor (least significant bit).

Derivation

Conversion by bit reversal

  1. Step 1:
    k=∑j=0n−1qj 2 n−1−j,k′=∑j=0n−1qj 2 jk=\sum_{j=0}^{n-1}q_j\,2^{\,n-1-j},\qquad k'=\sum_{j=0}^{n-1}q_j\,2^{\,j}
    The two index maps for the same assignment of bits q0,…,qn−1q_0,\dots,q_{n-1} to qubits.
  2. Step 2:
    k′=∑j′=0n−1qn−1−j′ 2 n−1−j′k'=\sum_{j'=0}^{n-1}q_{n-1-j'}\,2^{\,n-1-j'}
    Substitute j=n−1−j′j=n-1-j' in the Qiskit sum (a relabelling of the summation index).
  3. Step 3:
    bit p of k is qn−1−p,bit p of k′ is qp\text{bit } p \text{ of } k \text{ is } q_{n-1-p},\qquad\text{bit } p \text{ of } k' \text{ is } q_{p}
    Read off the coefficient of 2p2^p in each sum.
  4. Step 4:
    k′=rev⁡n(k),rev⁡n(rev⁡n(k))=kk'=\operatorname{rev}_n(k),\qquad\operatorname{rev}_n(\operatorname{rev}_n(k))=k
    Bit pp of k′k' equals bit n−1−pn-1-p of kk: reversing the nn-bit binary word. Reversal is an involution, so the same map converts in both directions.
  5. Step 5:
    ψk′′=ψrev⁡n(k′),n=2: (ψ0,ψ1,ψ2,ψ3)↦(ψ0,ψ2,ψ1,ψ3)\psi'_{k'}=\psi_{\operatorname{rev}_n(k')},\qquad n=2:\ (\psi_0,\psi_1,\psi_2,\psi_3)\mapsto(\psi_0,\psi_2,\psi_1,\psi_3)
    Converting a statevector permutes amplitudes; for two qubits only indices 11 (0101) and 22 (1010) swap.
  6. Step 6:
    Qiskit: (38,18,38,18)forRY(π3) on q0, H on q1\text{Qiskit}:\ (\tfrac38,\tfrac18,\tfrac38,\tfrac18)\quad\text{for}\quad R_Y(\tfrac\pi3)\ \text{on}\ q_0,\ H\ \text{on}\ q_1
    The worked example in Qiskit's ordering: the same physics, the middle two probabilities swapped.

Result

kQiskit=rev⁡n(khere)\boxed{k_{\text{Qiskit}}=\operatorname{rev}_n(k_{\text{here}})}

Full 3-qubit table. For n=3n=3: k=4q0+2q1+q2k=4q_0+2q_1+q_2 and k′=q0+2q1+4q2k'=q_0+2q_1+4q_2. Rows whose bit string is a palindrome (000,010,101,111000,010,101,111) have k=k′k=k'; the other four are swapped in pairs 1↔41\leftrightarrow4 and 3↔63\leftrightarrow6.

q0q1q2q_0q_1q_2our index k=4q0+2q1+q2k=4q_0+2q_1+q_2Qiskit index k′=q0+2q1+4q2k'=q_0+2q_1+4q_2Qiskit prints q2q1q0q_2q_1q_0
00000000
00114100
01022010
01136110
10041001
10155101
11063011
11177111

For example, ∣q0q1q2⟩=∣100⟩\lvert q_0q_1q_2\rangle=\lvert100\rangle (only qubit 0 excited) is index 44 here but index 11 in Qiskit, which prints it as the string 001.

Quick check

In a 3-qubit register, qubits 0 and 1 are ∣1⟩\lvert1\rangle and qubit 2 is ∣0⟩\lvert0\rangle. What is the Qiskit (little-endian) basis index?

tolerance ±1e-9

Quick check

A lab asks for (38,38,18,18)(\tfrac38,\tfrac38,\tfrac18,\tfrac18) but your circuit produces (38,18,38,18)(\tfrac38,\tfrac18,\tfrac38,\tfrac18). What went wrong?

Select one answer

Check it numerically. The cell builds the worked example with np.kron in the platform's ordering, prints the joint distribution, both marginals, and the Qiskit-ordered distribution obtained by bit reversal.

Pythonrunnable
import numpy as np

t = np.pi / 3
ry = np.array([[np.cos(t / 2), -np.sin(t / 2)], [np.sin(t / 2), np.cos(t / 2)]])
H = np.array([[1, 1], [1, -1]]) / np.sqrt(2)
psi = np.kron(ry @ [1, 0], H @ [1, 0])
p = np.abs(psi) ** 2
print(np.round(p, 4))
P = p.reshape(2, 2)
print(np.round(P.sum(axis=1), 4), np.round(P.sum(axis=0), 4))
rev = [int(format(k, '02b')[::-1], 2) for k in range(4)]
print(np.round(p[rev], 4))

Expected output

[0.375 0.375 0.125 0.125]
[0.75 0.25] [0.5 0.5]
[0.375 0.125 0.375 0.125]

References

  1. M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press (2010), §2.2.8 (composite systems) and §2.1.7 (tensor products).
  2. Qiskit documentation, "Bit-ordering in the Qiskit SDK".docs.quantum.ibm.com
  3. J. Preskill, Lecture Notes for Physics 219: Quantum Computation, Chapter 2 (foundations I: states and ensembles), California Institute of Technology.theory.caltech.edu

Hands-on labs

  • Build a product-state joint distribution

    1 step · auto-graded

    Prepare a product state ∣a⟩⊗∣b⟩\lvert a\rangle\otimes\lvert b\rangle whose joint distribution is P(00)=P(01)=38P(00)=P(01)=\tfrac38, P(10)=P(11)=18P(10)=P(11)=\tfrac18, using the factorisation P(q0,q1)=PA(q0)PB(q1)P(q_0,q_1)=P_A(q_0)P_B(q_1) and the big-endian ordering (qubit 0 is the leftmost bit).

    Open lab