Quantum Computing Is Different
By: Frank Zickert, Quantum Machine Learning
Tags: Mathematics, Computer Science, Quantum Computing, Python, Programming

Quantum Computing Is Different

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Quantum computing is fundamentally different from classical computing. To master quantum computing you must unlearn what you have learned.

Image by Author, Frank Zickert

It starts with the quantum superposition. Unlike a classical bit, a quantum bit (qubit) is not 0 or 1. Unless you measure it, the qubit is in a complex linear combination of 0 and 1. But when you measure it, the quantum superposition collapses and the qubit is either 0 or 1, as a classical bit.

It continues with quantum entanglement. Two qubits can share a state of superposition. Once you measure one qubit, its entangled fellow instantly jumps to a different state of superposition. Even if it is light-years away. It seems to know a measurement has taken place and it takes on a state that acknowledges the measured value.

When starting with quantum computing, we’re tempted to focus on the possibilities that arise from superposition and entanglement. But quantum computing does not simply add new features we can use. It is a fundamentally different way of computing. And it requires a different kind of programs.

Classically, we think about input, transformational boolean logic, and output. But this thinking will not let us succeed in quantum computing. Classical control structures are a dead-end.

Let’s take one of the simplest operators in classical computing, the assignment.

my_var = 1

copy_of_my_var = my_var

print (my_var, copy_of_my_var)

We can use the assignment operator to create a copy of a variable. The value of the variable doesn’t matter. We can create a copy of it.

In a classical program, we rely on this ability to copy data. A lot. In a classical circuit, this is the fan-out operation. In electrical engineering, we have wires. If there is a voltage at a certain time, we interpret it as 1. If there is no voltage, it is 0. We can connect another wire to it. We will receive the same output at both ends.

Image by author, Frank Zickert

Copying data is useful in manifold ways. We can use copies as inputs to different operators. In the half-adder, for instance, we copy the input in order to use it in two different operators.

Image by author, Frank Zickert

And, we can use the copies to evaluate the state at different parts of the program at different times. This would be particularly useful in quantum computing.

In a previous post, we learned how to change the measurement probabilities of a qubit by rotating it around the y-axis. We got to know the angle θ and it controls the probability of measuring the qubit as 0 or 1. But we struggled with the problem that θ is the angle between the vector |ψ⟩ and the basis state vector |0⟩. But if the qubit is not in the basis state |0⟩ then the same value of θ represents a different probability change. For the gradients of trigonometric functions (such as sine and arcsine) are not constant, the probability an angle represents that starts at the top of the circle (state |0⟩) is another probability that the same angle represents that starts at the horizontal axis such as the state |+⟩. In order to calculate the correct angle, we need to consider the state the qubit is currently in.

But measuring the qubit state collapses it to either 0 or 1 . Measuring effectively destroys the qubit superposition. But, if you're not allowed to measure the qubit, how could you specify the prior probability?

Wouldn’t it be good, to create a copy of the qubit before we measure it? We would measure one copy of the qubit while continuing to work with the other copy.

Image by Author, Frank Zickert

So, let’s have a look at the respective operator, the fan-out. In a classical circuit, one input wire connects to two output wires. It effectively copies a bit. In quantum computing, we use transformation gates and we use the word cloning for the analogous idea of copying a qubit.

The following figure depicts the diagram of a cloning transformation gate.

Image by author, Frank Zickert

It clones a qubit in the state |0⟩.

2. It clones a qubit in the state |1⟩.

3. It clones an arbitrary qubit |ψ⟩.

The superposition state of a single-qubit consists of two basis states (|0⟩ and |1⟩) and two corresponding probability amplitudes α and β.

The squares of the amplitudes represent the probabilities of measuring the qubit as either 0 (given by α^2) or 1 (given by β^2). The sum of all probabilities is 1:

The cloning transformation gate works with two qubits. Let’s call them |a⟩ and |b⟩. Each of the two qubits has its own probability amplitudes:

and

If we look at these two qubits concurrently, there are four different combinations of the basis states (|0⟩|0⟩, |0⟩|1⟩, |1⟩|0⟩, and |1⟩|1⟩). And each of these combinations has its own probability amplitude that is the product of the probability amplitudes of the two qubits’ corresponding probability amplitudes. The following equation depicts our qubit system (|a⟩|b⟩) that has four possible states and corresponding probability amplitudes.

This equation lets us represent and reason about a system that consists of two qubits. Let’s use them to clone the state |ψ⟩=α|0⟩+β|1⟩.

We start with applying the cloning transformation gate to the arbitrary qubit.

It results in two qubits in the same state |ψ⟩.

Let’s rewrite the two qubits. Since both qubits are equal, we can say that

We represent the qubit state as the sum of each state we could possibly measure with its respective probability amplitude. This is the result of cloning a qubit.

Next, let’s first expand our arbitrary qubit |ψ⟩.

We multiply out the inner term.

Since the application of G is a matrix multiplication, we can apply the distributive law of matrix algebra.

Finally, we apply the initial specifications of how G transforms the basis states |0⟩ and |1⟩

We get another result of cloning a qubit in an arbitrary state. However, these two results of the cloning transformation gate are not equal

Conclusion

If the cloning transformation gate G exists, then two terms that are not equal must be equal. This is a contradiction. The only logical conclusion is that G can’t exist. Therefore, it is impossible to clone a qubit of an arbitrary state.

This is known as the no-cloning theorem. It has important consequences.

In classical computing, we rely heavily on the ability to copy. Even the simplest classical operation, the addition, relies on copying bits. But in quantum computing, it is impossible.

In quantum computing, we simply can’t use the information stored in a qubit as many times as we want to. In fact, the idea of cloning a qubit in an arbitrary state would contradict the underlying concept of superposition. Measuring a qubit collapses its state of superposition. But when we could clone a qubit, we could measure its state indirectly. We could measure the clones without collapsing the original qubit.

This might look like a serious problem. It is a serious problem if we continue to think classically. We need to unlearn how to solve a certain type of problem programmatically. When we want to use the unique characteristics of quantum computing, such as superposition, entanglement, and interference, we need to learn a new way of solving problems.

This post is part of the book: Hands-On Quantum Machine Learning With Python.

Get the first three chapters for free here.