Quantum Country exercise 3

This is one in a series of posts working through the exercises in the Quantum Country online introduction to quantum computing and related topics. The exercises in the original document are not numbered; I have added my own numbers for convenience in referring to them.

Exercise 3. Consider a quantum circuit in which first the Hadamard gate $H$ is applied to a quantum state $\vert \psi \rangle$ and then the $X$ gate is applied to the output of the first gate. Explain why the output from this circuit is $XH \vert \psi \rangle$ and not

Answer: Applying the gate $H$ to the quantum state $\vert \psi \rangle$ is equivalent to multiplying the state vector $\begin{bmatrix} \psi_1 \\ \psi_2 \end{bmatrix}$ (where $\psi_1$ and $\psi_2$ are complex values) by the 2 by 2 matrix $\frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}$.

By the rules of matrix multiplication this multiplication occurs from the left as $H \vert \psi \rangle$ and produces a two element column vector as a result, representing the output quantum state $\vert \psi' \rangle$.

Applying the second gate $X$ to that result again requires multiplying that two-element column vector by the matrix $\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$ from the left as $X \vert \psi' \rangle$. That produces another two-element column vector representing the final quantum state $\vert \psi'' \rangle$ output from the quantum circuit.

We thus have

$\vert \psi'' \rangle = X \vert \psi' \rangle = X (H \vert \psi \rangle) = XH \vert \psi \rangle$

In contrast, the expression $HX \vert \psi \rangle$ amounts to first applying the gate $X$ to $\vert \psi \rangle$ and then applying the Hadamard gate $H$ afterward, the opposite of the given circuit.

This entry was posted in quantum country. Bookmark the permalink.