# What is a Qubit?

The quantum bit is the fundamental unit of computation in quantum computing. In this lesson, we draw parallels with the traditional bit and use that analogy to help us understand a qubit.

## The classical bit

The **bit** that we all are familiar with, is the most basic unit of information. It either represents a **1** or a **0**. We can think of it as analogous to a switch being **on** or **off**. A bit’s current status, either 1 or 0, is known as its state.

### The transistor

The value of the **bit** being **1** or **0** are just abstractions. In reality, it is just a **transistor**, the building block of all modern computers. When the **transistor** allows the passage of current through it we consider this event to represent the **1** and when the **transistor** blocks the passage of current we consider this event to represent the **0**.

You might remember this circuit diagram of a **transistor** from your physics lessons in the past.

## The quantum bit

The quantum bit can represent **0**, **1**, or both simultaneously. This seems quite counter-intuitive. What does it mean to be two different things simultaneously? This phenomenon is called **superposition**. We will come back to this in a future lesson about **quantum mechanics**. For now, we just need to accept that it’s possible to be **0** and **1** at once.

### The quantum transistor

A **qubit** can be built using any two-level quantum system. An example could be a phosphorus atom within a silicon superconductor. There are multiple ways to build a **qubit**. Unlike the **transistor** for classical computing, we still haven’t figured out the best way to build a perfect **qubit**. This is an important ongoing research area, and quantum computing is still very much in its initial stages.

Don’t worry if these words sound new to you. In this course, we will not go into the hardware and implementation details of quantum systems.

### Quantum states

The first takeaway here is that the **superposition** of **0** and **1** is **not** some third possible **state** of a **bit**. It is a special **state** that we cannot describe by using a classical **bit**. Let’s see why it is so special.

#### Notation

Let’s introduce some notations to distinguish quantum states from classical states. We will represent the **0** state in quantum as “$|0\rangle$” and the **1** state as “$|1\rangle$”. We will study this notation formally in the next lesson.

#### Superposition state

Think of a slider moving between the values from **0** to **1**. A **superposition** of **0** and **1** means our current state is somewhere on the slider, it could be a little more towards the **0** side, or it could be a little more towards the **1** side. We see from this slider analogy that there are infinitely many possible states that we can call “being both **0** and **1** at the same time”.

We can think of such a quantum state as a whole, with some part being a **0** and the remaining part of it being a **1**. Let’s try to capture this concept using our new notation. We can write a **superposition** state as a combination of $|0\rangle$ and $|1\rangle$ in the form of $|0\rangle + |1\rangle$. We’ll discuss why it is written like this in further detail in the next lesson.

An equal **superposition** state would mean 50% of the **qubit** is a **0** and the other 50% of it is a **1**.
Using this way, we can think of the $|0\rangle$ state to be 100% **0** and 0% $|1\rangle$. Similarly, we can say the $|1\rangle$ state is 0% **0** and 100% **1**.

In the next lesson, we will look at quantum states formally, and hopefully, we’ll be able to wrap our heads around it by having this knowledge about **superposition** in mind.

## Classical computation

The heart of classical computing is the logical operations on strings of numerous **1s** and **0s**. Everything that we can achieve with our computers today is made possible by simple arithmetic, and logical operations on binary numbers represented using these bits.

As we studied earlier, a **bit** is just the passage of current through a **transistor**. We can manipulate the state of a **bit** by using different combinations of **transistors** connected to each other. We call them **gates**.

### Logic gates

We should know of the logic gates that can perform logical operations such as **AND**, **OR**, **NOT**, **XOR**, etc. By applying them to bits, we can change their state according to the desired operation.

### The circuit

A combination of these gates together on one or more bits constitutes a circuit. An example of a circuit is a 4-bit **adder**. This circuit can take 2 binary numbers represented by 4-bits each and produce their sum as the output.
A **full adder** also handles the resultant carry in the output.

## Quantum computation

Like classical computation, we use operations that manipulate the state of the **qubit** to perform meaningful quantum computation. A **qubit** can have a multitude of different **states**. So these operations are quite different from classical logic operations. One of the key differences is that all these operations have to be **reversible**.

A simple way to understand reversibility is to apply the classical **NOT** gate to the same **bit** twice. It will revert to its original **state** when the *NOT* gate is applied. Consequently, you should also see why the classical **AND** gate is not **reversible**.

### Quantum gates

Quantum gates have the power to perform all the operations that the classical logic gates can perform and do even more than that. A good example, for now, is the $X$ gate, also known as the **quantum NOT** gate. The $X$ gate can change the state of a **qubit** from $|0\rangle$ to $|1\rangle$ and vice versa.

### The quantum circuit

A quantum circuit consists of a combination of multiple quantum gates applied on some **qubits**.

It is possible to create a quantum circuit for a simple 4-bit **adder** as well, but it will be quite inefficient because we need to apply many quantum gates to simulate classical **AND** and **XOR** gates.

Our main reason for using quantum circuits is to solve problems that classical circuits struggle with. They’re not here to replace classical computing.

An example of a useful quantum circuit is a **Bell Circuit**. It produces an **entangled** pair of **qubits**. Don’t worry about understanding what this means for now. We’ll come back to this in a future lesson. Regardless, this circuit uses two quantum gates: the **controlled-NOT** gate, also known as the $CNOT$ gate, and the Hadamard Gate $H$. The $CNOT$ gate can be thought of as the quantum version of the classical $XOR$ gate. We’ll look at the Hadamard Gate $H$ in a future lesson.