03 — Inner Product vs Gate-Then-Measure

Two equivalent ways to compute the probability of a measurement outcome in a different basis. The math says the same thing; the framing differs.

Section I

The Setup

We have a quantum state $\ket{\psi}$ and want to find the probability of a specific measurement outcome, say $\ket{+}$.

The core formula is:

$$P(\text{outcome } \ket{x}) = |\braket{x}{\psi}|^2$$

This is the inner product (bracket) between the target outcome and the state, squared. Simple in principle — let's make sure it's simple in practice too.

The Six Standard States

Three bases, two states each. These are the building blocks:

Z-basis
$\ket{0} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$
$\ket{1} = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$
X-basis
$\ket{+} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{2}}(\ket{0} + \ket{1})$
$\ket{-} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \end{pmatrix} = \frac{1}{\sqrt{2}}(\ket{0} - \ket{1})$
Y-basis
$\ket{+i} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ i \end{pmatrix} = \frac{1}{\sqrt{2}}(\ket{0} + i\ket{1})$
$\ket{-i} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -i \end{pmatrix} = \frac{1}{\sqrt{2}}(\ket{0} - i\ket{1})$
Key detail for inner products: $\bra{x}$ is the conjugate transpose of $\ket{x}$. For $\ket{+} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix}$, the bra is $\bra{+} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\end{pmatrix}$. When components are complex (like $\ket{+i}$), you must conjugate: $\bra{+i} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & -i\end{pmatrix}$.
Section II

Worked Examples — Side by Side

For each example, the left card uses the inner product (pen-and-paper approach) and the right card shows the gate-then-measure circuit equivalent. Both always produce the same answer.

The Hadamard gate: $H = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1 \\ 1 & -1\end{pmatrix}$  —  maps $\ket{+} \to \ket{0}$ and $\ket{-} \to \ket{1}$. So measuring in the X-basis is the same as applying $H$ first, then measuring in the Z-basis.
Example 1  —  $\ket{\psi} = \ket{0}$,   find $P(\text{outcome } \ket{+})$
Inner Product

Compute $\braket{+}{0}$:

$$\bra{+} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\end{pmatrix}$$
$$\braket{+}{0} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix} = \frac{1}{\sqrt{2}}(1 \cdot 1 + 1 \cdot 0) = \frac{1}{\sqrt{2}}$$
$$P = \left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}$$
Gate-Then-Measure

Apply $H$ to $\ket{0}$, then read off $P(\ket{0})$:

$$H\ket{0} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\\1 & -1\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix}$$
$$= \frac{1}{\sqrt{2}}\ket{0} + \frac{1}{\sqrt{2}}\ket{1}$$
$$P(\ket{0}) = \left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}$$
Both methods give $P = 1/2$
Example 2  —  $\ket{\psi} = \ket{+}$,   find $P(\text{outcome } \ket{+})$
Inner Product

Compute $\braket{+}{+}$:

$$\braket{+}{+} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\end{pmatrix} \cdot \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix}$$
$$= \frac{1}{2}(1 \cdot 1 + 1 \cdot 1) = \frac{1}{2} + \frac{1}{2} = 1$$
$$P = |1|^2 = 1$$
Gate-Then-Measure

Apply $H$ to $\ket{+} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix}$:

$$H\ket{+} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\\1 & -1\end{pmatrix}\frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix} = \frac{1}{2}\begin{pmatrix}2\\0\end{pmatrix} = \begin{pmatrix}1\\0\end{pmatrix}$$
$$= 1\cdot\ket{0} + 0\cdot\ket{1} = \ket{0}$$
$$P(\ket{0}) = |1|^2 = 1$$
Both methods give $P = 1$ — guaranteed outcome, as expected
Example 3  —  $\ket{\psi} = \ket{-}$,   find $P(\text{outcome } \ket{+})$
Inner Product

Compute $\braket{+}{-}$:

$$\braket{+}{-} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\end{pmatrix} \cdot \frac{1}{\sqrt{2}}\begin{pmatrix}1\\-1\end{pmatrix}$$
$$= \frac{1}{2}(1 \cdot 1 + 1 \cdot (-1)) = \frac{1}{2} - \frac{1}{2} = 0$$
$$P = |0|^2 = 0$$
Gate-Then-Measure

Apply $H$ to $\ket{-} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\-1\end{pmatrix}$:

$$H\ket{-} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\\1 & -1\end{pmatrix}\frac{1}{\sqrt{2}}\begin{pmatrix}1\\-1\end{pmatrix} = \frac{1}{2}\begin{pmatrix}0\\2\end{pmatrix} = \begin{pmatrix}0\\1\end{pmatrix}$$
$$= 0\cdot\ket{0} + 1\cdot\ket{1} = \ket{1}$$
$$P(\ket{0}) = |0|^2 = 0$$
Both methods give $P = 0$ — orthogonal states, zero probability
Example 4  —  $\ket{\psi} = \tfrac{1}{2}\ket{0} + \tfrac{i\sqrt{3}}{2}\ket{1}$,   find $P(\text{outcome } \ket{+})$
Inner Product

Compute $\braket{+}{\psi}$:

$$\ket{\psi} = \begin{pmatrix}1/2 \\ i\sqrt{3}/2\end{pmatrix}$$
$$\braket{+}{\psi} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\end{pmatrix}\begin{pmatrix}1/2\\i\sqrt{3}/2\end{pmatrix}$$
$$= \frac{1}{\sqrt{2}}\left(\frac{1}{2} + \frac{i\sqrt{3}}{2}\right) = \frac{1+i\sqrt{3}}{2\sqrt{2}}$$

Now take the modulus squared. For a complex number $a + bi$: $|a+bi|^2 = a^2 + b^2$.

$$\left|\frac{1+i\sqrt{3}}{2\sqrt{2}}\right|^2 = \frac{1^2 + (\sqrt{3})^2}{(2\sqrt{2})^2} = \frac{1+3}{8} = \frac{4}{8}$$
$$P = \frac{1}{2}$$
Gate-Then-Measure

Apply $H$ to $\ket{\psi} = \begin{pmatrix}1/2\\i\sqrt{3}/2\end{pmatrix}$:

$$H\ket{\psi} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\\1 & -1\end{pmatrix}\begin{pmatrix}1/2\\i\sqrt{3}/2\end{pmatrix}$$
$$= \frac{1}{\sqrt{2}}\begin{pmatrix}1/2 + i\sqrt{3}/2 \\ 1/2 - i\sqrt{3}/2\end{pmatrix} = \begin{pmatrix}\frac{1+i\sqrt{3}}{2\sqrt{2}} \\ \frac{1-i\sqrt{3}}{2\sqrt{2}}\end{pmatrix}$$

The amplitude for $\ket{0}$ is $\alpha = \frac{1+i\sqrt{3}}{2\sqrt{2}}$.

$$|\alpha|^2 = \frac{1^2 + (\sqrt{3})^2}{(2\sqrt{2})^2} = \frac{4}{8}$$
$$P(\ket{0}) = \frac{1}{2}$$
Both methods give $P = 1/2$ — even with complex amplitudes, same result
Section III

Why It Works — The Connection

The Hadamard gate maps the X-basis to the Z-basis:

$$H\ket{+} = \ket{0}, \qquad H\ket{-} = \ket{1}$$

So the probability of measuring $\ket{+}$ (an X-basis outcome) is the same as applying $H$ first and then measuring $\ket{0}$ (a Z-basis outcome). In general, for any basis change $U$ that maps $\ket{x} \to \ket{0}$:

$$P(\text{outcome } \ket{x}) = |\braket{x}{\psi}|^2 = |\bra{0}U\ket{\psi}|^2 = P(\text{outcome } \ket{0} \text{ after } U)$$

The gate-then-measure pattern is just a change of basis implemented physically on the qubit, so that a standard Z-measurement gives you the answer you wanted in the other basis.

Section IV

Summary

Inner Product $\braket{x}{\psi}$

  • The ground-truth math
  • Direct: take bra, multiply by ket, square
  • Pen-and-paper method used in exercises
  • Works for any basis, any dimension
  • No physical hardware needed

Gate-Then-Measure

  • The engineering implementation
  • Apply a gate that maps your target basis to Z-basis
  • Then do a standard measurement
  • Used in actual quantum circuits
  • Same probabilities, different framing

Both give identical probabilities, always. Exercises use inner products; circuits use gates. Same math, different packaging.