Quantum circuit model is a quantum analogy of the classical circuit. A computation process in classical circuit requires a system that can represent data(input), a way to perform manipulation of that data(computation), and a method for reading out (output).
(input) initialize the qubits in the input state.
Quantum bits (qubits) : represent the data.
(computation) Quantum gates on the qubits to manipulate the data.
(output) Measurements on the qubits to read out the result.
The classical circuits consist of elementary logical operations. (NOT, AND, OR, NAND, etc.) Quantum circuits are also composed of elementary logic operations, which are quantum gates.
1.1. Reference
Chapter 1 in 《Advanced Quantum Algorithms》by Giulia Ferrini, Anton Frisk Kockum, Laura García-Álvarez, Pontus Vikstål
Quantum Algorithm Implementations for Beginners arXiv:1804.03719 Los Alamos National Laboratory
《Gates, States, and Circuits》 Notes on the circuit model of quantum computation (2021) Gavin E. Crooks
《Differentiable Quantum Circuits》 2019
Michael A Nielsen and Isaac Chuang.《Quantum computation and quantum information》, 2002
The quantum bit (qubit) is a fundamental unit of quantum information. It can be physically realized with a two-level quantum-mechanical system.
A qubit can be described by a linear combination of two orthonormal basis states ∣0⟩ and ∣1⟩
∣ϕ⟩=α∣0⟩+β∣1⟩.
These basis states ∣0⟩ and ∣1⟩ are usually denoted as
∣0⟩=(10),∣1⟩=(01)
Therefore, the state of the qubit is the two dimensional complex vector ∣ϕ⟩===α∣0⟩+β∣1⟩α(10)+β(01)(αβ)
where α and β are the probability amplitudes. When we measure the qubit in the standard basis
the probability of outcome ∣0⟩ with value "0" is ∣α∣2
the probability of outcome ∣1⟩ with value "1" is ∣β∣2
the normalization constraint means
∣α∣2+∣β∣2=1
2.1. Multi-qubit
Given the individual qubits, it is necessary to know how to construct the combined state of qubits.
Suppose, we have two single qubit states ∣a⟩=(αβ) and ∣b⟩=(α′β′). The joint state of a system composed of two independent qubits is given by
∣a⟩⊗∣b⟩=(αβ)⊗(α′β′)=⎝⎜⎜⎛αα′αβ′βα′ββ′⎠⎟⎟⎞
Where we taking the tensor product ⊗ of two states. The tensor product of two states also can be denote as
∣a⟩∣b⟩
∣ab⟩
For example, The joint state of ∣0⟩ and ∣1⟩∣00⟩,∣01⟩,∣10⟩,∣11⟩
The tensor product of these vectors are usually denoted as
∣00⟩=(10)⊗(10)=⎝⎜⎜⎛1000⎠⎟⎟⎞
∣01⟩=(10)⊗(01)=⎝⎜⎜⎛0100⎠⎟⎟⎞
∣10⟩=(01)⊗(10)=⎝⎜⎜⎛0010⎠⎟⎟⎞
∣11⟩=(01)⊗(01)=⎝⎜⎜⎛0001⎠⎟⎟⎞
A four-dimensional linear vector space is formed by these vectors basis, which could represent any two qubits.
∣ψ⟩=α1∣00⟩+α2∣01⟩+α3∣10⟩+α4∣11⟩
2.2. Entangled states
A system of two qubits whose complete state can be the tensor product of two different single qubit states. An example of such a state is
∣01⟩=(10)⊗(01)=⎝⎜⎜⎛0100⎠⎟⎟⎞
But it is possible for a state of two qubits that cannot be written as the tensor product of two single qubit states. For two qubits, these states are Bell states
∣∣Φ±⟩∣∣Ψ±⟩=21(∣00⟩±∣11⟩)=21(∣01⟩±∣10⟩)
States of a system of which cannot be expressed as a tensor product of states of its individual subsystems are called entangled states.
3. Qubit gate
Mathematically, Quantum state is a vector ∣ψ⟩. Qubits undergo unitary transformations to change their state.
∣ϕ⟩→U1∣ϕ⟩→U1U2∣ϕ⟩→U1U2…∣ϕ⟩
A unitary transformation is described by a matrix U with complex entries. It is necessary for the matrix to be unitary due to the conservation of probabilities.
UU†=U†U=I,
For example, a single qubit gate U acting on a qubit state ∣ϕ⟩=α∣0⟩+β∣1⟩ get a new state ∣ψ⟩∣ψ⟩===U∣ϕ⟩(U00U10U01U11)(αβ)(U00α+U01βU10α+U11β)
Since quantum gates must be unitary operators, we often use the words "gate" and "operator" back and forth.
Gate=Operator
So remember, in this note, they mean the same.
3.1. Single qubit gate
NOT gate
Hadamard gate
Phase gate
3.1.1. NOT gate
Start with the simplest quantum gate, the quantum NOT gate. In fact, we have seen the quantum NOT gate, that is, the X Pauli matrix.
X=UNOT=(0110)
quantum NOT gate UNOT acts on the computational basis
∣0⟩=(10),∣1⟩=(01)
That are
UNOT∣0⟩=(0110)(10)=(01)=∣1⟩UNOT∣1⟩=(0110)(01)=(10)=∣0⟩
new denote
We use the most intuitive way, the matrix to express the quantum gate and its effect on quantum bits. Now introduce the new denote
X∣j⟩=∣j⊕1⟩
where
∣j⟩ Dirac notation of qubit
⊕ is exclusive-OR operator (XOR)
There are two possibilities
if j=0, then X∣0⟩=∣0⊕1⟩=∣1⟩.
if j=1, then X∣1⟩=∣1⊕1⟩=∣0⟩
3.1.2. Hadamard gate
Hadamard matrix
H=21(111−1)
Hadamard gate in the outer product notation
H=21(∣0⟩⟨0∣+∣0⟩⟨1∣+∣1⟩⟨0∣−∣1⟩⟨1∣)
Hadamard gate acts on stste ∣0⟩H∣0⟩=21(∣0⟩⟨0∣+∣0⟩⟨1∣+∣1⟩⟨0∣−∣1⟩⟨1∣)∣0⟩=21(∣0⟩⟨0∣0⟩+∣0⟩⟨1∣0⟩+∣1⟩⟨0∣0⟩−∣1⟩⟨1∣0⟩)=2∣0⟩+∣1⟩
similarly
H∣1⟩=2∣0⟩−∣1⟩
Hadamard matrix acts on the standard basis states (computational basis states) to get two superposition states {2∣0⟩+∣1⟩,2∣0⟩−∣1⟩}
Therefore, the Hadamard gate takes the general state ∣ψ⟩=α∣0⟩+β∣1⟩ into the state
H∣ψ⟩=αH∣0⟩+βH∣1⟩=α(2∣0⟩+∣1⟩)+β(2∣0⟩−∣1⟩)=(2α+β)∣0⟩+(2α−β)∣1⟩
3.1.3. Phase shift
Generally, the phase shift gate is given by
P=(100eiθ)
the action of the phase shift gate on a qubit is
P∣ψ⟩=(100eiθ)(αβ)=(αeiθβ)
We can find that this gate shifts the relative phase of the amplitudes α and β of a qubit. This is more obvious if we write in other notation
P∣ψ⟩=(∣0⟩⟨0∣∣+eiγ∣∣1⟩⟨1∣)(cosθ∣0⟩+eiϕsinθ∣1⟩)=cosθ∣0⟩+ei(γ+ϕ)sinθ∣1⟩
where
∣ψ⟩=cosθ∣0⟩+eiϕsinθ∣1⟩ the qubit in the Bloch sphere representation
P=∣0⟩⟨0∣∣+eiγ∣∣1⟩⟨1∣ The phase shift operator in outer product notation
There are special cases of interest in we take special value of angle θ
when θ=π
(100eiθ)=(100eiπ)=(100−1)
In fact, this is one of the Pauli matrices, called the Z-matrix. The Z matrix is sometimes called the phase flip gate because it takes a qubit ∣ψ⟩=α∣0⟩+β∣1⟩ into a state ∣ψ′⟩=α∣0⟩−β∣1⟩.
Z∣ψ⟩=(100−1)(αβ)=(α−β)
when θ=π/2
(100eiπ/2)=(100i)=S
when θ=π/4(100eiπ/4)=eiπ/8(e−iπ/800eiπ/8)=T
This is called the π/8 or T gate:
3.2. Two qubit gate
We will introduce a type of quantum gate called controlled gate. We can implement an if-else construct with a quantum gate using a controlled gate. Consider a control bit C.
If C=0, then the gate does nothing
if C=1, then the gate performs some specified action.
Generally, the controlled application of a single-qubit unitary U to the second qubit takes the form
(I20202U).
3.2.1. Controlled NOT gate
The first example we will introduce is the controlled NOT gate. The matrix representation of controlled NOT gate is given by
CN=⎝⎜⎜⎛1000010000010010⎠⎟⎟⎞
the action of the controlled NOT gate is given by
CN∣00⟩↦∣00⟩CN∣01⟩↦∣01⟩CN∣10⟩↦∣11⟩CN∣11⟩↦∣10⟩
we can find
If the control qubit is ∣0⟩, then nothing happens to the target qubit.
If the control qubit is ∣1⟩, then the NOT matrix is applied to the target qubit.
The outer product representation of the controlled NOT with Dirac notation is
CN=∣00⟩⟨00∣+∣01⟩⟨01∣+∣10⟩⟨11∣+∣11⟩⟨10∣
the action of the controlled NOT gate on ∣10⟩ in detail
CN∣10⟩=(∣00⟩⟨00∣+∣01⟩⟨01∣+∣10⟩⟨11∣+∣11⟩⟨10∣)∣10⟩=∣00⟩⟨00∣∣10⟩+∣01⟩⟨01∣∣10⟩+∣10⟩⟨11∣∣10⟩+∣11⟩⟨10∣∣10⟩=∣11⟩
where we use
⟨00∣10⟩⟨01∣10⟩⟨11∣10⟩⟨10∣10⟩=⟨0∣1⟩⟨0∣0⟩=0=⟨0∣1⟩⟨1∣0⟩=0=⟨1∣1⟩⟨1∣0⟩=0=⟨1∣1⟩⟨0∣0⟩=1
3.2.2. Controlled-Hadamard gate
The matrix representation of the controlled Hadamard gate is
CH=⎝⎜⎜⎛1000010000212100212−1⎠⎟⎟⎞
applied to the state ∣01⟩CH∣01⟩=⎝⎜⎜⎛1000010000212100212−1⎠⎟⎟⎞⎝⎜⎜⎛0100⎠⎟⎟⎞=⎝⎜⎜⎛0100⎠⎟⎟⎞=∣01⟩
The output is ∣01⟩. The CH gate does nothing, since the control qubit is set to 0 .
The control qubit is 1. Then the target qubit has been taken by Hadamard gate.
3.3. Decomposition and universal gate set
3.3.1. Decomposition of single qubit gate
Z-Y-Z decomposition
General Euler angle decompositions
Bloch rotation decomposition
Decomposition of Bloch rotation
Z-Y-Z decomposition
Any single qubit gate can be decomposed as a sequence of Z,Y, and Z rotations, and a phase
U=eiαRz(θ2)Ry(θ1)Rz(θ0)
General Euler angle decompositions
Any single qubit gate can be decomposed as a sequence of X,Y, and X rotations
U=Rx(θ2)Ry(θ1)Rx(θ0)
Bloch rotation decomposition
decompositions of single-qubit gates into single rotations about a particular axis
Rn(θ)=[cos(21θ)−inzsin(21θ)nysin(21θ)−inxsin(21θ)−nysin(21θ)−inxsin(21θ)cos(21θ)+inzsin(21θ)]
Decomposition of Bloch rotation
A rotation about an arbitrary axis in the Bloch sphere can be analytically decomposed into a sequence of five Rz and Ry gates
Rn(θ)=Rz(+α)Ry(+β)Rz(θ)Ry(−β)Rz(−α)
3.3.2. Decomposition of two-qubit gates
Kronecker decomposition
Canonical decomposition
CNot decomposition
ABC decomposition
3.3.3. universal gate set
For quantum computers, a gate set is called universal if the gates therein can be used to approximate any unitary transformation on any number of qubits to any desired precision.
A common universal gate set is the Clifford + T gate set, which is composed of the {CNOT,H,S} and T gates.
One universal gate set is {CNOT,H,T}.
Deutsch's gate, i.e. controlled-controlled-i iRx(aπ), is universal whenever a is irrational.
The Clifford set alone is not universal and can be efficiently simulated classically by the Gottesman–Knill theorem.
Gottesman-Knill theorem: A quantum circuit using only the following elements {CNOT,H,S} can be simulated efficiently on a classical computer