We have seen the enormous superiority that qubits have over bits. This means nothing though, if we don’t have a way of manipulating the information in qubits. To manipulate information in a qubit, quantum gates are used.
How quantum gates work
A quantum gate works similar to a classical logic gate. Classical logic gates take bits as input; evaluate and process the input and produce new bits as output. In the example below (refer to diagram CLG), the logic gate takes in 0101 as input, which ‘goes through’ the gate and an output of 10 is produced.
Quantum logic gates also emulate this, but remember quantum gates take in qubits which can exist in a state of superposition. This opens up a whole new dimension of possible solutions and outputs. In the example below (refer to diagram QLG), the quantum gate takes in 010 (a basis computational state), and would you say it should output? Another basic computational state? No! Instead, and extraordinarily so, it outputs a wave function representing a superposition state. Magic ! This is the weirdness of the quantum world, where things don’t behave how we expect them to. Fortunately, this weirdness can be exploited to achieve greater processing power, and that is the main advantage of quantum gates (and quantum computer in general).
Another property of quantum gates it that they are reversible unlike many classical logic gates. This means that the outputs can be converted back into the original input. Why is necessary? In order to preserve the quantum state. In order for the gates to be reversible, the number of outputs must be the same as the number of inputs.
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffSynergy 2008 ©