# Project 11: Quantum Computing (15 pts)

## What you need

• Any computer with a Web browser.

## Purpose

To practice using a quantum computer for very basic operations.

## Background

Here is a quick introduction to quantum mechanics and quantum computing. Click any of the three images below for a web page explaining each topic in more detail.

### The Feynman Double Slit Experiment

Quantum mechanical objects, such as electrons, are not localized when they are not observed. They move as waves, smeared across space, but when observed, the wave function collapses and they are only seen to be at one location. Here is a famous explanation of that phenomenon. ### Shor's algorithm

This can be used to construct a network of qubits that factors compound numbers into their prime factors very quickly, as explained here: ### Qubits

In Quantum Computing, the fundamental element is the Qubit, an object that has many possible states, as shown below.

At the top is the pure state `|0>` and at the bottom is the pure state `|1>`. Normal computers use bits with only these two states: 0 and 1.

Quantum computers use the whole range of states, including the intermediate states that are "superpositions" of `|0>` and `|1>`. ## Creating an Account

In a Web browser, go to

At the top right, click Register, as shown below. Create an account, as shown below. The "My Projects" page opens, as shown below. Click the green "New project" button.

Set the Visibility to Private and give your project any name, as shown below. Click Continue.

The Drag & Drop editor page appears, as shown below.

On the left there are square icons called "Measurement Gates". On the right, the "Edit QASM" pane shows one Qubit named q0, with an initial state of `|0>`, which is a certain state of zero. # Task 11.1: Classical Computation (5 pts)

First we'll use our Qubits in their certain states of `|0>` and `|1>` only.

These quantum programs do the same thing normal digital computers do.

In the Drag & Drop editor, on the left side, find the icon that looks like an umbrella, as shown below.

This is a "Measurement Gate". Drag the "Measurement Gate" and drop it on the q0 line, as shown below.

A second line appears, labelled c, with an initial state of `0`. This is a classical bit, with a value of zero.

This quantum program takes a qubit with a state of `0` and measures it, creating a "classical" (non-quantum) bit with a value of 0. At the top center, click the Simulate button.

The quantum program runs. The result is a single bit, which is always zero. This is indicated by showing that the "Probability of 1" is 0, as shown below. ## Classical Bit-Flipping

At the top center, click the Edit button.

Perform these three operations:

• Drag an X gate and drop it on the q0 line before the Measurement gate.
• Drag an X gate and drop it below the other X gate, creating a new qubit line names q1 line before the Measurement gate.
• Drag a Measurement gate and drop it on the q1 line to the right of the X gate.
Your quantum program should look like the image below.

This program takes two qubits, each with an initial state of `0`, and rotates them 180 degrees about the X-axis, which flip each qubit to a state of `1`. It then measures them, using a classical bit, which has the value 1 both times it is used. At the top center, click the Simulate button.

The quantum program runs. The result is two bits, both with a "Probability of 1" of 1, as shown below. ## H 11.1: A Classical Computation (5 pts)

Compose the experiment below and simulate it. The result shows the five resulting bits, covered by a green box in the image below.

The flag is those five bits, like 00000. # H 11.2: Quantum Uncertainty (5 pts)

To put a qubit into an uncertain state, we'll use the H gate. This gate rotates the qubit around an axis at a 45-degree angle, so that the certain state `|0>` becomes an uncertain state in between `|0>` and `|1>`, as shown by the orange arrow in the figure below. ## Creating Uncertainty ("Superposition")

At the top center, click the Edit button.

At the top left, find the "Undo" button, as shown below. Click the "Undo" button enough times to clear your previous calculation, and compose the program shown below. Simulate it. The qubits are now in uncertain states, sometimes 0 and sometimes 1, so the "Probability of 1" is .5, as shown below. ## H 11.2: Several Uncertain Bits ( 5 pts)

Compose the experiment below. Simulate it. The result shows the five resulting probabilities, covered by a green box in the image below.

The flag is those five probabilities, separated by spaces, like 0 0.1 0.2 0.5 1. # Task 11.3: Quantum Entanglement (5 pts.)

## Entanglement with a Certain State

The + (entanglement) operator connects two qubits together, so they are always the same.

Compose the experiment shown below.

To make the entanglement, first drop an X gate on the top line, and then drop a round dot icon on the lower line. Simulate it. T Both bits are now 1, as shown below.

The X gate flipped q1 to `|1>`, and the + gate entangled q0 with q1, so they both flipped together.

This is a fundamental, strange property of quantum mechanics, which Einstein called "spooky action at a distance," because there's no obvious physical link between the qubits. ## H 11.3: Several Entangled Bits (5 pts)

Compose the experiment below. Simulate it. The result shows the five resulting probabilities, covered by a green box in the image below.

The flag is those five probabilities, separated by spaces, like 0 0.1 0.2 0.5 1. Posted 3-24-19
Revised to use a different quantum simulator 7-11-19