Quantum Operations

#quantum #qbronze

Part of Womanium Quantum + AI 2024 program


Representation

A quantum operation can be represented as a matrix u multiplied by the amplitude vector of a state.

Thus, unlike classical operations, all quantum operations must be reversible.

Multiple Qubits

As we did in classical bits, we can represent multiple qubits as a tensor product of their vectors.

Example:

|Ψ=α|0+β|1|Φ=γ|0+δ|1|Ψ|Φ=(α|0+β|1)(γ|0+δ|1)=αγ|0|0+αδ|0|1+βγ|1|0+βδ|1|1=αγ|00+αδ|01+βγ|10+βδ|11=(αγαδβγβδ)

This can also be seen when using other representations, such as:

(αβ)(γδ)=(αγαδβγβδ)
Important

A classical computer can efficiently simulate a quantum system as long as it's guaranteed that the system will always be in a decomposable state, meaning we can represent the system state as the tensor product of multiple states, that's done by storing one amplitude of each qubit.

Quantum Gates and Operations

Hadamard Gate

The Hadamard gate is used to put a qubit in superposition, it transforms a qubit in the 0 or 1 state to an equal superposition of both 0 and 1.

It can also be defined as a reflection on the unit circle around the line y=sin(π/8)cos(π/8)x

H=12(1111)

such that

HT H=I, HT=H

Hadamard Basis:

H|0=12(1111)(10)=12(11)=12(|0+|1)=|+H|1=12(1111)(01)=12(11)=12(|0|1)=|

X Gate (Pauli-X Gate)

The X gate acts like a NOT gate, swapping the α and β amplitudes. Another definition is that the X gate is a reflection operator along the X axis in the bloch sphere.

X=(0110)

Z Gate

The Z gate flips the local phase of a qubit, adding sign to the amplitude of the |1 state. Another definition is that the Z gate is a reflection operator along the Z axis in the bloch sphere.

Z=(1001)

CNOT Gate (CX)

Controlled-NOT gate is a 2-bit gate, control bit and target bit , it applies an X gate to the target bit if the control bit is in the |1 state.

CNOT=(1000010000010010)
Controlled Gates

CNOT gate is part of a class of gates called controlled gates, where the application of a gate relies on the state of one or more control bits. Another example is the Controlled-Z gate.

RY Gate

The RY gate is a rotation operator along the y axis.

RY(θ)=(cosθ2sinθ2sinθ2cosθ2)
Info

When rotating a real-valued qubit by θ, then we must rotate it by 2θ since RY is a unitary operator, and in the bloch sphere the |0 and |1 states are opposite each other.

Reflection Operator

An arbitrary reflection can be done around a line. Let θ be the angle of the line of reflection. Then, the matrix form of the reflection is represented as follows:

Ref(θ)=(cos2θsin2θsin2θcos2θ)

Notice that Ref(π/8)=H

Equivalence to other operators

The reflection operator can be represented as the following sequence of gates

RY(4θ)Z(cos4θ2sin4θ2sin4θ2cos4θ2)(1001)=(cos2θsin2θsin2θcos2θ)

Unitary Evolution

Applying a quantum operations on a quantum device is called unitary evolution, and will result in changing the system state from

|ψ=i=0n21αi|i,i=0n21αi2=1,αaR

to

U|ψ=|ϕ=i=02n1βi|i,i=02n1βi2=1,βiR

Multiple-Control Construction

We can construct a gate (such as the CNOT gate) to be controlled with multiple control bits and even have the control active in state |0 instead of state |1.

C0NOT Gate

To create a C0NOT gate, we can simply "move" the X gate matrix entries in the CNOT gate to the top-left side of the matrix (i.e. where the control is 0):

C0NOT=(0100100000100001)

Alternatively we can apply an X operator on the control bit before the CNOT gate then apply another X operator on the control to return it back to it's original state.

C0NOT=X.CNOT.X

CCNOT Gate (Toffoli Gate)

In a Controlled-Controlled-NOT Operator, the NOT gate applies when both of the control bits are in the |1 state.

The matrix of the CCNOT gate is as follows:

CCNOT=(1000000001000000001000000001000000001000000001000000000100000010)

The matrix only flips the state of the target in the last section, i.e. when both of the control bits are in the |1 state.

Info

A C0C0NOT, C0CNOT and a CC0NOT gate can be implemented as explained in C0NOT Gate.

Note

Similarly a gate with n control bits can be constructed.

Classical Operations as Quantum Operations

We must ensure that we are able to transfer our classical experience and knowledge to quantum computing, therefore we need to be able to implement classical gates as quantum operations.

This is not a straight forward task, since all quantum gates must be reversible, and that's not the case with classical gates.

Example

Applying a classical AND gate to two bits results in one bit that can not be reversed back to the original two bits.

We do this by changing the model of the gate so that, instead of the output being only the result of applying the gate, we output all the input bits in addition to the result bit. This way, we ensure that we are not losing any information after applying the gate.

This concept can be used to implement all classical gates. In fact, it can be used to implement any irreversible gate.

classical gates implementation.png|500

As shown in the figure we feed the gate n extra bits, in the |0 state, to store the result of the gate / function in them.

This operations is reversible by applying UC again, then we will get xf(x)f(x)=x0, which is the same as the state before the gate.


< Prev | Next: Entanglement >