The gates presented in the previous chapters can now be used to create simple algorithms on circuits. To do this, we first need to examine the application of several gates to a qubit illustrated as follows:
In the QASM language, we can define three different u3 gates to achieve the three different gates
Diagram
OPENQASM 2.0; include "qelib1.inc"; qreg q[1]; u(pi,pi,pi) q[0]; u(pi/2,pi/2,pi/2) q[0]; u(pi/4,pi/4,pi/4) q[0];
Simulation
Not run yet
The states of the intermediate steps
Please note that the order of the gates cannot generally be reversed.
The states and the corresponding probability of obtaining a certain final state can be calculated, but certainty can only be achieved by measuring, which in turn destroys the possible superposition of the qubit(s). During the course of this lecture, we will often see that this effect of measurement can also be used as a specific tool for tasks.
A simple example is the combination of a Hadamard gate and a measurement, which creates a real random number generator:
Diagram
OPENQASM 2.0; include "qelib1.inc"; qreg q[1]; creg c[1]; h q[0]; measure q[0] -> c[0];
Simulation
Not run yet
The state of the input qubit can be either
Another circuit that looks very simple at first glance is the entanglement of two qubits.
Diagram
OPENQASM 2.0; include "qelib1.inc"; qreg q[2]; h q[0]; cx q[0], q[1];
Simulation
Not run yet
If
At time step
This state is named after the Irish physicist John Bell; there are a
total of four such states depending on the input register
The four states differ mainly in that the same result is measured for
We can see from this final state that it cannot be written as a tensor product of individual qubits. This is precisely how entanglement is defined2:
Definition
Let
If there is no such decomposition, the state is called entangled.
To create an entangled state, we need a unitary transformation, which itself cannot be represented as a tensor product on individual qubits. Alongside superposition, entanglement is one of the most powerful tools for quantum computing. Physically, these states are difficult to produce and therefore expensive, which is particularly true if they are to be produced over long distances.