1
Quantum Computing
Lecture 4
Anuj Dawar
Models of Quantum Computation
2
Postulates of Quantum Mechanics
Postulate 1: A closed system is described by a unit vector in a
complex inner product space.
Postulate 2: The evolution of a closed system in a fixed time
interval is described by a unitary transform.
Postulate 3: If we measure the state |ψi of a system in an
orthonormal basis |0i · · · |n − 1i, we get the result |ji with
probability |hj|ψi|2 . After the measurement, the state of the
system is the result of the measurement.
Postulate 4: The state space of a composite system is the tensor
product of the state spaces of the components.
3
Quantum Circuits
A quantum circuit is a sequence of unitary operations and
measurements on an n-qubit state.
Input State U1 U2 U3
M
Note: each Ui is described by a 2n × 2n matrix.
4
Algorithms
A quantum algorithm specifies, for each n, a sequence
On = O1 . . . Ok
of n-qubit operations.
The map n → On must be computable.
i.e. the individual circuits must be generated from a
common pattern.
All measurements can be deferred to the end (possibly, at the
expense of increasing the number of qubits).
5
Model of Computation
As a model of computation, this is parasitic on classical models.
what is computable is not independently determined
Purely quantum models can be defined. We will see more on this in
Lecture 8.
What computations can be performed in the model as defined?
What functions can be computed?
What decision problems are decidable?
Can all such computations be performed with some fixed set of
unitary operations?
6
Simulating Boolean Gates
Could we find a quantum circuit to simulate a classical And gate?
a a∧b
And
b
This would require And : |00i 7→ |0xi, |01i 7→ |0yi
|10i 7→ |0zi, |11i 7→ |1wi
There is no unitary operation of this form.
Unitary operations are reversible. No information can be lost in the
process.
7
Computing a Function
If f : {0, 1}n → {0, 1}m is a Boolean function, the map
|xi 7→ |f (x)i
may not be unitary.
We will, instead seek to implement
|xi ⊗ |0i 7→ |xi ⊗ |f (x)i
Exercise: Describe a unitary operation that implements the
Boolean And in this sense.
8
One-Qubit Gates
We have already seen the Pauli Gates:
" # " # " #
0 1 0 −i 1 0
X= ,Y = ,Z =
1 0 i 0 0 −1
Another useful one-qubit gate is the Hadamard gate:
1 1 1
H=√
2 1 −1
H
9
Gates on a Multi-Qubit State
When we draw a circuit with a one-qubit gate, this must be read as
a unitary operation on the entire state.
U ⊗I
This does not change measurement outcomes on the second qubit.
10
Controlled Not
The Controlled Not is a 2-qubit gate:
|ai |ai The controlled not flips the sec-
ond qubit if the first qubit is |1i
|bi |a ⊕ bi and leaves it unchanged if it’s |0i
1 0 0 0
0 1 0 0
C=
0 0 0 1
0 0 1 0
11
Controlled U
More generally, we can define, for any single qubit operation U , the
Controlled U gate:
U |0xi 7→ |0xi
|1xi 7→ |1, U xi
Particularly useful is the controlled-Z gate:
Z
12
Toffoli Gate
|a1 i |a1 i The Toffoli Gate is a 3-qubit
gate.
|a2 i |a2 i It has a classical counterpart
which can be used to simulate
|bi |(a1 · a2 ) ⊕ bi standard Boolean operations
A permutation matrix is a unitary matrix where all entries are
0 or 1.
Any 2n × 2n permutation matrix can be implemented using only
Toffoli gates.
13
Classical Reversible Computation
A Boolean function f : {0, 1}n → {0, 1}n is reversible if it’s
described by a 2n × 2n permutation matrix.
For any function g : {0, 1}n → {0, 1}m , there is a reversible function
g ′ : {0, 1}m+n → {0, 1}m+n with
g ′ (x, 0) = (x, g(x)).
Toffoli gates are universal for reversible computation.
The Toffoli gate cannot be implemented using 2-bit reversible
classical gates.
14
Quantum Toffoli Gate
The Toffoli gate can be implemented using 2-qubit quantum gates.
Q† Q† P
H Q† Q Q† Q H
" # " #
1 0 1 0
where, P = ,Q = iπ/4
.
0 i 0 e
15
Universal Set of Gates
Fact: Any unitary operation on n qubits can be implemented by a
sequence of 2-qubit operations.
Fact: Any unitary operation can be implemented by a combination
of C-NOTs and single qubit operations.
Fact: Any unitary operation can be approximated to any required
degree of accuracy using only C-NOTs, H, P and Q.
These can serve as our finite set of gates for quantum computation.
16
Deutsch-Jozsa Problem
Given a function f : {0, 1} → {0, 1}, determine whether f is
constant or balanced.
Classically, this requires two calls to the function f .
But, if we are given the quantum black box:
|ai |ai
Uf
|bi |b ⊕ f (a)i
One use of the box suffices
17
replacemen Deutsch-Jozsa Algorithm
|0i H H
Uf
√1 (|0i − |1i)
2
Uf with input |xi and |0i − |1i is just a phase shift.
It changes phase by (−1)f (x) .
When |xi = H|0i, this gives (−1)f (0) |0i + (−1)f (1) |1i.
Final result is [(−1)f (0) + (−1)f (1) ]|0i + [(−1)f (0) − (−1)f (1) ]|1i
which is |0i if f is constant and |1i if f is balanced.