# Qubit Duo: Let's Play with Quantum Bits!

Quantum computing is an innovative field that leverages the principles of quantum mechanics to perform certain calculations far more efficiently than conventional computers.

One of the fundamental concepts in quantum computing is the quantum bit, or qubit. In this article, I’ll explore the basic behavior of qubits using an app called Qubit Duo .

## What is a Qubit?

A qubit is the quantum analog of a classical bit. While a classical bit can be in a state of either 0 or 1, a qubit can be in both states simultaneously. Mathematically, a qubit is represented as:

$$ |\psi\rangle = \alpha|0\rangle + \beta|1\rangle $$

where $|\alpha|^2 + |\beta|^2 = 1$, and $\alpha$ and $\beta$ are complex numbers.

### Superposition

Superposition is one of the fundamental principles of quantum mechanics. It allows a qubit to be in a combination of both 0 and 1 states simultaneously. When a qubit in superposition is measured, it collapses to either 0 with probability $|\alpha|^2$ or 1 with probability $|\beta|^2$.

To visualize this, imagine a qubit as a point on a sphere called the Bloch sphere. The north pole represents the state $|0\rangle$, and the south pole represents the state $|1\rangle$.

A qubit in superposition can exist anywhere on the surface of this sphere.

## Quantum Gates

Quantum gates are the basic building blocks of quantum circuits, similar to logic gates in classical circuits. They manipulate qubits in various ways.

### Hadamard Gate

The Hadamard gate (`H`

gate) creates a superposition state from a classical state.

When applied to a qubit in state $|0\rangle$ or $|1\rangle$, the Hadamard gate produces:

$$H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$ $$H|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$$

### CNOT Gate

The CNOT gate (Controlled NOT gate) is a two-qubit gate that entangles qubits. The first qubit acts as a control bit, and the second qubit acts as a target bit.

The CNOT gate flips the state of the target qubit if the control qubit is in state $|1\rangle$. This transformation can be represented as:

$$\text{CNOT}|00\rangle = |00\rangle$$ $$\text{CNOT}|01\rangle = |01\rangle$$ $$\text{CNOT}|10\rangle = |11\rangle$$ $$\text{CNOT}|11\rangle = |10\rangle$$

## Entanglement

Entanglement is a unique quantum phenomenon where the states of two or more qubits are correlated in such a way that the state of each qubit cannot be described independently of the others. When qubits are entangled, measuring one qubit instantly affects the state of the other.

### Bell States

Bell states are a prime example of entanglement. They represent a set of four maximally entangled two-qubit states. The most common Bell states are:

$$|\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$ $$|\Phi^-\rangle = \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$$ $$|\Psi^+\rangle = \frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$$ $$|\Psi^-\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$$

These states demonstrate strong correlations between qubits, where the measurement result of one qubit directly influences the measurement result of the other.

### Creating Entanglement

To create an entangled state, we apply a Hadamard gate to the control qubit, followed by a `CNOT`

gate. Here’s an example of creating a Bell state (specifically, the $|\Phi^+\rangle$ state):

Start with two qubits in the state $|00\rangle$.

Apply a Hadamard (H) gate to the first qubit ($q_0$):

$$H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$

The resulting state is: $$\frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)$$

Apply a CNOT gate with the first qubit ($q_0$) as the control and the second qubit ($q_1$) as the target:

$$\text{CNOT}\left(\frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)\right) = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$

This results in the entangled state:

$$|\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$

### Measuring Entangled Qubits

When measuring one qubit of an entangled pair, the state of the other qubit is instantly determined. For example, if we measure the first qubit of the state $|\Phi^+\rangle$ and get 0, the second qubit will also be in state 0. Similarly, if we measure 1 for the first qubit, the second qubit will be in state 1.

## Noise

In real quantum computers, qubits are susceptible to noise from the environment. Noise can alter the state of qubits and potentially destroy entanglement. Understanding how noise affects entanglement and superposition states is crucial for comprehending the operation of quantum computers.

### Effects on Entanglement

Noise can cause entanglement to break down, leading to random changes in qubit states. For example, if noise affects the entangled state $|\Phi^+\rangle$, it may transition to states other than $|00\rangle$ or $|11\rangle$. The probability of noise destroying entanglement depends on the noise level.

### Effects on Superposition

Noise also impacts superposition states. For instance, if noise affects the state $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$, the qubit may collapse to either $|0\rangle$ or $|1\rangle$. Noise reduces the duration for which superposition states can be maintained, a phenomenon known as quantum decoherence.

## What is Qubit Duo?

Qubit Duo is an app that allows you to learn about qubit behavior through interactive play.

### Key Features

**Qubit Manipulation**: Toggle the states of two qubits (held by Alice and Bob) between 0 and 1.**Quantum Gate Application**: Create superposition states using the Hadamard (H) gate and generate entanglement states by combining it with the CNOT gate.**Noise Level Adjustment**: Adjust the level of environmental noise using a slider and observe its effects.**Real-time Visualization**: Display qubit state changes in real-time graphs to visually understand their behavior over time.**Measurement Result Histogram**: View measurement results in a histogram to observe changes in state distribution.**Responsive Design**: Use comfortably on both desktop and mobile devices.

### How to Use Qubit Duo

#### Switching Qubit States

Click on the qubit held by Alice or Bob to toggle its state between 0 and 1.

#### Applying the Hadamard Gate

Click the `H`

button below a qubit to apply the Hadamard gate and create a superposition state.

#### Applying the CNOT Gate

After applying the Hadamard (H) gate to Alice’s qubit, click the `CNOT`

button to perform a CNOT operation with Alice’s qubit as the control and Bob’s qubit as the target, creating entanglement.

#### Resetting Qubit States

Click the `Reset`

button to return Alice and Bob’s qubits to their initial state (0).

#### Clearing the Histogram

Click the `Clear`

button below the histogram to clear measurement results.

## Investigating the Impact of Noise on Entangled States

Let’s use Qubit Duo to create an entangled state and examine the effects of noise.

### Procedure

#### Creating an Entangled State

- Press Alice’s
`H`

(Hadamard) button to put Alice’s qubit in a superposition state. - Press the
`CNOT`

button to entangle Alice and Bob’s qubits.

#### Measuring

Press either Alice’s or Bob’s `Measure`

button to measure the state of both qubits and record the result in the histogram.

#### Resetting the State

Finally, press the `Reset`

button to return Alice and Bob’s qubits to their initial state (`00`

).

### Measurement Without Noise

With the noise level set to 0%, we repeated the `H`

→ `CNOT`

→ `Measure`

→ `Reset`

sequence 30 times.

### Measurement With Noise

We increased the noise level to about 5% and repeated the `H`

→ `CNOT`

→ `Measure`

→ `Reset`

sequence 30 times.

### Analysis of Results

Without noise, the measurement results of the entangled state show an almost equal distribution of “00” and “11” outcomes. However, with noise present, “01” and “10” outcomes start to appear. This is because noise can break down entanglement and superposition, or prevent the proper preparation of the desired state, leading to more random qubit states.

This experiment demonstrates how sensitive entangled states are to noise. In actual quantum computer operations, noise is a significant challenge, making noise reduction techniques crucial.

## Exercise: Learning to Suppress Errors Under Noisy Conditions

Let’s use Qubit Duo to think about strategies for minimizing errors when measuring entangled states in a noisy environment.

#### Goal

- Perform 30 measurements of an entangled state with a high noise level, and find ways to effectively suppress errors.

#### Procedure

- Set the noise level to 5%.
- Press the
`H`

→`CNOT`

→`Measure`

→`Reset`

buttons in sequence to perform 30 measurements. - You can experiment with the timing of button presses.
- If the entangled state breaks down, you can recreate it using
`H`

and`CNOT`

operations. - Use the
`Reset`

button to return to the initial state if necessary. - Observe the histogram to check the results of each operation and monitor error occurrence.
- Examine the distribution of measurement results and consider how you managed to suppress the effects of noise.

#### Example Tasks

- Submit a screenshot of the histogram obtained from 30 measurements.
- Explain the sequence of operations you performed and the strategies you used to suppress errors.
- Write a brief analysis of best practices for error suppression under noisy conditions.

## Conclusion

Understanding quantum entanglement and qubit manipulation is essential for grasping the principles of quantum computing. Qubit Duo provides an engaging and visual way to learn these concepts. By experimenting with this tool, you can gain insights into the behavior of qubits, the effects of quantum gates, and the challenges posed by environmental noise in quantum systems.