Quantum Computing for Dummies- Part 1

Lohit Potnuru
The Startup
Published in
14 min readNov 25, 2020

--

Disclaimer: The latter half of the article gets pretty technical. For casual readers, I suggest looking into the first and second sections for a brief overview of what quantum computers are and some pretty neat quantum mechanics that they manipulate.

An Introduction to Quantum Computing

As a kid, or even as an adult, it’s always fun to grab a maze and try to figure out the correct path between the entry and exit points.

image from Business Mazes

When you look at how you solve a complex puzzle like this one, it would be safe to assume that you most likely explore each path one by one, until you find the correct answer. Now imagine you are able to explore all the paths at the same time. Crazy right… Using the power of quantum mechanics, quantum computers seem to do exactly that- but instead of elementary school maze puzzles, we could eventually use them for high-level problems like simulating interactions between molecules and aiding in drug discovery.

The Need for Quantum Computers

Over the past couple of decades, computing power has grown exponentially year by year. Specifically, Moore’s Law tells us that computing power generally doubles every year, by being able to make transistors smaller.

image from https://en.wikipedia.org/wiki/Moore%27s_law

At this point, going smaller means we inevitably have to face the effects of operating at a quantum scale. Thus, it necessitates the creation of a computer that can operate within the laws of quantum mechanics, or even take advantage of them.

A Brief History

We can attribute the first proposal of a quantum computer to Richard Feynman in 1981. In 1994, Peter Shor introduced Shor’s algorithm, generating a lot of excitement in the field as it gave an application where quantum computers could actually use the laws of quantum mechanics to factor large prime numbers. Last year, Google claimed quantum supremacy (among controversy), as it performed a calculation that would’ve supposedly taken 10,000 years for a supercomputer to compute (IBM disagrees saying it would take 2.5 days) in 200 seconds (still a significant difference either way).

image from https://tinyurl.com/y7ogcvdh

Applications of Quantum Computing

At a high level, the power in quantum computers comes from a qubit’s (quantum bit) ability to be in a superposition state, or multiple states at once. In a classical bit, it functions like a lightbulb where it can either be on (1) or off (0). A qubit, however, can be in a superposition of both 0 and 1, essentially being both at the same time. Using this, among other quantum phenomena, quantum algorithms are able to manipulate multiple states at once, and therefore be exponentially more efficient. Though quantum computers are currently not anywhere near as powerful as they could be, future applications of quantum computers could include:

  1. Quantum Simulations (what better way is there to model the randomness of a quantum system than to use the same randomness of another quantum system?)
  2. Drug Design/Discovery (able to simulate the effects of drugs to drastically reduce the time it takes for drug discovery)
  3. Cryptography/Cybersecurity
  4. Optimization
  5. Financial Modeling
  6. Forecasting
  7. Computational Chemistry

Some Spooky Laws of Quantum Mechanics

Wave-Particle Duality

When considering the discovery of wave-particle duality in electrons, one must first take a look at its discovery in light. At first, we had known light to be an electromagnetic wave, characterized by its frequency and wavelength. However, this couldn’t explain the photoelectric effect, which was a phenomenon that occurred when light was directed at a certain metal plate, causing it to eject an electron. However, whether or not an electron was ejected was unchanged by how intense the light was. Instead, it was the frequency of the light that determined whether or not an electron would be ejected.

Planck theorized that energy is quantized, or broken down into discrete packages of energy (Planck’s energy) that couldn’t be broken down into smaller units of energy. Einstein then extended this to light, naming these discrete packages photons (particles of light). Thus, striking the metal plate with a photon with a given amount of energy would eject an electron, regardless of how many photons were directed at it (intensity), explaining the photoelectric effect.

The double-slit experiment is also a prominent example of wave-particle duality. Here, photons were fired through two slits and measured on where they landed on a screen in the back.

image from https://www.discovery.com/science/Double-Slit-Experiment

When where they landed was recorded, the photons exhibited behaviors of a wave, where interference between waves created a probability distribution in the back screen shown on the right-most side of the image. Even when fired as a singular photon, it was able to interfere with itself to still act as if it was a wave.

Wavefunction of Quantum Particles

Erwin Schrödinger was able to present an equation that described the “wave function” of a particle that is key for our understanding/manipulation of quantum mechanics now.

image from http://hyperphysics.phy-astr.gsu.edu/hbase/quantum/Schr2.html

When you plot Ψ(x), you get a graph that can look like this:

image from Dynamics of the Wave Function: Heisenberg, Schrödinger, Collapse | Science4All

At first, the interpretation of what this actually means in the real world was unclear, and even now we still don't know what this actually looks like. However, what we generally observe and accept is that the amplitudes of this wave function squared gives us the probability of finding a particle at that given location. So, at one point, “measuring” the location of a particle “collapses” its wave function to a single point in space, with the amplitudes of that wave function telling us the likelihood of it collapsing down to a specific point in space.

Superposition

We have been referencing superposition for a while now, but formally a quantum superposition of a particle allows for that particle to be in multiple states at once. The wave function gives us a superposition of different states a particle can be in with varying amplitudes for how likely a particle is likely to be at that point in space. Thus, particles exist in probability clouds that collapse down to one point when measured.

One famous thought experiment that exemplifies this is Schrödinger’s Cat. In the experiment, a cat is placed in a closed “black box” with a radioactive particle. That particle has a 50% chance of decaying, which would release a gas that would kill the cat. If you keep the black box closed and free of “measurement” (collapsing the superposition), it is thought that the cat would then be in a superposition of both alive and dead. However, once the black box is opened you would see either the cat alive or the cat dead. Similarly, if you put a camera inside the black box, then put a human outside with a second black box around him, the human is measuring whether or not the cat died, but since the human is in a closed system it is not being measured. Thus, the human would then be in a superposition of seeing the cat alive and seeing the cat dead.

image from Watching Schrodinger’s cat die | Berkeley News

Schrödinger originally came up with this experiment to display how crazy and nonsensical the current view of what the laws of quantum mechanics are. Ironically, it is widely used today as a way to introduce people to the world of quantum mechanics.

The Measurement Problem

I’ve been referring to the notion that “measuring” a quantum particle collapses down its wavefunction/superposition into a single state. However, what actually constitutes as “measuring” something is completely unknown to scientists.

To show just how confusing this is, we can go back to the example of the double-slit experiment. We saw that measuring where the particles landed displayed signs of interferences patterns similar to waves. Note that this measurement is different from the measurement that collapses down a quantum superposition, as this one measures where they landed after they hit the back screen. In a sense, you could say that the back screen is the object that performed the act of “measurement” and forced the particle to collapse down to a single wave function.

If a human being was there observing the particle being shot to the back screen, however, then the particle would behave like a particle and two slits would appear in the back screen. Alternatively, if a camera was put inside the environment, the “measurement” would still occur, and the particle would behave like a particle by forming two slits in the back screen. Once the camera was unplugged but still kept inside the environment, the particle resumed acting like a wave and interfering with itself to form an interference pattern in the back screen.

To sum up, we have no idea what is causing this wave function to collapse down to one state, and how the world isn’t a probability cloud full of randomness. However, we can still manipulate quantum mechanics for our benefit in quantum computers, without knowing the answer to this measurement problem.

Interpretations of Quantum Mechanics

The most popular/widely taught interpretation of the laws of quantum mechanics is the Copenhagen Interpretation, which is what the article thus far has been talking about. Proposed by Niels Bohr and Schrödinger, the interpretation gives us the best mathematical model for how quantum mechanics functions and how we can manipulate those laws for our own benefit. It ignores the measurement problem and basically tells us to suck it up and do the math.

Another popular interpretation of quantum mechanics is Hugh Everett’s proposal of the Many Worlds Theory. It argues that there is no “collapse” of the wave function, but rather the universe splits/branches out so that each possible state in which the particle could be in actually occurs in parallel universes. With the example of Schrödinger’s cat, there would be two (for the sake of the thought experiment) parallel universes created where the cat is dead or the cat is alive.

image from Many-worlds interpretation — Wikipedia

There are many other interpretations, but in the case of quantum computing, relying on the Copenhagen interpretation gives us a pretty good toolkit for performing quantum computations.

Quantum Entanglement

image from Disproving Einstein: the Phenomenon of Quantum Entanglement and Implications of Quantum Computing — Techbytes

Bohr rejected the concept of realism, or that the universe exists independent of our observation of it. Instead, the Copenhagen interpretation maintains that the existence of the universe is only confirmed at the point of observation.

Einstein rejected this, maintaining that there must be some hidden variables or missing pieces to the wave function/the Copenhagen interpretation. In a debate between the two, it was shown that two particles could be entangled in a way that, no matter the distance between the two particles, the two states would always be correlated.

A particle’s spin can be measured based on a measurement basis. For example, a vertical measurement would give you a spin up or spin down and a horizontal measurement would give you a spin left or spin right. When two entangled particles exist, no matter where they are in the universe, measuring them would give you opposite spins. This “spooky action at a distance”, as Einstein described it, hinted at the notion of faster than light communication where the states of both particles were inextricably linked. Whether or not there is actually faster than light communication, or whether or not the Copenhagen interpretation in it of itself is actually true is all up to debate. However, the fact that this relationship exists between two particles allows us to manipulate it for quantum computations.

Quantum Interference

Adding on to the notion of the wave function, two wave functions/superpositions can either destructively interfere or amplify each other, similar to regular waves. An example of this is in noise cancellation headphones, where soundwaves are sent to destructively interfere with soundwaves coming from the outside to cancel the noise around you. Similarly, quantum superpositions can destructively interfere or amplify each other, thus manipulating the probability of collapsing down to a particular state.

This concept, along with quantum superposition, allows us to make exponentially more efficient quantum algorithms. Remember that we can’t just make a superposition of a bunch of different possibilities and measure that, as it will collapse down to one state upon measurement. Instead, one must find a way to make this superposition destructively interfere and amplify the desired answer.

3) Modeling Qubit States in Quantum Computing

Representing a Qubit

A qubit, or quantum bit, is the smallest unit of quantum information. For example, one qubit can be one electron where information can be stored in its spin. Similar to a bit whose states can be 0 or 1, a qubit can have the states |0⟩ and |1⟩. The ket (|⟩) symbol denotes a quantum state.

We can rewrite the states |0⟩ and |1⟩ as mathematical vectors on a unit circle, with the values:

From this, we can represent all other qubit states as a linear combination, or a sum of some multiple of, the two basis vectors.

In other words, any other state vector of a qubit can be rewritten in the form of:

For example, denoting a quantum state in a 50/50 superposition of 0 and 1 could be written as:

Calculating Probability

Now that we have denoted a quantum state as a linear combination of the states |0⟩ and |1⟩, we can now calculate the probability of that superposition to collapse to |0⟩ or |1⟩ by calculating:

where you are trying to find the probability of |psi⟩ collapsing down to |x⟩. For our purposes, we can simplify this equation to find the probability of collapsing down to |0⟩ or |1⟩ as follows:

Taking our previous example of the 50/50 superposition, we can calculate that it does indeed have a 50% chance of being |0⟩ and a 50% chance of it being |1⟩ by plugging it into the equation above:

The Bloch Sphere

When alpha and beta are both real numbers, you can represent them on a 2-dimensional unit circle. However, in quantum computing, you often get alpha and beta to be complex numbers. Thus, you can represent quantum states by plotting the vectors onto a 3-dimensional Block Sphere.

Through some mathematical proof that I won’t cover in this article, we can write the state of

in terms of 2 angles- theta and phi:

and plot those two angles in the block sphere as shown below

Manipulating Single Qubits

Quantum Gates

Similar to the logic gates inside classical computers, quantum gates are able to manipulate qubits and are the building blocks for actually creating quantum algorithms.

Practically, they are ways to manipulate the spin/state of a qubit. There different types of quantum computers, but one popular method is to use single electrons as qubits and microwave pulses to manipulate their spins.

If you are familiar with linear algebra, you know that matrices can be thought of as linear transformations of vectors, or ways to transform one vector to another. Similarly, we can denote quantum gates as matrices that you can apply to quantum states.

Reversibility

Whenever you apply a gate to some information in classical computing, you oftentimes lose the original information. For example, take the AND gate, whose truth table looks like the following:

If we get an output of 0, there is no way for us to determine if the input was 00, 01, or 10. Thus, some information is lost by applying the AND gate to two bits.

Conversely, in quantum computing, gates are reversible, meaning that applying a quantum gate allows you to figure out the original information as well. Though this might not seem as significant right now, it is a lot more prominent once you get deeper into quantum computing.

The Pauli X Gate

This gate is the quantum equivalent of the NOT gate. For those unfamiliar, in classical computing, a NOT gate takes in a single bit (0 or 1) and outputs the opposite of that bit. For example, inputting a 1 would give you an output of 0 and vice versa.

Similarly, a Pauli X Gate takes in either |0⟩ or |1⟩ and outputs the opposite state. We can mathematically represent this given the following matrix:

We can see how this flips a qubit by multiplying the matrix by both the |0⟩ and |1⟩ states:

Geometrically, we can visualize the X gate rotating a quantum state by π radians about the x-axis.

The Pauli Y+Z Gates

Similar to the Pauli X Gate, instead of rotating a quantum state about the x-axis the Y and Z gates rotate a quantum state by π radians about the y and z axes.

Mathematically we can represent the two as follows:

Applying the Y gate to the |0⟩ and |1⟩ states gives us:

Applying the Z gate to the |0⟩ and |1⟩ states gives us:

We can see that applying the Z gate to our basis vectors gives us the same measurement since the negative sign (phase; we can worry about that later) is inconsequential when we measure the quantum state. Thus, |0⟩ and |1⟩ are the eigenstates of the Z gate and are often called the Z-basis.

The Hadamard Gate

In the second section of the article, we talked about quantum superposition, or the state at which an object at the quantum scale is able to exist in multiple different states at once. In a quantum computer, you can create a superposition state in a qubit using the Hadamard Gate.

As a matrix, the Hadamard Gate can be represented as follows:

Applying the H Gate to our Z-basis vectors is also represented using the |+⟩ and |-⟩ symbols:

We can also prove that |+⟩ and |-⟩ are also the eigenvectors for the X gate:

Geometrically the H gate can be visualized as a rotation around the vector [1 0 1] on the block sphere- which lies in between the x and z-axis. This is also a way to transform a state between the X and Z bases.

The 𝑅𝜙 Gate and its Variations

This gate is parameterized by a real number 𝜙 and can be represented as follows:

Geometrically, the R𝜙 Gate can be visualized as rotating a Bloch vector by a value of 𝜙 about the Z-axis

Certain variations of the R𝜙 Gate are labeled as their own gates due to how commonly they are used. For example, the Pauli Z gate is just the R𝜙 Gate where 𝜙=π.

Similarly, the S gate is the R𝜙 Gate where 𝜙=π/2. It is also called the sqrt(Z) gate as SS|q⟩=Z|q⟩

Finally, the T gate is the R𝜙 Gate where 𝜙=π/4 and is the 4th root of the Z gate.

The U3 Gate

This is the most general single qubit quantum gate, and is parameterized by three variables:

Wrapping Up…

In this article we covered 1) a basic history/introduction to quantum computing, 2) basic quantum mechanical principles/interpretations, 3) the qubit and how to represent it, and 4) manipulating single qubits with quantum gates.

In the next article, we will be going over concepts such as phase, manipulating multiple qubits, basics of quantum hardware, and go more in-depth on future applications of quantum computing.

Thank you for reading my article! You can connect with me on my LinkedIn or email me at lohitpotnuru@gmail.com. Sign up for my monthly newsletter here.

--

--

Lohit Potnuru
The Startup

Creator. Innovator. Entrepreneur looking to make an impact. Quantum Computing | Artificial Intelligence