In our previous article Introduction to quantum computing, we saw that the real value of quantum computing lies in the fact that a quantum system can do processing while **the qubits are in a superposition state**. Hence, the operations defined by the quantum algorithms do not manipulate by example just 3 bits, they manipulate 2^{3} probability^{[1]} values. One step in a quantum algorithm on a quantum computer with 3 qubits is therefore modifying 8 values. **Adding one qubit doubles the processing capabilities** of the quantum computer. This explains the term "**exponential**" that is often used together with quantum computing: adding N qubits adds processing power proportional to 2^{N} .

If it should be clear by now that a quantum computer allows some kind of parallel processing, what does we mean more precisely by **processing a qubit**?

In classical computing, all the operations finally come down to a sequence of simple manipulations of the bits in the computer systems. Those **low-level operations are achieved using gates**. It can be shown that with a limited number of gates, all possible scenarios can be achieved.

A very simple classical gate is the **NOT gate**, also known as the inverter.This gate has one input bit, and one output bit. The output bit of the gate is the inverse of the input bit. If the input is "0", the output will be "1". If the input is "1", the output will be "0".

The behavior of gates is often explained via simple tables where the possible combinations of input bits are listed, and the resulting output is listed in the last column. The following table shows the behaviour of the NOT gate

When the input of the gate is '0', the output is '1'. When the input of the gate is '1', the output is '0'.

The NOT gate involves a single bit only, but other gates involve more bits. The** XOR (or EXOR) gate **, for example, takes the **input of 2 bits**, and outputs a value that is '1' in case exactly one of the 2 input bits is 1 and the other is '0'.

##### Quantum gates

If we want to process data in quantum computing, we have to use gates as well. **Quantum gates** are the building blocks of quantum circuits, like classical logic gates are for conventional digital circuits.

But unlike many classical logic gates, quantum logic gates **sould be reversible**. That is, it should always be possible to apply another gate and go back to the state of the system before the first gate was applied. This restriction does not apply on classic gates. For example, the XOR gate is not reversible. If the result of an XOR gate is '1', it is impossible to know whether the first bit was '0', or whether it was the second bit^{[2]}.

The quantum equivalent of the NOT gate for classical computers is called the **Pauli-X gate**. It acts on a single qubit. If the qubit is in |0> or |1> states, the Pauli-X gate flips its value of |0> into |1> and vice and versa.

If we represent the two pure state |0> and |1> as two points opposite along the vertical axis

applying the Pauli-X gate is equivalent to a rotation of the state of the qubit of 180 degrees.

As in classical computing, each quantum gate is represented by a symbol; below is how we usually represent the Pauli gate

**Remark 1**: We see immediately that this operation is reversible as applying twice a 180° rotation along the same axis leaves the state invariant.

**Remark 2**: We just saw the extreme case that when the qubit is either 0 or either 1 before the Pauli-X gate is applied, the gate will simply invert the value; the Pauli-X gate in general swaps the probabilities of finding 0 and finding 1 when the qubit is measured.

This is an easy result to get when we switch to the matrix representation of the Pauli-X gate, i.e the **Pauli-X matrix**:

When applied to the pure states |0> and |1>, we see easily that |0> become |1> and vice-versa:

When applied to a mixed state |Φ> = α|0> + β|1> then applying the Pauli-X gate to the qubit equats to multiply the Pauli-X matrix to the vector of components α and β in the basis |0> and |1>

the components of the vector are swapped.

**Remark 3**: The Pauli-X gate is so called as each (pure) qubit state can be thought a point sitting on a sphere called the Bloch Sphere.

We see easily that flipping from state |0> to |1> can be visualized as a rotation **around the X-axis.**

More generally, if we define in spherical coordinates the angle θ as the traditional colatitude with respect to the z-axis and φ as the longitude with respect to the x-axis, we verify easily that for each point on the Bloch Sphere, the qubit state can be written as:

If the qubit is in the pure |0> state, the qubit is at the very top of the sphere, i.e. θ=0 and φ=0 and we verify that |0> = cos (0/2)|0> + sin (0/2) |1> = |0>

If the qubit is in the pure state |1>, the qubit is at the very bottom of the sphere, i.e.θ=180° and φ=0 and we verify that |1> = cos (90°)|0> + sin (90°) |1> = |1>

##### Hadamard gate, the gate to superposition

What if we rotate our up vector |0> of 180 degrees or π radians around the X-axis and then of π/2 radians around the Y-axis?

We get **a superposition state** 1/√2(|0> + |1>) with equal weight of the computational basis states. In other words, applying this new gate, called **the Hadamard gate** to a qubit that is in state |0> brings the qubit in a |0> and |1> superposition state where the probability of measuring 0 is equal to the probability of measuring 1 (and equals to 1/√2^{2}=1/2)

Similarly, applying the Hadamard gate to the down state |1> brings the qubit to the superposition state 1/√2(|0> - |1>)^{[3]}.

This is easy to spot when we write the Hadamard gate in its matrix form:

When applying this gate to the basis vectors |0> and |1>

**Remark 1**: we can verify easily that applying twice the Hadamard gate is a reversible process: if we apply the gate again on each of the previous state, it goes back to the original state again.

**Remark 2**: The circuit diagram symbol for the Hadamard gate is shown below:

**Remark 3**: Conceptually, quantum computing operations manipulates Φ and θ of the superposition to move points along the surface of the Bloch unit sphere.

**Remark 4**: We can use a Quirk, a terrific browser-based tool for experimenting with quantum circuits. It has a drag and drop interface, built-in support for many common gates, and the ability to easily share circuits by URL.

This is how the Hadamard gate applied to one qubit looks like in this environment. We verify that there is 50% of probability to measure the eigenvalue 0, corresponding to |0> eigenstate and 50% of probability to measure 1, corresponding to |1> state.

[1] Each probability is the probability that the state of the composed system collapses to one of the eight orthonormal basis vectors of the tensor product of the three qubit subsystems.

[2]For quantum operators to be reversible in both directions, no information can be lost. Therefore, both the input and output must have the same number of qubits.

[3]These two states are commonly refered to as |+⟩ and |-⟩ and on the Bloch sphere, they are located on the equator.