# Quantum Information

In this section, we'll combine many of the concepts we've discussion in the tutorial so far. This means that if anything so far has confused you or if you feel like you need more information on anything, this would be the time to review.

## Reversible Computing

Simply put, quantum calculations need to be reversible. During the process of quantum computation, *information* should not be destroyed.&#x20;

In a classical system this isn't a concern - as long as we get the result we're looking for, we don't have any problem. For our [*Turing machine*](https://lewisla.gitbook.io/learning-quantum/classical-models-of-computation#the-turing-machine), the state of the system changes with every instruction. We're not so concerned with remembering the *previous* state, as long as the *current* state conforms to our expectations.

### Reversibility

> A computation is *reversible* if it is always possible to uniquely recover the input, given the output. For example, the NOT operation is reversible, because if the output bit is 0, you know the input bit must have been 1, and vice versa. On the other hand, the AND operation is not reversible. [*(Kaye, P. - p.12)*](https://lewisla.gitbook.io/learning-quantum/quantum-circuit-summary/quantum-circuit-references#reversibility)

It's important to fully understand what this means. If I provide to you only the resulting state of some quantum computation, it must be true that you can figure out where I started from.&#x20;

### Converting Classical Gates

While most classical gates are not reversible, we can change them so that they are. This requires adding more wires, used only to keep the information we put in [*(Kaye, P. - p.12)*](https://lewisla.gitbook.io/learning-quantum/quantum-circuit-summary/quantum-circuit-references#diagram-of-the-reversible-and-gate)*:*

![The reversible AND gate keeps a copy of the inputs](https://3199855145-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-Qqv_c34aARaXqqlB7%2F-M32ZzwLkYMJO27PedQZ%2F-M32d2kOadlscfMfnEUT%2Fimage.png?alt=media\&token=dd4de8b9-fd2d-4f8a-936b-12fd6a7d1519)

### Measuring

The one non-reversible action we take in quantum computation is [*measuring* ](https://lewisla.gitbook.io/learning-quantum/physics/quantum-mechanics#measuring-quantum-systems)(or observation).

When we measure a qubit, it [*collapses* ](https://lewisla.gitbook.io/learning-quantum/qubits/quantum-bits#measuring-qubits)into a particular state. It's forced to reveal what it had been doing this whole time - like our [*cat in the box*](https://lewisla.gitbook.io/learning-quantum/physics/quantum-mechanics#superposition), we know if it was alive or not.

This means we need to measure at the end whenever possible, so that we preserve reversibility until we have no choice.

{% hint style="info" %}
[More detail on what measurement is and how it works](https://towardsdatascience.com/understanding-basics-of-measurements-in-quantum-computation-4c885879eba0)
{% endhint %}

## The Bloch Sphere

![A diagram of the Bloch sphere](https://3199855145-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-Qqv_c34aARaXqqlB7%2F-M32ffIjZIlmDJ9vgOLt%2F-M32fy4VgzkG6CzOa0PR%2FBloch_sphere.svg?alt=media\&token=4d318bc4-8ab2-4c40-8bff-3e891de02b88)

The Bloch sphere can be used to describe the behaviour of single qubit systems [*(Wikipedia - 2020)*](https://lewisla.gitbook.io/learning-quantum/quantum-circuit-summary/quantum-circuit-references#diagram-of-the-bloch-sphere). Here we see that we have a [*3-dimensional space*](https://lewisla.gitbook.io/learning-quantum/linear-algebra/space-dimension-and-span#space), and like all quantum system we're able to[ *range across the complex numbers* ](https://lewisla.gitbook.io/learning-quantum/physics/quantum-mechanics#quantum-vectors)as well as the real numbers.

{% hint style="info" %}
[More general information about the Bloch sphere](https://www.quantiki.org/wiki/bloch-sphere)
{% endhint %}

### What the Diagram Shows Us

Let's explore some of the things labelled on this diagram:

* $$x, y , z$$ are our three axis for 3-dimentional space
  * Note that the sphere has a radius of exactly *one unit*&#x20;
* $$|0\rangle$$ and $$|1\rangle$$ are our two distinguishable states
  * See that these two are opposite each other on the diagram
* $$|\psi\rangle$$ is our vector in an unknown state - the single qubit we're describing
  * Our qubit projects a *shadow* - this is the dotted line we see
  * When we draw a line between the shadow and our vector, we get a right angle triangle
* $$\theta$$ is the angle between the vector for our qubit $$|\psi\rangle$$ and the $$z$$ axis
* $$\varphi$$ is the angle between the shadow of our qubit and the $$x$$ axis

The sphere shows us all of the possible states our single qubit can be in. Not just $$|0\rangle$$and $$|1\rangle$$, but the infinite combinations in between. By measuring the angle the vector $$|\psi\rangle$$ and it's shadow make with respect to the $$x$$, $$y$$and $$z$$ axis, we can derive the probability of finding our qubit in a particular state when we measure it.

This diagram doesn't show multiple qubits systems, mostly because it *can't*. Systems with more than one qubit are too complex to imagine with a picture like this.

{% hint style="info" %}
[More detailed information about how the Bloch sphere is derived and what information we can find on it](https://physics.stackexchange.com/questions/204090/understanding-the-bloch-sphere)
{% endhint %}

## Quantum Circuits

Using these principles of quantum information, we can begin to construct quantum circuits in the same way that we would with a classical circuit.

### Quantum Gates

Like [*classical gates*](https://lewisla.gitbook.io/learning-quantum/classical-models-of-computation#using-gates), quantum gates are all described with a [*transformation matrix*](https://lewisla.gitbook.io/learning-quantum/linear-algebra/transformations#transformation-matrices) which tells us how they change our qubit vector.

However, there are a few important differences between classical gates and quantum gates. One is that all these operators will be *reversible.* This means our transformation matrices will have an *inverse* that we put our output in to get back to our input.

Another is that we can now include [*imaginary*](https://lewisla.gitbook.io/learning-quantum/physics/quantum-mechanics#imaginary-numbers) and [*complex*](https://lewisla.gitbook.io/learning-quantum/physics/quantum-mechanics#complex-numbers) numbers in our transformations. This accounts for quantum vectors ranging over the set of complex numbers in addition to real ones.

Lastly quantum gates produce the *same number of outputs as we provide inputs*. This means no quantum gates are like the classical AND gate, where they two in two inputs and produce one output. This relates back to [*reversibility*](#reversibility) - no information can be lost.

### Notation

#### The circuit

We draw quantum circuits in a similar way that we draw classical gates. We start with our inputs on one side, put them through various transformations via logic gate, and on the other side we get our outputs.&#x20;

Though the quantum circuit doesn't have a *wire* like the classical one, we'll still use a line to show which inputs are entering which gates and in what order.

![A diagram showing an empty quantum circuit](https://3199855145-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-Qqv_c34aARaXqqlB7%2F-M33cn8HVb6ZP1E1G5mX%2F-M33ed2HfNrm_JNuysTu%2Fcircuit\(2\).svg?alt=media\&token=462f2b48-d642-4a42-8aa0-e167facc0745)

Most gates will be represented by a box around their corresponding symbol - some may be represented by other symbols. As we go through descriptions for the different gates, we'll include their symbols [*(Kuo, S. - 2013)*](https://lewisla.gitbook.io/learning-quantum/quantum-circuit-summary/quantum-circuit-references#diagram-showing-the-representation-of-several-quantum-circuits):

![A diagram showing several quantum gates and their representation](https://3199855145-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-Qqv_c34aARaXqqlB7%2F-M338gIZQIPrXInvUq3i%2F-M339aS3cquPEgS00wPB%2Fimage.png?alt=media\&token=e74ef725-0e1a-48d5-b250-d5d3d204cd0b)

#### Measurements

Though the process of measurement doesn't have a transformation matrix and isn't really a gate, we'll use a similar notation for it:

![A diagram showing the symbol for measurement](https://3199855145-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-Qqv_c34aARaXqqlB7%2F-M33C0GZ820vNkrklJIJ%2F-M33DVAhMK5RnF_KiN_W%2Fimage.png?alt=media\&token=ec8cee97-b7b3-4e3b-aa6f-796c53aa37ce)

Recall that measurements are stored in classical bits, so our diagram will also include those:

![A quantum circuit diagram showing a measurement](https://3199855145-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M-Qqv_c34aARaXqqlB7%2F-M33cn8HVb6ZP1E1G5mX%2F-M33f7CdJVc9shYzTto3%2Fcircuit\(3\).svg?alt=media\&token=a114b816-582e-4778-930f-1ccd58205983)

{% hint style="success" %}
For these tutorials, gates will be produce using IBMQ's [*Circuit Composer*](https://quantum-computing.ibm.com/composer) tool. We'll talk more about how you can get access to this later on.
{% endhint %}
