Principles of Superconducting Quantum Computers. Daniel D. Stancil
result is not cloning because the two qubits are entangled. We did not succeed in creating two independent copies of |ψ⟩. This is a useful construct, however, and can be extended to create n-qubit states that look like this:
These states will be useful for quantum error correction codes (Chapter 10).
1.8 Example: Deutsch’s Problem
We now have enough quantum computing “machinery” to work out a simple example of a quantum algorithm. The example algorithm is admittedly not very useful, but it provides some important insights into how quantum computers can outperform classical computers.
Consider a function that takes a single binary digit as input, and provides a single binary digit as output. There are four possible functions: f1(x)=0, f2(x)=1, f3(x)=x, and f4(x)=x¯. Suppose someone gave us an implementation of one of these functions in a black box, and asked us to determine whether f(0)=f(1), or if f(0)≠f(1). Classically, we could do this in two function calls, one with x = 0, and one with x = 1. However, using a quantum algorithm we can answer this question with a single function call! Let’s see how this could be done.
First, suppose that we have the gate U shown in Figure 1.8(a) for implementing the function f(x). The function is implemented by changing the sign of the state: if f(x)=0 then the sign is unchanged, and if f(x)=1 then the sign of the state is flipped. We will return to the question of how to implement this gate shortly, but for now let us assume that the gate is given to us, and our job is to determine if f(0)=f(1) or f(0)≠f(1). Now consider the circuit shown in Figure 1.8(b). Applying the Hadamard gate to the input |0⟩ gives
Figure 1.8 Conceptual illustration of the Deutsch Problem.
Note that the Hadamard gate enables us to apply U to both |0⟩ and |1⟩ at the same time. This is referred to as quantum parallelism and is one of the secrets behind the power of quantum computing (although there are some key qualifications that make this somewhat less exciting than it would seem at first!).
Continuing with the calculation, we next compute ψ2=Uψ1 to obtain
Applying the second Hadamard gate gives the final output:
Examining (1.67), we see that if f(0)=f(1) the second term vanishes and the output is |0⟩. In contrast, when f(0)≠f(1), then the first term vanishes and the output is ±|1⟩. Therefore, if we measure the output as |0⟩, we know that f(0)=f(1), while if we measure |1⟩, we know that is not the case. (Our measuring device will ignore the minus sign and show us a result of “1” if the output state is −|1⟩.)
Arranging for the amplitudes of the correct states to add and others to cancel is an example of quantum interference, another key principle underlying quantum computing. So we see that in a single function call, we are able to determine whether or not f(x) is balanced or constant—a feat that would only be possible classically with two function calls!
Now let us turn our attention to how the gate U can be realized. First, we have to confess that the circuit in Figure 1.8 is hiding something: we need another qubit to implement the U gate.
Consider the function f(x)=0. We want a unitary Uf that converts |x⟩ to |f(x)⟩, but this is clearly not reversible. Given an output of |0⟩, there’s no way to know whether the input is |1⟩ or |0⟩. To make the function reversible, we need to include both f(x) and x in the output, so that we can reconstruct the input when reversing the operation.
For two outputs, we need two inputs. We typically use |0⟩ as second input, but to be more general, let’s assume that the second input can be any input |y⟩. With |x⟩ and |y⟩ as the inputs, the outputs will be |x⟩ and |y ⊕ f(x)⟩, where ⊕ is the standard Boolean exclusive-OR (XOR) operation. As shown in Figure 1.9, this function is its own inverse; if we use |x⟩ and |y⊕f(x)⟩ as the input, we get |x⟩ and |y ⊕ f(x) ⊕ f(x)⟩ = |y⟩ as the output.
Figure 1.9 Reversible circuit for calculating f(x).
Figure 1.10 shows the four alternative implementations of Uf, depending on which version of f(x) we want. From left to right:
f1(x)=0, do nothing to y, equivalent to y⊕0.
f2(x)=1, flip y using a NOT gate, equivalent to y⊕1.
f3(x)=x, use a CNOT gate to flip y if x = 1, equivalent to y⊕x.
f4(x)=x¯, flip x and then XOR with y using a CNOT gate, equivalent to y⊕x¯. We then use another NOT gate to restore x to its original value.
Figure 1.10 Implementations of black-box function Uf for