Week 2 | states, measurement, phase, and a ball to draw them on | reading: Watrous §1.2
Lecture 1 promised that a qubit is a unit vector of amplitudes, and Lecture 2 built the language for such vectors. This lecture turns the promise into rules. By the end you should be able to compute the probabilities of any measurement on any qubit state; say which differences between state vectors are physical and which are only bookkeeping; describe any qubit by two angles; and place it, and read its measurement statistics, on the Bloch sphere.
The state of a qubit is a unit vector in \(\mathbb C^2\):
$$|\psi\rangle=\alpha\,|0\rangle+\beta\,|1\rangle=\begin{pmatrix}\alpha\\[2pt] \beta\end{pmatrix},\qquad |\alpha|^2+|\beta|^2=1 .$$The numbers \(\alpha\) and \(\beta\) are the amplitudes of \(|0\rangle\) and \(|1\rangle\).
For which positive real number \(c\) is \(\tfrac12|0\rangle+c\,|1\rangle\) a qubit state?
A state on its own predicts nothing until we say what happens when we look at it. That is the job of a single rule, which we take as an axiom.
Measuring \(|\psi\rangle\) in the standard basis gives outcome \(k\in\{0,1\}\) with probability
$$P(k)=|\langle k|\psi\rangle|^2,\qquad\text{so}\qquad P(0)=|\alpha|^2,\quad P(1)=|\beta|^2 .$$Immediately after the measurement the qubit is in the state \(|k\rangle\) that was observed. More generally, measuring in any orthonormal basis \(\{|b_0\rangle,|b_1\rangle\}\) gives outcome \(b_k\) with probability \(|\langle b_k|\psi\rangle|^2\) and leaves the qubit in \(|b_k\rangle\).
Two things are packed into the axiom. The first is the probability rule, which you have been using since Lecture 1. The second is collapse: measurement is not a passive look. Whatever superposition the qubit was in is replaced by the basis state you saw, so measuring again in the same basis gives the same answer with certainty.
A qubit in the state \(\tfrac12|0\rangle+\tfrac{\sqrt3}{2}|1\rangle\) is measured in the standard basis, and the outcome is 1. It is measured again, immediately, in the same basis. The second measurement gives 1 with probability .
Let \(|\psi\rangle=\tfrac35|0\rangle+\tfrac{4i}{5}|1\rangle\). Check that it is a valid state, find the outcome probabilities in the standard basis, and say what state the qubit is in after the outcome 1 is observed.
The squared sizes of the amplitudes are \(|3/5|^2=9/25\) and \(|4i/5|^2=16/25\). They add to 1, so this is a state, and
$$P(0)=\frac{9}{25}=0.36,\qquad P(1)=\frac{16}{25}=0.64 .$$The factor \(i\) on the second amplitude has no effect on these numbers, since \(|i|=1\). After outcome 1 the qubit is in \(|1\rangle\): the original amplitudes, including that factor of \(i\), are gone.
In 1926 Erwin Schrödinger wrote down his wave equation without being sure what the wave meant. That summer Max Born, studying collisions between particles, proposed that the wave gives the probability of finding a particle, and in a note added while the paper was in proof he corrected himself: the probability is proportional to the square of the amplitude. Born received the Nobel Prize for it in 1954. Nearly a century later the rule has never failed a test, and no one has derived it from anything simpler. We take it as given, as physicists do.
The standard basis is the one quantum hardware measures natively, but the Born rule works for any orthonormal basis. Lecture 2 introduced the three bases that matter most: Z \((|0\rangle,|1\rangle)\), X \((|+\rangle,|-\rangle)\) and Y \((|{+i}\rangle,|{-i}\rangle)\). Measuring the same state in different bases asks it different questions, and the answers can be very different.
The qubit is in \(|0\rangle\). It is measured in the X basis \(\{|+\rangle,|-\rangle\}\). What is the probability of the outcome \(+\)?
For \(|\psi\rangle=\tfrac35|0\rangle+\tfrac{4i}{5}|1\rangle\), find the outcome probabilities in the X basis and in the Y basis.
X basis. With \(\langle+|=\tfrac1{\sqrt2}(1\;\;1)\),
$$\langle+|\psi\rangle=\frac{1}{\sqrt2}\Big(\frac35+\frac{4i}{5}\Big),\qquad P(+)=\frac12\cdot\frac{|3+4i|^2}{25}=\frac12\cdot\frac{25}{25}=\frac12,$$and so \(P(-)=\tfrac12\). The X basis sees a fair coin.
Y basis. Remember the conjugate: \(\langle{+i}|=\tfrac{1}{\sqrt2}(1\;\;-i)\). Then
$$\langle{+i}|\psi\rangle=\frac{1}{\sqrt2}\Big(\frac35+(-i)\frac{4i}{5}\Big)=\frac{1}{\sqrt2}\Big(\frac35+\frac45\Big)=\frac{7}{5\sqrt2},$$ $$P({+i})=\frac{49}{50}=0.98,$$and so \(P({-i})=0.02\). In the Y basis the state is almost certain. The same qubit is 36/64 in Z, 50/50 in X and 98/2 in Y.
No single measurement tells you what a qubit "is". The state \(|\psi\rangle\) is best thought of as a compact rule that predicts the answer statistics for every measurement you could make, in every basis at once. Example 3.2 shows how different those answers can be. Section 6 will show that three numbers, the Z, X and Y answers, are enough to pin the state down completely.
Collapse has an uncomfortable consequence. You cannot measure the same qubit twice to learn more about it, because after the first measurement the old state is gone. To learn \(P(0)\) you need many identically prepared copies, one measurement per copy. Each run of the circuit is called a shot, and what a quantum computer returns is a table of counts. In the language of probability and statistics, each shot is a Bernoulli trial with success probability \(p=P(0)\), and the proportion of zeros \(\hat p\) estimates \(p\) with the familiar standard error \(\sqrt{\hat p(1-\hat p)/n}\).
A device is supposed to prepare either the running example \(|\psi\rangle\) (with \(P(0)=0.36\)) or the state \(|+\rangle\) (with \(P(0)=0.5\)). You measure 100 copies in the standard basis and see 38 zeros. Build a 95% confidence interval for \(P(0)\). Which state is consistent with the data?
\(\hat p=0.38\) and the half-width is \(1.96\sqrt{0.38\cdot0.62/100}\approx0.095\), so the interval is
$$(0.285,\;0.475).$$It contains 0.36 and excludes 0.5, so the data point to \(|\psi\rangle\). With only 100 shots the interval is almost 0.2 wide: telling two states apart is a statistics problem, and its cost is paid in shots.
Amplitudes are never observed directly, not even their sizes. What you observe are frequencies, which converge to \(|\alpha|^2\) at the slow rate \(1/\sqrt n\). Every quantum algorithm in this course ends the same way: run the circuit many times and read off the most common answer. A good algorithm is one where the right answer is common enough to stand out after a modest number of shots.
Two different vectors can describe the same physical state. The simplest case is multiplying the whole vector by a number of size 1.
For any real \(\gamma\), the states \(|\psi\rangle\) and \(e^{i\gamma}|\psi\rangle\) give identical probabilities for every measurement in every basis. They are the same physical state.
For any basis vector \(|b\rangle\), linearity and \(|e^{i\gamma}|=1\) give
$$\big|\langle b|\,e^{i\gamma}\psi\rangle\big|^2=|e^{i\gamma}|^2\,|\langle b|\psi\rangle|^2=|\langle b|\psi\rangle|^2 .$$No measurement can tell the two vectors apart. The same holds after any gate \(U\), because \(U(e^{i\gamma}|\psi\rangle)=e^{i\gamma}U|\psi\rangle\): the factor just rides along to the end.
So \(|0\rangle\) and \(-|0\rangle\) are the same state, and so are \(|{+i}\rangle\) and \(i|{+i}\rangle\). A factor multiplying the whole vector is called a global phase, and we are free to drop it.
A phase between the two amplitudes is a different matter. Compare \(|+\rangle=\tfrac{1}{\sqrt2}(|0\rangle+|1\rangle)\) and \(|-\rangle=\tfrac{1}{\sqrt2}(|0\rangle-|1\rangle)\). In the standard basis both give 50/50, but in the X basis \(|+\rangle\) gives \(+\) with certainty and \(|-\rangle\) gives \(-\) with certainty. They are as different as two states can be. The minus sign here is a relative phase: it multiplies only one amplitude, so it cannot be factored out of the whole vector.
Tick every pair that describes the same physical state.
For each real \(\varphi\), let \(|\psi_\varphi\rangle=\tfrac{1}{\sqrt2}\big(|0\rangle+e^{i\varphi}|1\rangle\big)\). Find \(P(0)\) in the standard basis and \(P(+)\) in the X basis as functions of \(\varphi\).
Standard basis: \(P(0)=|1/\sqrt2|^2=\tfrac12\) for every \(\varphi\). The Z measurement is blind to \(\varphi\). X basis:
$$\langle+|\psi_\varphi\rangle=\frac12\big(1+e^{i\varphi}\big),$$ $$P(+)=\frac14\,\big|1+e^{i\varphi}\big|^2=\frac14\big(2+2\cos\varphi\big)=\frac{1+\cos\varphi}{2}.$$Here we used \(|1+e^{i\varphi}|^2=(1+e^{i\varphi})(1+e^{-i\varphi})=2+2\cos\varphi\). As \(\varphi\) runs around the circle, \(P(+)\) swings from 1 at \(|+\rangle\), through \(\tfrac12\) at \(|{+i}\rangle\), to 0 at \(|-\rangle\), and back.
The rule is simple: a phase is physical exactly when it is relative. A global phase is like choosing where to start measuring angles: change it and nothing observable changes. A relative phase is an angle between two amplitudes, and angles between things are always measurable, provided you ask in a basis that mixes the two amplitudes, as the X and Y bases do. Much of the design of quantum algorithms is the design of relative phases.
A qubit state has two complex amplitudes, which is four real numbers. Normalisation removes one and the invisible global phase removes another, which leaves two. Here they are.
Every qubit state can be written, up to a global phase, as
$$|\psi\rangle=\cos\frac{\theta}{2}\,|0\rangle+e^{i\varphi}\sin\frac{\theta}{2}\,|1\rangle,\qquad 0\le\theta\le\pi,\quad 0\le\varphi<2\pi .$$The angles are unique, except that \(\varphi\) is irrelevant when \(\theta=0\) or \(\theta=\pi\).
Write the amplitudes in polar form, \(\alpha=|\alpha|e^{ia}\) and \(\beta=|\beta|e^{ib}\), and pull out the global phase \(e^{ia}\):
$$|\psi\rangle=e^{ia}\Big(|\alpha|\,|0\rangle+e^{i(b-a)}|\beta|\,|1\rangle\Big).$$Since \(|\alpha|^2+|\beta|^2=1\) with both sizes nonnegative, there is a unique \(\theta\in[0,\pi]\) with \(|\alpha|=\cos(\theta/2)\) and \(|\beta|=\sin(\theta/2)\). Set \(\varphi=b-a\), reduced to \([0,2\pi)\). If \(\beta=0\) or \(\alpha=0\) the relative phase multiplies zero, so any \(\varphi\) works.
A state in standard form has \(\theta=\pi/3\) and \(\varphi=\pi/2\). What is the probability of outcome 1 in the standard basis?
Find \(\theta\) and \(\varphi\) for \(|\chi\rangle=\tfrac{1+i}{2}|0\rangle+\tfrac{1}{\sqrt2}|1\rangle\).
\(\big|\tfrac{1+i}{2}\big|=\tfrac{\sqrt2}{2}=\tfrac1{\sqrt2}\), so \(\cos(\theta/2)=\tfrac1{\sqrt2}\) and \(\theta=\pi/2\). The first amplitude has phase \(\pi/4\) and the second has phase 0. Pulling out \(e^{i\pi/4}\):
$$|\chi\rangle=e^{i\pi/4}\Big(\frac{1}{\sqrt2}|0\rangle+e^{-i\pi/4}\frac{1}{\sqrt2}|1\rangle\Big),$$so \(\varphi=-\pi/4\), which is \(7\pi/4\) in \([0,2\pi)\). The state lies on the equator of the sphere of the next section, halfway between \(|+\rangle\) and \(|{-i}\rangle\).
Find a real state with \(P(0)=\tfrac34\), and give its \(\theta\).
We need \(\cos^2(\theta/2)=\tfrac34\), so \(\cos(\theta/2)=\tfrac{\sqrt3}{2}\) and \(\theta/2=\pi/6\). The state is \(\cos\tfrac\pi6|0\rangle+\sin\tfrac\pi6|1\rangle=\tfrac{\sqrt3}{2}|0\rangle+\tfrac12|1\rangle\), with \(\theta=\pi/3\). In general \(P(0)=\cos^2(\theta/2)\) depends on \(\theta\) alone: \(\theta\) controls the Z statistics and \(\varphi\) controls the rest.
The half angle looks like an odd choice, but it is forced on us. Orthogonal states, such as \(|0\rangle\) and \(|1\rangle\), are 90° apart as vectors. We want them at opposite ends of our picture, 180° apart, because they are perfectly distinguishable. So every angle between state vectors is doubled when we draw it. The formula uses \(\theta/2\) so that \(\theta\) itself is the angle in the picture.
The Bloch vector of \(\cos\tfrac\theta2|0\rangle+e^{i\varphi}\sin\tfrac\theta2|1\rangle\) is the point of the unit sphere with polar angle \(\theta\) (measured from the north pole) and azimuth \(\varphi\):
$$\vec r=(x,\;y,\;z)=\big(\sin\theta\cos\varphi,\;\;\sin\theta\sin\varphi,\;\;\cos\theta\big).$$Every qubit state corresponds to exactly one point of the sphere, and every point to exactly one state (up to global phase).
| state | \(\theta\) | \(\varphi\) | \((x,y,z)\) | where |
|---|---|---|---|---|
| \(|0\rangle\) | \(0\) | any | \((0,0,1)\) | north pole |
| \(|1\rangle\) | \(\pi\) | any | \((0,0,-1)\) | south pole |
| \(|+\rangle\) | \(\pi/2\) | \(0\) | \((1,0,0)\) | equator, \(+x\) |
| \(|-\rangle\) | \(\pi/2\) | \(\pi\) | \((-1,0,0)\) | equator, \(-x\) |
| \(|{+i}\rangle\) | \(\pi/2\) | \(\pi/2\) | \((0,1,0)\) | equator, \(+y\) |
| \(|{-i}\rangle\) | \(\pi/2\) | \(3\pi/2\) | \((0,-1,0)\) | equator, \(-y\) |
Find the Bloch vector of \(\tfrac12|0\rangle+\tfrac{\sqrt3}{2}e^{i\pi/4}|1\rangle\).
Find the Bloch vector of \(|\psi\rangle=\tfrac35|0\rangle+\tfrac{4i}{5}|1\rangle\).
The amplitudes are already in standard form: \(\cos(\theta/2)=\tfrac35\), \(\sin(\theta/2)=\tfrac45\), and \(e^{i\varphi}=i\), so \(\varphi=\pi/2\). The double-angle formulas give the Bloch coordinates without finding \(\theta\) itself:
$$z=\cos\theta=\cos^2\frac\theta2-\sin^2\frac\theta2=\frac{9}{25}-\frac{16}{25}=-0.28,$$ $$\sin\theta=2\sin\frac\theta2\cos\frac\theta2=\frac{24}{25}=0.96 .$$With \(\varphi=\pi/2\), \(x=0.96\cos\tfrac\pi2=0\) and \(y=0.96\sin\tfrac\pi2=0.96\). So \(\vec r=(0,\;0.96,\;-0.28)\). Check: \(0^2+0.96^2+0.28^2=0.9216+0.0784=1\).
Now compare those coordinates with Example 3.2: \(P(0)-P(1)=0.36-0.64=-0.28\), \(P(+)-P(-)=0.5-0.5=0\), and \(P({+i})-P({-i})=0.98-0.02=0.96\). That is not a coincidence.
For any qubit state with Bloch vector \((x,y,z)\),
$$z=P(0)-P(1),\qquad x=P(+)-P(-),\qquad y=P({+i})-P({-i}),$$where each difference comes from measuring in the Z, X or Y basis respectively. Equivalently, \(P(0)=\tfrac{1+z}{2}\), \(P(+)=\tfrac{1+x}{2}\) and \(P({+i})=\tfrac{1+y}{2}\).
Write \(c=\cos(\theta/2)\) and \(s=\sin(\theta/2)\), so the state is \((c,\;e^{i\varphi}s)\).
Z. \(P(0)-P(1)=c^2-s^2=\cos\theta=z\).
X. \(\langle\pm|\psi\rangle=\tfrac{1}{\sqrt2}(c\pm e^{i\varphi}s)\), so
$$P(\pm)=\frac12\big|c\pm e^{i\varphi}s\big|^2=\frac12\big(c^2+s^2\pm2cs\cos\varphi\big)=\frac12\big(1\pm\sin\theta\cos\varphi\big),$$and \(P(+)-P(-)=\sin\theta\cos\varphi=x\).
Y. The same computation with \(\langle{\pm i}|=\tfrac{1}{\sqrt2}(1\;\;\mp i)\) is exercise 4.
A state has Bloch vector \((0.48,\ 0.64,\ 0.6)\). What are the outcome probabilities in the standard basis?
This proposition changes what the sphere means. The Bloch vector is not only a drawing of the amplitudes; it is a summary of three experiments. Measure many copies in each of the three bases, compute three differences of frequencies, and you have estimated the state. This is state tomography, and you will do it in Lab 2. More generally, for any two states the overlap is
$$|\langle\chi|\psi\rangle|^2=\frac{1+\vec r_\chi\cdot\vec r_\psi}{2},$$which contains Proposition 3.3 as the special cases \(|\chi\rangle=|0\rangle,|+\rangle,|{+i}\rangle\). We will prove it in Lecture 18.
The overlap formula explains the most common confusion about the sphere. Two states are orthogonal, and therefore perfectly distinguishable, exactly when \(\vec r_\chi\cdot\vec r_\psi=-1\), which means their Bloch vectors point in opposite directions. Orthogonal states are antipodal, not at right angles. Two states at right angles on the sphere, such as \(|0\rangle\) and \(|+\rangle\), have overlap \(\tfrac12\): measuring one in the other's basis is a coin toss.
Which state is orthogonal to \(|{+i}\rangle\)?
The sphere invites a tempting mistake. A qubit's state is a point on a continuous sphere, described by two real numbers with unlimited decimal places. Can we store a whole library in \(\theta\) and \(\varphi\) and read it back?
No. Every measurement of a qubit returns one bit, 0 or 1, and destroys the state it measured. From one copy you learn one bit about \(\theta\) and \(\varphi\), and no clever choice of basis changes that. Estimating the angles precisely requires many copies, and the precision grows only like the square root of the number of copies, exactly as in Section 3. (A theorem of Alexander Holevo from 1973 makes this airtight: \(n\) qubits can deliver at most \(n\) bits of classical information.) The continuum inside a qubit is real, and quantum algorithms exploit it through interference, but it cannot simply be read out.
Take the four states \(|0\rangle,|1\rangle\) (poles) and \(|+\rangle,|-\rangle\) (equator). Someone who does not know which pair was used must guess a basis. Guessing wrong gives a 50/50 random answer, because poles and equator are at right angles on the sphere, and the measurement collapses the state onto the wrong axis, which leaves detectable damage. This is the whole idea of the BB84 key-distribution protocol (Lecture 20): an eavesdropper cannot read the key without disturbing it, and the disturbance is visible in the statistics.
import numpy as np
psi = np.array([3/5, 4j/5])
r = 1/np.sqrt(2)
bases = {"Z": ([1, 0], [0, 1]),
"X": ([r, r], [r, -r]),
"Y": ([r, 1j*r], [r, -1j*r])}
for name, (b0, b1) in bases.items():
p0 = abs(np.vdot(b0, psi))**2 # Born rule: |<b|psi>|^2
p1 = abs(np.vdot(b1, psi))**2
print(name, round(p0, 4), round(p1, 4), " difference:", round(p0 - p1, 4))
Z 0.36 0.64 difference: -0.28 X 0.5 0.5 difference: 0.0 Y 0.98 0.02 difference: 0.96
The three differences are the Bloch vector \((x,y,z)=(0,\,0.96,\,-0.28)\), read off in the order z, x, y (Proposition 3.3).
import numpy as np from qiskit.quantum_info import Statevector, Pauli psi = Statevector([3/5, 4j/5]) print(psi.probabilities()) # Born rule, standard basis psi.seed(7) # fix the random sampler counts = psi.sample_counts(shots=1000) # what an experiment actually returns print({str(k): int(v) for k, v in counts.items()}) bloch = [psi.expectation_value(Pauli(p)).real for p in "XYZ"] print(np.round(bloch, 4)) # Bloch vector (x, y, z) shifted = Statevector(np.exp(0.7j) * psi.data) # multiply by a global phase print(psi.equiv(shifted)) # same physical state?
[0.36 0.64]
{'0': 366, '1': 634}
[ 0. 0.96 -0.28]
True
expectation_value(Pauli("Z")) is exactly \(P(0)-P(1)\), and likewise for X and Y, which is Proposition 3.3 in one line. equiv compares states up to global phase.
Next time: gates as rotations of the Bloch sphere, measuring in other bases on real hardware, and the launch of Lab 1. HW2 is posted.
probabilities, sample_counts, expectation_value, equiv).all numbers and figures in these notes are computed in python (verify_L03.py) and follow the page theme