Single-qubit gates
You have already used , and as buttons. This lesson says what a gate is, so that you can work out what any circuit does.
A gate is a matrix
Section titled “A gate is a matrix”A state is a column vector of two amplitudes. A gate is a matrix, and applying the gate means multiplying the vector by the matrix.
The three gates you have met are
For example, acting on a general state swaps the two amplitudes:
A useful shortcut: the first column of a gate’s matrix is what it does to , and the second column is what it does to . Reading the columns of gives and , as before.
Because gates are matrices, they are linear. Once you know what a gate does to and , you know what it does to every state:
Which matrices are allowed
Section titled “Which matrices are allowed”A gate must turn valid states into valid states, so it has to preserve normalisation. The matrices that do this are exactly the unitary matrices, those satisfying
where is the conjugate transpose of : flip the matrix across its diagonal and take the complex conjugate of each entry.
One consequence is that every gate can be undone, because is its inverse. Quantum computation is reversible, right up to the moment you measure.
Which of these matrices is not a valid quantum gate?
It sends to , which is not normalised. The others are , and .
Building gates from other gates
Section titled “Building gates from other gates”Putting gates one after another multiplies their matrices. In the last lesson you found that , then , then takes to . In fact the three together are exactly the gate , on every input:
The puzzles below are of a new kind. It is no longer enough to produce the right state from . Your circuit has to behave like the target gate on every input, and the table shows what it does to each basis state.
Using only and , build a circuit that acts as .
This puzzle needs JavaScript.
Hint
Start from and multiply by on the left and on the right. Remember that .
The pair of identities and says that translates between the two gates. It is worth remembering.
Phase gates
Section titled “Phase gates”multiplies the amplitude of by . Two more gates do the same kind of thing with a different factor:
Since , applying twice gives . Likewise .
Every gate has an inverse. Build the inverse of , the gate that sends to , using only itself.
This puzzle needs JavaScript.
Hint
What is ?
Global phase does not matter
Section titled “Global phase does not matter”There is a fourth gate in the same family as and :
Try to build it.
Using only and , build a circuit that acts as . Then compare the two columns of the table closely.
This puzzle needs JavaScript.
Your circuit was accepted even though its outputs differ from the target’s by a factor of or . That is deliberate.
Multiplying a whole state by a number of magnitude one, such as or or , is called changing its global phase. It has no observable effect. The Born rule only uses squared magnitudes, and a later gate carries the same factor through unchanged, so no experiment can detect it. The states and are physically the same state.
Compare this with the relative phase from the last lesson. In the minus sign multiplies only one term, and that can be detected. The rule is:
- a phase on the whole state is unobservable,
- a phase on part of the state is real physics.
An exercise
Section titled “An exercise”Exercise. Show that is unitary, and that it is its own inverse.
Solution
is real and symmetric, so . Then
So is unitary, and since it undoes itself.
Remember it
Section titled “Remember it”What property must the matrix of every quantum gate have?
It must be unitary: . This keeps states normalised and makes every gate reversible.
What do and do to the basis states?
swaps and . leaves alone and sends to .
What single gate equals ?
. Likewise .
What is a global phase, and can it be measured?
A factor multiplying the whole state. No measurement can detect it.
How are , and related?
and . They put phases , and on .