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 is applied to a quantum state and then the gate is applied to the output of the first gate. Explain why the output from this circuit is and not$.$

Answer: Applying the gate to the quantum state is equivalent to multiplying the state vector (where and are complex values) by the 2 by 2 matrix .

By the rules of matrix multiplication this multiplication occurs from the left as and produces a two element column vector as a result, representing the output quantum state .

Applying the second gate to that result again requires multiplying that two-element column vector by the matrix from the left as . That produces another two-element column vector representing the final quantum state output from the quantum circuit.

We thus have

In contrast, the expression amounts to first applying the gate to and then applying the Hadamard gate afterward, the opposite of the given circuit.