Useful qubits must remain **coherent** for as long as possible. The goal of this tutorial is to understand what this means. You can learn how one can check whether a qubit remained coherent, and how the process of **decoherence** can be modeled with our quantum circuit simulator.

*Prerequisite Tutorials:*

• The Basics of Quantum Mechanics

• Quantum Algorithms & Quantum Circuits

• Superpositions, Randomness & Interference

Open the quantum circuit simulator in a separate window

Useful qubits must remain **coherent** to be useful for quantum computation. Qubits can become **incoherent** through a process called **decoherence**; when this happens, they can no longer be used for quantum algorithms. Thus *coherent* qubits are desirable, and *decoherence* is to be prevented at all costs. The degradation process of decoherence is triggered by “accidental measurements”, i.e., when information about the qubit leaks into the environment. Here we illustrate with a simple example how one can check whether a qubit remained coherent, and how the process of decoherence can be modeled with our quantum circuit simulator.

In a previous tutorial we discussed the effect of **interference**, i.e., the cancellation of positive and negative amplitudes in superposition states. We illustrated this phenomenon with the following simple quantum circuit:

When we applied the Hadamard gate twice, we found that the second one undoes the superposition created by the first one so that we measured the qubit in its initial state $\ket{0}$ with certainty.

This exact cancellation of amplitudes only worked because in between the two Hadamard gates the qubit state was not altered. If it were modified only slightly, the cancellation would no longer be perfect and the interference would fail. This failure of interference would be indicated by a non-zero probability to find the qubit in state $\ket{1}$ at the end. We can therefore use interference experiments to check whether a qubit leaked information or whether it remained unperturbed. If the probability to find $\ket{1}$ after the second Hadamard gate is zero, we say that the qubit remained **coherent** between the two Hadamard gates.

To represent the waiting time between the two gates, let us add a few identity gates $I$ between them:

Because the identity gates are “do nothing operations”, the histogram should not change by this modification, i.e., the interference remains perfect and the qubit coherent during the algorithm.

Now we would like to simulate a process where information about the qubit leaks into the environment during the interference experiment, i.e., between the two Hadamard gates. To this end, we use an additional qubit to represent the environment, so click ` + `

to add another qubit. We are not interested in the measurement outcome of this qubit as it is a stand-in for the environment — and we typically do not know what the environment “knows”. Disposable qubits like this that are only used “internally” to make an algorithm work are called **ancillas**. We refer to this ancilla as *environment* henceforth to distinguish it from the qubit used for the interference experiment (which we simply call *the* qubit).

If you let the algorithm

run, the result will not change, of course. The qubit still remains coherent because there is no coupling between the qubit and the environment. This is the dream of every quantum engineer: the qubits you care about are completely decoupled from the environment and remain coherent for as long as you want. Unfortunately, it is impossible to achieve this in practice. If you wait long enough, some information will eventually leak out (for example by a random photon bouncing of your qubit).

To simulate this, let us connect the qubit with a Controlled-NOT gate to the environment. Since we want the environment to *gain* information, but *not change* the state of the qubit, make sure that the *control* of the Controlled-NOT gate (the $\bullet$ symbol) is on the qubit, and the *target* (the $\oplus$ symbol) is on the ancilla:

Now the ancilla is flipped from $\ket{0}$ to $\ket{1}$ if and only if our qubit is in state $\ket{1}$. The state of the qubit is not changed. So the environment gains knowledge about the state of the qubit during the interference experiment.

Observe the histogram of this circuit and compare it to the previous ones. You can also try to change the position of the Controlled-NOT gate and observe what happens. What is the probability to find the qubit in state $\ket{1}$?

## Explanation

The chance of finding the qubit in state $\ket{1}$ is given by the *sum* of the probabilities for the output state $\ket{0\underline 1}$ and $\ket{1\underline 1}$ because we do not care in which state the *ancilla* is measured (we underlined the state of the qubit `q[0]`

which we used for the interference experiment). In probability theory, such a sum is called a **marginal**. In quantum physics, this procedure is called “**tracing out the ancilla**“.

If you implemented the quantum circuit correctly, there should now be a **50% chance** to find the qubit after the second Hadamard gate in state $\ket{1}$, a result that would be impossible if the qubit had not been coupled to the environment between the two Hadamard gates. This means that there is no interference anymore that cancels positive and negative amplitudes, i.e., the qubit lost its coherence — it *decohered*. Note that the measurement results for the qubit changed although the Controlled-NOT gate never flipped it (remember that we used it as *control*, not as *target*!).

The maximal time one can wait between the two Hadamard gates without destroying the interference (equivalently: loosing the coherence) is an important number that quantifies the “quality” of a qubit and is called the **coherence time**. When building a quantum computer, it is important to make the coherence time of the qubits as long as possible (this is one of the experimentally most challenging obstacles when building a quantum computer). Typical coherence times on the QRydDemo platform are of order 10 milliseconds. Unfortunately, this is only true if we don’t do anything with the qubits. But of course we want to *apply gates* so that we can use the qubits to run quantum algorithms. As one would expect, the application of gates increases the probability of unwanted interactions and therefore lowers the coherence time significantly. This is a general problem that all quantum computing platforms are struggling with (and it is the main reason why quantum computers that are really useful do not yet exist): The application of gates introduces so many errors and makes the qubits decohere so quickly that only very short quantum algorithms can be executed (and these are not very useful).

Fortunately there is an escape route (at least in theory): There are ingenious ways to *combine* several “bad” qubits with short coherence times into a single “good” qubit with a longer coherence time. This procedure is called **quantum error correction** and will the topic of an upcoming tutorial.

Ⓒ2023 Tutorial by Nicolai Lang, Institute for Theoretical Physics III, University of Stuttgart