Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2010/iii/paper-49/3/a/solution

Number the wires from top to bottom as . The first two controlled-NOT gates encode into the bit-flip repetition code
on data wires . The lower two zero ancillas store an error syndrome. Reading the PDF's four detection CNOTs gives
The syndrome and the data qubit to be flipped are therefore
This is coherent syndrome extraction for the three-qubit repetition code. The recovery Toffoli gates implement these conditions; the intervening Pauli X gates temporarily turn zero-valued controls into one-valued controls and then restore the syndrome wires. Finally, inverse encoding returns the logical state to the top wire and resets data wires 2 and 3 to zero.
For the specified error , the encoded data becomes . Both terms have syndrome , so detection factors out without revealing the logical amplitudes. Recovery flips data wire 1, restoring , and decoding yields
The lower four wires need not all return to zero: their syndrome record is independent of the logical state, which is what the correction requirement needs.

New to topics? Read the docs here!