QC — Control quantum computing with unitary operators, interference & entanglement

Jonathan Hui
Nov 25, 2018 · 12 min read
Photo by Sagar Dani

Great. We just finished Part 2 on Qubit (Quantum bit — the core building block for quantum computing). So how can we control it? Unlike classical computing, we don’t apply logical operations or common arithmetics on qubits. There is no “while statement” or “branching statement” in quantum computing. Instead, we develop unitary operators to manipulate qubits with the principle of interference in quantum mechanics. Sound fancy but actually very straightforward. We will look into the concept of unitary operators. As a side note, we will look into its relationship with the Schrodinger Equation so we are not designing a concept against nature. At last, we look into entanglement, a mystical quantum phenomenon.

Quantum gates

In classical computers, we apply basic logical operators (NOT, NAND, XOR, AND, OR) on bits to build up complex operations. For example, the following is a single bit adder with a carry.

Quantum computers have totally different basic operators called quantum gates. We do not recompile an existing C++ program to run on a quantum computer. Both have different operators and quantum computing requires different algorithms to take advantage of them. In quantum computing, it is all about manipulating qubits, entangling them and measuring them. Let’s go back to the Bloch sphere. Conceptually, quantum computing operations manipulates Φ and θ of the superposition to move points along the surface of the unit sphere.

Mathematical speaking, the superposition is manipulated with a linear operator U in the form of a matrix.

For a single qubit, the operator is simply a 2 × 2 matrix.

Schrodinger Equation (optional)

Nature seems naively simple! The math is just linear algebra that we learn in high school. Between measurements, states are manipulated by linear operators using matrix multiplication. When measured, the superposition collapses. Ironically, the linearity is a major disappointment for the sci-fi fans. This is a general property of quantum dynamics. Otherwise, time travel or traveling faster than light is all possible. If we start with this linear operator (a unitary operator to be exact), we can derive the Schrodinger equation, a cornerstone of quantum mechanics in describing how states evolve in quantum mechanics. From the opposite perspective, the Schrodinger equation concludes the linearity of nature.

Source

Here, we can rewrite the Schrodinger equation as

where H is a Hermitian. It demonstrates how states are evolved in nature linearly.

The equation is linear, i.e. if both ψ1 and ψ2 are valid solutions for the Schrodinger Equation,

its linear combination is the general solution of the equation.

If |0⟩ and |1⟩ are possible states of a system, its linear combination will be its general state — that is the principle of superposition in quantum computing.

Unitary

Our physical world does not allow all possible linear operators. The operator has to be unitary and meet the following requirement.

where U† is the transposed, complex conjugate of U. For example:

Mathematically, unitary operator preserves norms. This is a wonderful property to keep total probability equals to one after the state transformation and keep the superposition on the surface of the unit sphere.

If we look at the solution for the Schrodinger Equation below, nature obeys the same unitary rule. H is a Hermitian (the transposed complex conjugate of a Hermitian equals itself). Multiplying the operator with its transposed complex conjugate equals the identity matrix.

Following is an example of H where there is a uniform magnetic field E₀ in the z-direction.

Applying the unitary operation to |ψ⟩ results in a rotation in the z-axis.

But what is the real meaning of unitary in the real world? It means operations are reversible. For any possible operation, there is another one that can undo the action. Just like watching a movie, you can play it forward and nature allows its counterpart U† to play the video backward. Indeed, you may not notice whether you are playing the video forward or backward. Almost all physical laws are time-reversible. The few exceptions include the measurement in quantum dynamics and the second law of thermodynamics. When designing a quantum algorithm, this is very important. The exclusive OR operation (XOR) in a classical computer is not reversible. Information is lost. Given an output of 1, we cannot distinguish whether the original input is (0, 1) or (1, 0).

In quantum computing, we call operators as quantum gates. When we design a quantum gate, we make sure it is unitary, i.e. there will be another quantum gate that can reverse the state back to its original. This is important since

if an operator is unitary, it can be implemented in a quantum computer.

Once the unitary is proven, the engineers should not have problems to implement it, at least theoretically. For example, IBM Q computers, composed of superconducting circuits, use microwave pulses of different frequency, and duration to control qubits along the surface of the Bloch sphere.

To achieve unitary, we sometimes output part of the input to meet this requirement, like the one below even it looks redundant.

Let’s see one of the most common quantum gate, the Hadamard gate which the linear operator is defined as the following matrix.

or in the Dirac notation

When we apply the operator to an up-spin or a down-spin state, we change the superpositions to:

If it is measured, both have an equal chance to be spin up or spin down. If we apply the gate again, it goes back to the original state.

Source

i.e., the transposed conjugate of the Hadamard is the Hadamard gate itself.

When we apply U U†, it restores to the original input.

Therefore, the Hadamard gate is unitary.

Quantum computing is based on interference and entanglement. Even though we can understanding quantum computing mathematically without understanding these phenomena, let’s demonstrate it quickly.

Interference

Waves interfere with each other constructively or destructively. For example, the output can be magnified or flatten depending on the relative phase of the input waves.

What is the role of interference in quantum computing? Let’s perform some experiments.

Mach Zehnder Interferometer (source)

In the first experiment, we prepare all the inbound photons to have a polarization state |0⟩. This stream of polarized photons is split evenly by the beam splitter B position at 45°, i.e. it will be split the beam into two orthogonally polarized lights and exit in separate paths. Then we use mirrors to reflect the photons to two separate detectors and measure the intensity. From the perspective of classical mechanics, photons split into two separate paths and hit the detectors evenly.

In the second experiment above, we put another beam splitter before the detectors. By intuition, the beam splitters operate independent of each other and split a light stream into two half. Both detectors should detect half of the light beams. The probability of a photon reaching the detector D₀ using the 1-path in red is:

The total chance for a photon to reach D₀ is 1/2 from either 1-path or 0-path. So both detectors detect one-half of the photons.

But that does not match with the experimental result! Only D₀ detects light. Let’s model the state transition for a beam splitter with a Hadamard gate. So for the first experiment, the photon state after the splitter is

When it is measured, half of them will be |0⟩ and half of them will be |1⟩. The light beams are split evenly into two different paths. So our Hadamard gate will match with the classical calculation. But let’s see what is happened in the second experiment. As shown before, if we prepare all the input photons to be |0⟩ and pass them into two Hadamard gates, all the photons will be |0⟩ again. So when it is measured, only D₀ will detect the light beam. None will reach D₁ as long as we do not perform any measurement before both detectors. Experiments confirm the quantum calculation is correct, not the classical calculation. Let’s see how interference plays a role here in the second Hadamard gate.

As shown below, components of the same computation basis constructively or destructively interfere with each other to produce the correct experimental result.

We can prepare the input photon beam to be |1⟩ and redo the calculation again. The state after the first splitter is different from the original one by a phase of π. So if we measure now, both experiments will make the same measurements.

However, when applying the Hadamard gate again, one will produce |0⟩ and one will produce |1⟩. Interference produces complex possibilities.

Let me do one more fun experiment which has a very significant implication in cybersecurity.

If we put another detector Dx after the first splitter, the experiment shows both detectors will detect half of the photons now. Does that match with the calculation in quantum mechanics? In the equation below, when we add a measurement after the first splitter, we force a collapse in the superposition. The final result will be different than one without the additional detector and match with the experimental result.

Nature tells us that if you know what path the photon takes, both detectors will detect half of the photons. In fact, we can achieve that with just one detector in one of the paths only. If no measurement is done before both detectors, all photons end up in detector D₀ if the photon is prepared to be |0⟩. Again, intuition leads us to the wrong conclusion while the quantum equations remain trustful.

This phenomenon has one critical implication. The additional measurement destroys the original interference in our example. The state of a system is changed after a measurement. This is one of the key motivation behind quantum cryptography. You can design an algorithm such that if a hacker intercepts (measure) the message between you and the sender, you can detect such intrusion regardless of how gentle the measurement can be. Because the pattern of the measurement will be different if it is intercepted. The no-cloning theorem in quantum mechanics claims that one cannot duplicate a quantum state exactly. So the hacker cannot duplicate and resend the original message also.

Beyond quantum simulation

If you are a Physicist, you can take advantage of the interference behavior in quantum gates to simulate the same interference in the atomic worlds. The classical methods work with probability theory with values greater or equal zero. It assumes independence that is not true in experiments.

Quantum mechanism claims this model is wrong and introduces a model with complex and negative numbers. Instead of using probability theory, it uses interference to model the problem.

So what good does it bring for non-Physicist? The interference can be treated as the same mechanism as a unitary operator. It can be implemented easily in a quantum computer. Mathematically, the unitary operator is a matrix. As the number of qubits increase, we get an exponential growth of coefficients that we can play with. This unitary operator (interference in the eye of Physicist) allows us to manipulate all these coefficients in one single operation which opens the door for massive data manipulations.

Entanglement

In general, scientists believe that without entanglement, quantum algorithms cannot show supremacy over classical algorithms. Unfortunately, we don’t understand the reasons well and therefore, we don’t know how to tailor an algorithm to take advantage of its full potential. This is why entanglement is frequently mentioned when introducing quantum computing but not much afterward. For this reason, we will explain what is entanglement in this section. Hope that you are the scientist to break the secret.

Consider the superposition of a 2-qubits.

where |10> means two particles are in a down spin and up spin respectively.

Consider the following composite state:

Can we split the composite state back into two individual states like,

We can’t because it requires:

Quantum mechanics demonstrates one non-intuitive concept. In classical mechanics, we believe understanding the whole system can be done by understanding each sub-components well. But in quantum mechanics,

As shown before, we can model the composite state and make measurement predictions perfectly.

But, we cannot describe or understand it as two independent components.

I imagine this scenario as a couple married for 50-years. They will always agree on what to do but you cannot find the answers when treated them as separate persons. This is an overly simplified scenario. There are many possible entanglement states

and it will be much harder to describe them when the number of qubits increases. When performing quantum operations, we know how components are correlated (entangled). But before any measurement, the exact values remain open. Entanglement produces correlations that are far richer and likely much harder for a classical algorithm to mimic efficiently.

Next

Now, we know how to manipulate qubits with unitary operations. But for those interested in quantum algorithms, we should know what is the limitation first. Otherwise, you may overlook what things are hard in quantum computing. But for those want to know more about the quantum gate first, you can read the second article before the first one.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade