An Introduction to Quantum Computing
Tags: quantum, superposition, entanglement, programming
Published: 2024-06-11 11:41:49

Quantum computing here, quantum computing there, quantum computing everywhere! Can we make some sense out of it? I'd like to not feel like completely out of place when people talk about it, so let's figure it out together!

<blockquote class="text-sm"><mark>I start this serie of posts about Quantum computing <strong>for personal learning</strong>, with the sake of understanding the general implications of it in our modern society and how it can impact my day-to-day life with technology</mark>. I do not claim to be an expert in the topic and this are more my notes based on what I'm learning reading articles and asking ChatGPT to simplify what I'm reading :D</blockquote>

---

__Quantum computing__ is a revolutionary new technology that harnesses the principles of __quantum mechanics__ (an intricate branch of physics that explores the wonders of the subatomic realm and tries to explain the nature of particles to discover the fundamental principles that govern our world -- we're not here today for this though) to process information at incredible speeds.

Unlike classical computers, which store and process information using bits that are either 0 or 1, quantum computers use quantum bits, or __qubits__, which can exist in multiple states simultaneously, meaning that a qubit can be both 0 and 1. ...but how?

<figure>
<img src="https://images.ctfassets.net/hzu7wkrk7tly/davATh6goeQ9CIcuMx1UZ/4aa0b207e039d24629eda7ad547d3b17/qubit.svg?r=50" class="big-picture" alt="Representation of a qubit compared to a typical bit." /><figcaption>Representation of a qubit compared to a typical bit.<br /> <em>Source: <a href="https://devopedia.org/qubit" target="_blank">Devopedia</a></em>. <em>Credit: <a href="https://www.volkswagenag.com/en/news/stories/2019/11/where-is-the-electron-and-how-many-of-them.html" target="_blank">Volkswagen Aktiengesellschaft 2019</a></em>.</figcaption>
</figure>

## Superposition

Let's talk about the idea of __superposition__, which describes __the ability of a qubit to exist in multiple states at the same time__. If a normal bit can have as a state either `0` or `1`, the state of qubit can be represented as

```javascript
|ψ⟩ = α|0⟩ + β|1⟩
```

which would require quite some explantation, but to make it briefly:

1. The symbol `|ψ⟩` represents the state of the qubit. `ψ` is just a variable name, and the `|⟩` symbols are like brackets that indicate it's a quantum state. 
2. The `α|0⟩` and `β|1⟩` terms are __probability amplitudes__. They represent the chances of finding the qubit in the states `|0⟩` and `|1⟩`
- `α` represents the probability amplitude of finding the qubit in the `|0⟩` state;
- `β` represents the probability amplitude of finding the qubit in the `|1⟩` state.

(... and yes because I also had to ask myself, probability amplitudes are quite complex numbers, but the gist of them is that the sum of α and β adds up to 1, meaning that the sum of the probabilities of all possible outcomes is always equal to 1.)

We can picture the state of a qubit like a point on a ball, called the __Bloch sphere__. The numbers α and β decide where exactly on the ball the qubit's point is. If α and β are regular numbers, then the qubit's point is on the middle of the ball's surface, like the equator. This means the qubit is equally a mix of `|0⟩` and `|1⟩`. But if α and β are complex numbers ([read more about complex numbers on Math Is Fun](https://www.mathsisfun.com/numbers/complex-numbers.html "Complex Numbers, from Math is Fun")), the qubit's point is somewhere else on the ball's surface. This means the qubit is a more general mix of `|0⟩` and `|1⟩`.

When a qubit is in superposition, it is like it's exploring all possible states at once. However, __when we measure the qubit, it *collapses* into a definite state__, either 0 or 1. <mark>The act of measurement forces the qubit to choose one of the possibilities, and from that point on, it behaves like a classical bit</mark>.

For instance, if `|α|^2 = 0.4` and `|β|^2 = 0.6`, the measurement is more likely to yield the outcome 1, but there is still a chance of obtaining the outcome 0.

__Okay but... how do you set a qubit in superposition?__

In order to do that, we can use a specific __quantum gate__ known as the __Hadamard gate (H gate)__ (more about what is a quantum gate later :D). The Hadamard gate creates an equal superposition of the `|0⟩` and `|1⟩` states for a qubit. Here's a simplified explanation of how it works:

1. Start with a qubit in the `|0⟩` state or the `|1⟩` state
2. Apply the Hadamard gate (`H` gate) to the qubit
- If the qubit is initially in the `|0⟩` state, the H gate will put it into an equal superposition of `|0⟩` and `|1⟩`. The resulting state will be `(|0⟩ + |1⟩) / √2`, meaning the qubit is in both states simultaneously
- But, if the qubit is initially in the `|1⟩` state, the H gate will again put it into an equal superposition of `|0⟩` and `|1⟩` but the resulting state will be `(|0⟩ - |1⟩) / √2`, meaning the qubit is in both states but with a phase shift (which is a far more intricate topic and I am still looking to find good and simple readings about it -- feel free to share in the comment section below!).

Reading the values of multiple qubits works similarly, with each qubit measured individually, and the outcomes combined to form a classical bit string or __a quantum state in the case of entanglement__. Which leads us to the next point...

## Entanglement

Another important concept in quantum computing is __entanglement__, which describes the phenomenon of __two or more qubits being connected in a way that allows them to affect each other's behavior__, even if they are separated by large distances. Fundamentally, entanglement creates instantaneous correlations between their measurement outcomes, taking place in three stages:

- __Preparation__: two or more qubits are brought together and interact with each other in a specific way __through a quantum gate operation__ (too long of a topic to cover here for now, but [Universal Quantum has a great article on Medium about quantum gates](https://medium.com/@universalquantum/quantum-gates-explained-without-the-maths-1c40e7d79611 "Quantum gates explained (without the maths)")).
- __Resulting State__: as a result of this interaction, the qubits become entangled and share a __joint quantum state__, which cannot be expressed as a simple combination of individual qubit states as __the  entangled state encompasses the entire system as a whole rather than describing each qubit independently__.
- __Correlations__: the measurement outcomes of one qubit are instantaneously correlated with the measurement outcomes of the other(s). __These correlations hold true regardless of the physical separation between the entangled qubits__, which is often referred to as *non-locality* or *spooky action at a distance* (once again, a topic for another time). 

## Briefly about Quantum gates

This is where I start to lose it a bit after the Hadamard gate we mentioned before. Sounds like a good place where I should continue reading more until I am confident enough to write notes about the topic 😎 Anyway...

__A quantum gate is an instruction (or operation) that we can use to change the state of qubits__. Just like how math operations such as addition or multiplication transforms numbers, a quantum gate transforms the quantum state of qubits, each gate having a specific effect on the qubits: rotating the state, flipping it, or putting it in a superposition and whatsoever.

Basically, they are the building blocks that help us manipulate and utilize the power of quantum computing. Once again, [Universal Quantum has a great article on Medium about quantum gates](https://medium.com/@universalquantum/quantum-gates-explained-without-the-maths-1c40e7d79611 "Quantum gates explained (without the maths)") and I recommend checking something more by yourself (and if you feel generous, don't be afraid to share some good links with me :D)

## Briefly about Challenges

Seems fair to mention, before closing, why this technology is not yet widespread and what are the things that it needs to overcome.

One of the major challenges in building a quantum computer is the delicate nature of qubits. Because they are based on the principles of quantum mechanics, __qubits are easily affected by their environment__, and can be easily disrupted by outside factors such as temperature, noise, or even light. This makes it difficult to control and manipulate qubits, and to maintain their quantum state for long periods of time.

Despite these challenges, researchers have made significant progress in developing quantum computers in recent years. In 2019, [Google announced that its quantum computer had achieved "quantum supremacy"](https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html) by solving a problem that would be impossible for a classical computer to solve in a reasonable amount of time. This was a major milestone in the development of quantum computing, and showed that the technology is rapidly advancing.

---

## Conclusions

__So, what did we learn here?__

- We've learned about __qubits__, which unlike the binary bits in classical computing, can exist in multiple states at once due to __superposition__.
- We've also discovered that a specific quantum gate, the __Hadamard gate__, can set a qubit in this superposition state.
- Furthermore, qubits can be __entangled__, meaning they can affect each other instantaneously irrespective of the distance between them.
- Lastly, we've had a general discussion about __quantum gates__, the operations that manipulate the state of qubits, serving as the foundational building blocks of quantum computing.

## What next?

I'd love to continue my studies focusing more on:
- (First of all, brushing up my linear algebra, because it seems to help a lot reading documents online)
- Quantum gates
- Quantum algorithms 
- Quantum error correction 
- More about quantum supremacy
- More about challenges

Thank you for reading so far, if you did, and don't hesitate sharing good resources in the comments below if you feel like!

## Sources and inspiration
- <a href="https://devopedia.org/qubit" target="_blank">Qubit</a> from <a href="https://devopedia.org" target="_blank">Devopedia</a>
- <a href="https://quantum.country/qcvc" target="_blank">Quantum Computing for the Very Curious</a> from Andy Matuschak and Michael Nielsen on <a href="https://quantum.country" target="_blank">Quantum Country</a>
- <a href="https://en.wikipedia.org/wiki/Quantum_computing" target="_blank">Quantum computing</a>, <a href="https://en.wikipedia.org/wiki/Quantum_superposition" target="_blank">Quantum superposition</a> & <a href="https://en.wikipedia.org/wiki/Quantum_entanglement" target="_blank">Quantum entanglement</a> from <a href="https://en.wikipedia.org" target="_blank">Wikipedia</a>
- <a href="https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html" target="_blank">Quantum Supremacy Using a Programmable Superconducting Processor</a> from John Martinis (Chief Scientist Quantum Hardware) and Sergio Boixo( Chief Scientist Quantum Computing Theory) at Google AI Quantum via <a href="https://ai.googleblog.com/" target="_blank">Google Research</a>
- <a href="https://www.youtube.com/watch?v=OWJCfOvochA" target="_blank">Quantum Computing Expert Explains One Concept in 5 Levels of Difficulty</a> with Dr. Talia Gershon (Senior Manager, Quantum Research at IBM) from <a href="https://www.wired.com/" target="_blank">Wired</a>
- <a href="https://chat.openai.com/" target="_blank">ChatGPT</a> prompts:
`How can a quantum bit be both 0 and 1 at the same time? Can you give me an accurate yet simple description to follow?`
`How do we read the values of qubits?`
`Can you explain to me in simple terms what is qubits entanglement, how does it happen, and what does it imply?`
`Can you tell me more about the correlation in entanglement?`
`Can you explain to me in simple terms what is qubits entanglement, how does it happen, and what does it imply?Can you tell me more about the resulting state of entanglement?`
... and honestly too many more to share xD
- Cover: <a href="https://www.freepik.com/free-psd/3d-characters-business-fall-illustration_26314271.htm" target="_blank">3d characters business fall illustration</a>, <a href="https://www.freepik.com/free-psd/3d-rendering-back-school-icon_30118660.htm" target="_blank">3D Atom</a> and <a href="https://www.freepik.com/free-vector/realistic-3d-shapes-floating-background_13397766.htm" target="_blank">Background 3D composition</a> by [Freepik](https://www.freepik.com/author/freepik); Blurred <a href="https://unsplash.com/photos/rCbdp8VCYhQ" target="_blank">starry sky</a> by <a href="https://unsplash.com/@andyjh07" target="_blank">Andy Holmes</a> via <a href="https://unsplash.com/" target="_blank">Unsplash<a/>
<hr />
Originally posted in <a href="https://oh-no.ooo">oh-no.ooo</a> (<a href="https://www.oh-no.ooo/articles/an-introduction-to-quantum-computing">An Introduction to Quantum Computing</a>), my personal website.