# Quantum Computing #01: From Bits to Qubits

## Introduction to Quantum Computing series

This series will summarize some key points during my Quantum Computing learning journey, mainly from IBM Qiskit Textbook and some other useful resources.

Let's start with Qubits - the basic variable of quantum computers.

## Bits to Qubits

Classical states for computation are either 0 or 1

**Bits**: only two characters, 0 and 1, we can represent any piece of information.**Qubits**: an extension of the bit to quantum mechanics, a state can be in superposition (i.e.,**simultaneously**in 0 and 1)โ Superposition allows performing the calculation on many states at the same time.

โ Some Quantum algorithms with

**exponential speed-up**

However, once we measure the superposition state, it collapses to one of its states (0 or 1) โ it is not that easy to design quantum algorithms, but we can use **interference effects**

## ๐ฎ Qubits

- a quantum variant of the bit
- have exactly the same restrictions as normal bits do: they can store only a single binary piece of information and can only ever give us an output of 0 or 1.
- However, they can also be manipulated in ways that quantum mechanics can only describe.

Before finding out how to represent a qubit, let have a look at the Dirac (bra-ket) notation:

## Dirac notation

Used to describe quantum states: \( a, b \in \mathbb{C}^2 \)

ket: \( |a\rangle = \begin{bmatrix} a_1 \ a_2 \end{bmatrix} \)bra: \( \langle b| = |b\rangle ^\dagger = \begin{bmatrix}b_1 \\ b_2 \end{bmatrix} ^\dagger = \begin{bmatrix} b_1^* & b_2^* \end{bmatrix} \)

where \(b_1^*, b_2^*\) are complex conjugated of \(b_1 , b_2 \), i.e. \(b = c+d.i \Rightarrow b^* = c-d.i \)bra-ket(inner product): \( \langle b|a\rangle = a_1b_1^* + a_2b_2^* = \langle a|b\rangle^\dagger \in \mathbb{C} \)ket-bra:\( |a\rangle \langle b| = \begin{bmatrix} a_1b_1^* & a_1b_2^* \\ a_2b_1^* & a_2b_2^*\end{bmatrix} \)

### Qubit notation

Using 2 **orthogonal** vectors *(the inner product = 0)*

$$|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \, \, \, \, |1\rangle =\begin{bmatrix} 0 \\ 1 \end{bmatrix}$$

\( |0\rangle, |1\rangle\) are orthogonal, i.e, $$\langle 0|1\rangle = \begin{bmatrix} 1 & 0 \end{bmatrix}.\begin{bmatrix}0 \\1\end{bmatrix} = 1.0 + 0.1 =0$$

This helps us distinguish them from things like the bit values 0 and 1 or the numbers 0 and 1. It is part of the **bra-ket** notation, introduced by **Dirac**.

With vectors, we can describe more complex states than just \(|0\rangle\) and \(|1\rangle\). For example

$$ \begin{aligned} |q_0\rangle & = \tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{i}{\sqrt{2}}|1\rangle \\ & = \tfrac{1}{\sqrt{2}}\begin{bmatrix}1\\0\end{bmatrix} + \tfrac{i}{\sqrt{2}}\begin{bmatrix}0\\1\end{bmatrix}\\ & = \begin{bmatrix}\tfrac{1}{\sqrt{2}}\\0\end{bmatrix} + \begin{bmatrix}0\\\tfrac{i}{\sqrt{2}}\end{bmatrix}\\ & = \begin{bmatrix}\tfrac{1}{\sqrt{2}} \\ \tfrac{i}{\sqrt{2}} \end{bmatrix}\\ \end{aligned} $$

### Qubit Statevector

Since the states \(|0\rangle \) and \(|1\rangle\) form an orthonormal basis, we can represent any 2D vector with a combination of these two states. This allows us to write the state of our qubit in the alternative form:

\( |q_0\rangle = \tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{i}{\sqrt{2}}|1\rangle\) is a

**qubit's statevector,**Qubit Statevector it is not entirely \(|0\rangle\) and is not entirely \(|1\rangle\) โ it is described by a linear combination of the two: '

**superposition**'

### Qubit Measurement

We choose orthogonal bases to describe and measure quantum states. During a measurement onto the bases \(|0\rangle, |1\rangle\), the states will collapse into either state \(|0\rangle\) or \(|1\rangle \) โ As those are the eigenstates of \(\sigma_Z\) we call this a Z-measurement

There are infinitely many different bases, but other common ones are:

\(|+\rangle = \tfrac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\) and \(|-\rangle = \tfrac{1}{\sqrt{2}}(|0\rangle - |1\rangle)\) corresponding to the eigenstates of \(\sigma_X\)

\(|+i\rangle = \tfrac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)\) and \(|-i\rangle = \tfrac{1}{\sqrt{2}}(|0\rangle - i|1\rangle)\) corresponding to the eigenstates of \(\sigma_Y\)

#### Born rule

The probability that a state \(|\psi\rangle\) collapse during a projective measure onto the basis \({|x\rangle, |x\rangle^\dagger}\) to the state \(|x\rangle\) is given by:

Find the probability of measuring a state \(|\psi \rangle\) in a state \(|x \rangle\):

\(p(|x\rangle) = | \langle x| \psi \rangle|^2\) and \(\sum\limits_{i} p(x_i) = 1\)

This rule governs how we get information out of quantum states. It is therefore very important for everything we do in quantum computation.

### General notation of single-qubit states

Single qubit states can be written down generally as

$$\sqrt{1-p}\vert0\rangle + e^{i\phi}\sqrt{p}\vert1\rangle$$

- \(p\) is the probability that a measurement of the state in the computational basis \({|0\rangle, |1\rangle}\) will have the outcome \(1\)
- \(\phi\) is the phase between the two computational basis states

Single-qubit gates can then be used to manipulate this quantum state by changing either \(p , \phi\) or both.

### Reference

- Qiskit Textbook ( https://qiskit.org/textbook/)