Lecture19 20 21
Lecture19 20 21
In this part, we start the next theme and perhaps the most exciting part of the course, quantum
computing. In this chapter, we begin by discussing the basics of classical computing and complexity
theory, and then we move on to the fundamentals of quantum computing and quantum complexity
theory.
1 Introduction
Computation A computation can be considered as a physical process that transforms an input
into an output. In classical computing, physical processes follow classical laws, while in quan-
tum computing, the physical processes follow laws of quantum mechanics. Compared to classical
computers, quantum computers can take advantage of exotic quantum phenomena such as super-
position and entanglement, making it possible to solve certain problems more efficiently than any
classical computer.
Input Output
Classical
Physical process
Quantum
Problems In a way similar to what we did in the chapter on communication complexity, given
a computation problem, we usually compare the best classical algorithm with the best quantum
algorithm to see which one is faster. Since classical algorithms have been developing for fifty years,
it is very difficult to beat the best classical algorithms. Yet, some quantum algorithms have been
proven to be faster than even the best classical algorithms. The field of quantum algorithms is
moving rapidly, and we are expecting more and more quantum algorithms with speedups to be
discovered in the future.
Complexity theory Complexity theory studies how difficult it is to use algorithms to solve certain
problems and classifies problems based on how the computational time required scales with the
size of inputs, e.g., the number of digits of the input numbers. Consider, for instance, the cases
where one only has a single input x, some natural number, and the output, f (x), is a function of
the input x. One example is factorization, i.e., the output gives a non-trivial factor if it exists and
zero otherwise. Another one is primality test, where f (x) = 1 if x is prime and f (x) = 0 otherwise.
The input size is the number of bits in x (i.e., the smallest integer larger than or equal to log2 x).
We can also have functions of two input numbers, x, y; for instance, multiplication. In that case,
one can take as the size the maximum number of digits of both numbers.
Binary
Pn form Any number x can be written in binary form, i.e. x = x1 , x2 , . . . , xn , where x =
k=1 xk 2 , n ∈ N is the number fulfilling n − 1 ≤ log2 x < n.
k−1
Asymptotic analysis and big O notation In complexity theory, we are interested in the best
algorithm and the asymptotic limit n 1. To compare the scaling of two functions in this
asymptotic limit, we use the following big O notation. Let us take the size of the input as an
integer number n ∈ N and consider two functions f, g : N → N. In the big O notation, we use
g(n) = O(f (n)) to mean that there exists M > 0, n0 ∈ N such that for n > n0 , the absolute value
of g(n) is at most a positive constant multiple of f (n), |g(n)| ≤ M |f (n)|.
1
Chapter 4.1 Quantum Information (WiSe 22/23)
Example 1.1. g(n) = n2 + n + 1 = O(n2 ). In this case we can take, for instance, M = 2 and
n0 = 2. Note that this implies that we can ignore terms like n + 1 that fulfill (n + 1)/n2 → 0 in
the limit n → ∞.
Example 1.2. g(n) = 4 log n + 1/n + 1/log n + 3 = O(log n).
Polynomial and exponential, superpolynomial and subexponential In the asymptotic limit, the
differences between polynomial and exponential functions are the most significant. That is why in
complexity theory practice, we typically do not distinguish if we have O(n), O(n2 ), or O(n3 ), as
long as they are all polynomials in n.
Slow and fast algorithms Algorithms to compute operations can be roughly classified in terms
of the relationship between the computational time, T , and the size of the input, n:
• Fast: The time scale as a polynomial of the size of the input, that is T (n) ≤ poly(n).
• Slow: The time cannot be bounded by a given polynomial of the size of the input, that is
T (n) > poly(n) for any given polynomial and certain N .
Later we will give a more precise classification.
Example 1.3. Multiplication of a number with n bit by the number 101 requires T (n) < kn (for
some k), and therefore is√fast. The factorization√ of a number x using an algorithm that checks if
it is a divisor of 1, 2, . . . , x requires about x = 2n/2 operations, and therefore it is slow.
2 Classical Computing
Computation A classical computation is that in which the physical process is based on classical
laws (without coherent quantum phenomena). In computer science, computation is abstracted as
computing Boolean functions, i.e., mappings between bitstrings
2
Chapter 4.1 Quantum Information (WiSe 22/23)
because any function g : {0, 1}n → {0, 1}m can be computed by computing a series of functions of
the form (2.2), f1 (x) = y1 , f2 (x) = y2 , · · · , fm (x) = ym , with each of them spiting out one bit of
the output y = y1 · · · ym . Therefore, it suffices to concentrate on functions of this form (2.2), the
so-called decision problems.
Bits Bits are (classical) systems with two different states 0 and 1. Any input and output number
can be encoded in these systems using binary notation. For example, if we have 5 bits, we can
represent the number 23 as 10111.
Gates The gates are the processes that transform bits. Any function can be decomposed into
basic gates that only act on a single bit or two bits. These gates are typically expressed in tables.
NOT: x
Input Output
0 1
1 0
• Two-bit gates f2 : {0, 1}2 7→ {0, 1}. Four common two-bit gates are AND, OR, NAND, and
NOR.
3
Chapter 4.1 Quantum Information (WiSe 22/23)
Universal gate set These are a finite set of gates such that a sequence of these gates can perform
any computation. The gate set {AND, OR, NOT } is a universal gate set. In fact, NAND ¬(x ∧ y)
or NOR ¬(x∨y) are by themselves already universal when combined with the copy gate x 7→ (x, x).
One can show that by using NAND to construct gates from a universal gate set, such as AND,
OR, and NOT.
Example 2.3. The following circuit implements NAND → AND.
= (2.3)
Circuits When we write a program on a computer, the program is transformed into a sequence
of gates called a circuit, and then this circuit is executed. An example is given in Fig. 2.
2.3 Complexity
Size of the circuit A fundamental measure of the difficulty of computation is the amount of time
(or space) it takes to carry out the computation. Here, we will measure the computation complexity
in terms of the number of (universal) gates it takes. That is, the size of the circuit {Cn } used
to solve the given decision problem. For a given input size, the computational complexity is the
number of such gates required to carry out the computation (as a function of the input size) in
the worst case, i.e., for the input x that requires more gates, and with the best algorithm. In fact,
as we mentioned, one is less ambitious and just asks whether the computational complexity scales
polynomially(feasible algorithm) or not.
Polynomial time We call a circuit is a polynomial-size circuit if the number of gates scale polyno-
mial with N , |Cn | = poly(n). Similarly, we call a circuit an exponential size circuit if the number of
gates scales exponentially with N , |Cn | = exp(n). A decision problem can be solved in polynomial
time if there exists a polynomial-size circuit {Cn } that solves the problem.
The complexity class P-polynomial time We say that a decision problem belongs to the com-
plexity class P if there exists an algorithm that solves the problem and which has polynomial time
complexity. We give one example and make a few remarks.
Example 2.4. Multiplication or modular exponentiation is in P (i.e., obtaining any digit). Divis-
ibility is in P.
4
Chapter 4.1 Quantum Information (WiSe 22/23)
The complexity class NP-nondeterministic polynomial time A decision problem is said to belong
to NP if the solution f (x) = 1 can be checked in polynomial time with the help of an appropriate
certificate (verifier y ∈ {0, 1}n ). That is, there exists a function g : {0, 1}n × {0, 1}n → {0, 1} in P
and that such that one can compute g(x, y) = f (x) = 1. Note that any problem in P is also in NP.
Example 2.5. Factorization is in NP. In particular, the decision problem of divisibility of x by a
number y > y0 . If it is, i.e. f (x) = 1, one can use as verifier y and check that indeed, x is divisible
by y in polynomial time. It is not in P because the best algorithm so far takes superpolynomial
time. The discrete logarithm is also in NPsince we can always verify by modular exponentiation,
which is in P.
P versus NP It is widely believed that P 6= NP, although it has not been proven.
The 3-SAT problem asks whether there exist a x such that f (x) = 1. Or, equivalently, is there a
bitstring that satisfies all the clauses simultaneously?
• A decision problem is a member of coNP if its complement (here, for f (x) = 0) is in the
complexity class NP.
EXP Decision problems that can be solved within an exponential amount of time.
PSPACE Decision problems that can be solved with a polynomial amount of memory (not time).
Inclusion between complexity classes It is generally believed (but not proven) that
BPP BPPstands for bounded error probabilistic polynomial time. These are decision problems
for which the solution can be found with probability p ≥ 2/3 in polynomial time. It is believed
that
P ⊆ BPP ⊆ PSPACE (2.6)
Example 2.7. The primality test is in BPP. In practice, it is enough to consider BPPalgorithms
since by repetition we can boost the probability of solving the decision problem. Although the pri-
mality test was also shown to be in P, the P algorithm is less practical than the BPP algorithm.
5
Chapter 4.1 Quantum Information (WiSe 22/23)
EXP
PSPACE
NP
BPP P
Black box
Oracles Proving separation between different complexity classes rigorously without any mathe-
matical assumptions is a daunting challenge. To make some statements, one can use a theoretical
tool called the oracle. ’Oracles’ are black boxes that compute certain functions immediately, and
we can query them.
We can define complexity classes relative to an oracle; for instance, Po is the set of decision
problems that can be computed in polynomial time by having extra access to the oracle o (and a
polynomial number of queries). The separation between complexity classes relative to oracles can
be proven. For example,
NP ⊆ P3−SAT , NP ⊆ PNP . (2.7)
3 Quantum computing
3.1 Basic concepts of quantum computing
A quantum computation can be considered as a physical process that transforms an input state
into an output state of a system. The physical process is based on coherent quantum phenomena,
such as Hamiltonian interactions.
Quantum process
Input and outputs In quantum computation, inputs and outputs are represented by states of the
system. For example, enumerating the state of a given basis as |1i, |2i, . . ., the number N would
be represented by the N –th state of this basis. Or, if we use binary notation, it can be encoded in
a state of the computational basis.
Restrictions The operation that transforms inputs into outputs has to be unitary. Since unitary
transformation conserve inner products hx|yi = hx|U † U |yi, unitary operators map orthogonal
6
Chapter 4.1 Quantum Information (WiSe 22/23)
|00i → |0i
|01i → |0i
(3.1)
|10i → |0i
|11i → |1i
could not be implemented because this operation does not conserve the scalar product (e.g.,
h00|01i = 0 but the corresponded mapped states are not orthogonal) and are thus not reversible.
Register Since AND operation can be easily implemented classical, one may infer that this re-
striction makes quantum computers less powerful than classical computers. However, there is a
simple way to circumvent this limitation. The idea is to use an auxiliary system so that the output
is written in that system while keeping the unitarity of the operation
|00i|0i → |00i|0i,
|01i|0i → |01i|0i,
(3.2)
|10i|0i → |10i|0i,
|11i|0i → |11i|1i.
In this way, the unitarity is kept because the orthogonal property is still preserved, U |x, 0i ⊥
U |y, 0i if |x, 0i ⊥ |y, 0i.
In general, if our algorithm consists of evaluating a given function f : N → N, we can design a
circuit that transform the input states according to the following table
Classical vs. quantum computing Using this transformation, we can, at least, do the same
computations with quantum computers as with classical computers. In fact, any efficient non-
reversible classical computation can be extended to an reversible one with only moderate effort.
Thus, there is no restriction in assuming that f is reversible. Since reversible functions can be
implemented using unitary operations, quantum computers are at least as powerful as classical
ones. All operations with fast algorithms in classical computation have fast algorithms in quantum
computation. However, there are operations for which only classical slow algorithms exist, but
there are fast quantum algorithms. The most important example is factorization.
Example 3.1. Multiplication can be efficiently realized on a quantum computer as |xi |yi |0i →
|xi |yi |x · yi.
Quantum parallelism Using the laws of Quantum Mechanics, one can do more than with the laws
of Classical Mechanics. In general, to compute a function f : N → N for the numbers 1, 2, . . . , N ,
classically one has to run the computation N times. In a quantum computer one can do the same
(3.3). However, with quantum computers we can do even more. We can prepare the input state
that is in a superposition.
N
1 X
|ψi = √ |ki|0i (3.4)
N k=1
and run the computer on this state. We obtain a superposition state
N
1 X
√ |ki|f (k)i (3.5)
N k=1
7
Chapter 4.1 Quantum Information (WiSe 22/23)
Idea of quantum computing The idea of quantum computing is to devise clever quantum al-
gorithms that utilize superposition and entanglement to obtain solutions more efficiently. Since
quantum computation is a probabilistic process, the output state will not be exactly the one |f (x)i
we wanted. Rather it will have some small errors |f (x)i + , but the algorithms should be designed
in a way such that the desired solution can be obtained with high probability.
Quantum circuit diagram A quantum circuit that transforms a input state |x1 i · · · |xn i = |x1 · · · xn i
to Uf |x1 · · · xn i, where Uf depends on the function we want to evaluate, is commonly represented
by the quantum circuit diagram like the following.
Uf
Qubits Qubits are (quantum) systems with two different states |0i and |1i. Any input and output
number can be encoded in these systems using binary notation. For example, if we have 5 qubits,
we can represent the number |23i as |10111i.
U ≈
There are many sets of universal gates, and of course, they are equivalent. The most convenient
set is the one that contains one two-qubit gate (an operation acting on two qubits only) and a set
of single-qubit gates. We will introduce some important single-qubit gates and two-qubit gates in
the following.
8
Chapter 4.1 Quantum Information (WiSe 22/23)
NOT gate For θ = π, ϕ = µ = π/2 and δ = 0 we have the quantum version of the NOT gate
. Similar to the classical NOT gate, the quantum NOT gate transforms
|0i =|1i
(3.8)
|1i =|0i
π
Hadamard gate For θ = π/2, µ = δ = ϕ = π/2 we have the Hadamard gate H = σx e−i 4 σy ,
depicted as H . The Hadamard gate realizes the transformation
1
|0i → √ (|0i + |1i) → (|0i + |1i) ,
2
(3.9)
1
|1i → √ (|0i − |1i) → (|0i − |1i) .
2
where we have dropped the normalization factor. From now on we will not include the normal-
ization whenever it is not necessary. Hadamard gate squares to identity, as one can easily verify
π π π π
H 2 = σx e−i 4 σy σx e−i 4 σy = e+i 4 σy e−i 4 σy = 1. (3.10)
Diagrammatically, we depict
H H = . (3.11)
Phase gate For µ = δ = ϕ/2 and θ = 0 we have the phase gate ϕ , a family of single-
qubit gates that map the basis states
|0i → |0i ,
iϕ
(3.12)
|1i → e |1i .
After the phase gate is applied, the probability of measuring a |0i or |1i is unchanged; however,
the relative phase of the quantum state is modified. Note that this corresponds to the unitary
operator: Uϕ = e−iϕ(σz −1)/2 .
Since global phases do not matter for a single qubit, equivalently we could also use θ = 0, µ = 0
and δ = ϕ/2
|0i → e−iϕ/2 |0i ,
(3.13)
|1i → eiϕ/2 |1i .
But this is not recommended since it can lead to some confusion when one has more than one
qubit.
Two particular cases of phase gates worth special attention. They are S gate and T gate.
π
ϕ = π/2 = S = e−i 4 (σz −1) , (3.14)
π
ϕ = π/4 = T = e−i 8 (σz −1) , (3.15)
9
Chapter 4.1 Quantum Information (WiSe 22/23)
General single-qubit unitaries In general, Hadamard and phase gates are enough to general
arbitrary single-qubit gates (see exercise)
Q = ϕ1 H ϕ2 H ϕ3 . (3.18)
Controlled-NOT gate CNOT gate UCNOT = |0i h0| ⊗ 1 + |1i h1| ⊗ σx changes the state of the
second qubit conditioned on the state of the first qubit. It is described by the following operation
on the basis |00i, |01i, |10i, |11i.
|0i |0i → |0i |0i ,
|0i |1i → |0i |1i ,
. (3.19)
|1i |0i → |1i |1i ,
|1i |1i → |1i |0i
The first qubit is therefore called control qubit, whereas the second one is called target. We depict
CNOT = . (3.20)
The controlled-NOT gate requires interaction between the qubits. This can be shown, for ex-
ample, by noticing that the input state (|0i + |1i) |0i is transformed into |00i + |11i, which is an
entangled state.
(|0i + |1i) |0i
|0i H
= |Φ+ i (3.21)
|0i
Controlled-Phase gate Controlled-Phase gate |0i h0| ⊗ 1 + |1i h1| ⊗ eiϕ(σz −1)/2
(3.22)
ϕ
adds a phase eiϕ to the second system depending on the state of the first system as
|0i |0i → |0i |0i ,
|0i |1i → |0i |1i ,
. (3.23)
|1i |0i → |1i |0i ,
|1i |1i → eiϕ |1i |1i
10
Chapter 4.1 Quantum Information (WiSe 22/23)
Example 3.3. A C-Phase gate can be decomposed as a product of CNOT gates and single qubit
phase gates,
ϕ/2
= . (3.24)
ϕ
ϕ/2 −ϕ/2
This identity can be easily verified by checking how do they transform two basis states |0i and |1i.
A special case (ϕ = π) is the Controlled-Z (CZ) gate, which can also be decomposed as
= . (3.25)
Z H H
Controlled-Unitary gates We can also consider controlled-Q gates, where Q is arbitrary single-
qubit gates
U = |0ih0| ⊗ 1 + |1ih1| ⊗ Q. (3.26)
Since Q is a normal matrix, we can diagonalize it as
0 1 0
iϕ
e 1
Q=V V =e V
† iϕ1
V† (3.27)
0 eiϕ2 0 ei(ϕ2 −ϕ1 )
using the spectral decomposition. As a result, the controlled-Q gate is decomposed as a product
of single-qubit gates and a controlled phase gate,
ϕ1
= . (3.28)
Q ϕ2 − ϕ1
V† V
SWAP gates The swap gate swaps the states of two qubits. It can be decomposed in terms of
CNOT gates as
= . (3.29)
In the exercise, you will show any permutation gate can be written as products of controlled NOT
and NOT gates. For example, (3.30) is implemented as
. (3.31)
General 2-qubit unitaries Now we are equipped to consider general 2-qubit unitary gates.
11
Chapter 4.1 Quantum Information (WiSe 22/23)
As expected, any 2-qubit unitary gates can be written as products of elementary gates.
The proof is as follows. Given a two-qubit unitary Q, we can always write its spectral decom-
position as a product X
Q= eiϕk |ψk i hψk | = Q4 Q3 Q2 Q1 (3.32)
k
where each Qk only adds a phase eiϕk to one eigenstate |ψk i but leaves other eigenstates |ψi i,
i 6= k, invariant
Qk : |ψk i → eiϕk |ψk i
(3.33)
|ψi i → |ψi i , i 6= k.
Using the resolution of identity 1 = k |ψk i hψk |, we can write
P
Now the task reduces to how to implement Qk . Now we show that such Qk can be easily con-
structed. We claim that Qk can be constructed using Vk and ϕk ,
Vk† Vk = Qk (3.35)
ϕk
where Vk satisfies
Vk : |ψk i → |11i
(3.36)
Vk† : |11i → |ψk i
and the action on the other states can be arbitrary (as long as Vk is unitary, since the other states
ψi will be mapped on states that are orthogonal to |11i). One can easily check that inputting |ψk i
to circuit on the left hand side of (3.35) gives eiϕk |ψk i, and inputting |ψi i, i 6= k, gives |ψi i.
Now the question remaining is how to implement Vk , which maps |ψk i → |11i, |ψk⊥ i → |11⊥ i.
This problem can be further simplified by using the Schmidt decomposition of |ψk i
With Schmidt decomposition, we only need to find a Rk : c0 |00i + c1 |11i → |11i, satisfying
U† U
Vk = Rk . (3.38)
V† V
This can be easily accomplished by using a permutation gate P and a single-qubit gate L
Rk = P (3.39)
L
where P implements
|0, 0i → |1, 0i
|1, 0i → |0, 0i
(3.40)
|0, 1i → |0, 1i
|1, 1i → |1, 1i
and L satisfies L(c0 |0i + c1 |1i) = |1i.
12
Chapter 4.1 Quantum Information (WiSe 22/23)
Q ≈ (3.41)
ϕ H
H ϕ
The idea of multi-qubit universality proof relies on a similar construction as the 2-qubit case we
have seen above. Here we will not show that but leave it as an exercise.
Universal gate set With a universal gate set, any n-qubit gate U can be realized exactly. It can
be shown that any unitary operation acting on a set of qubits can be written as a sequence of
controlled-NOT and single-qubit gates. Therefore, {H, ϕ, CNOT} is an universal gate set.
Approximate universal gate sets Any n−qubit gate U can be approximated to arbitrary precision
by gates from an approximate universal get set well. We name two such sets: (1) {H, T, CNOT}
and (2) {H, CS}, where CS is the controlled-S gate, i.e. a controlled phase gate with ϕ = π/2.
The complexity class BQP Since quantum processes are inherited probabilistic, we will consider
a quantum analog to the complexity class BPP. This is BQP, which stands for bounded error
quantum polynomial time. It denotes the class of decision problems which can be solved by a
quantum computer, with probability ≥ 2/3, in polynomial time.
Example 3.4. Factoring and discrete logarithm problems are in BQP.
BQP-hard and BQP-complete BQP-hard problems are those to which any problem in BQP can
be reduced to in polynomial time. BQP-complete problems are those BQP-hard problems which
are in BQP.
Remarks:
• If you show that one problem in BQP-hard is in BPP, then BQP=BPP, and it will collapse
all the advantages of quantum computers.
• It is not clear whether BPP = P or not. In fact, many problems in BPP have been de-
randomized.
• It is believed that BPP and BQP are different because, with quantum computers, we can use
superposition and entanglement. However, one can only show that with references to oracles.
• It is widely believed that NP-complete problems cannot be solved by quantum computers
efficiently.
13
Chapter 4.1 Quantum Information (WiSe 22/23)
QMA - Quantum Merlin Arthur The complexity QMA is the quantum analog of the class NP. In-
formally, it is the set of decision problems for which when the answer is YES, there is a polynomial-
size quantum proof (a quantum state) that convinces a polynomial-time quantum verifier of the
fact with high probability. Moreover, when the answer is NO, every polynomial-size quantum state
is rejected by the verifier with high probability.
Example 3.5 P(An example of QMA-hard problem: finding ground state energies). Given a Hamil-
tonian H = ij hij where each term hij at most acts on 2 qubits and khij kop ≤ 1, we ask whether
there exists an eigenvalue smaller than certain input energy E0 . This problem is QMA-hard.
Remark
• In computer science, the idea of Quantum Merlin Arthur goes much deeper to interactive
proof systems.
• QMA contains the probabilistic version of NP, NP ⊆ QMA.
• It is generally believed that
Oracles As in the classical case, one can define problems with quantum oracles, which implement
certain unitary operators. We just count the number of calls to the oracle, but not the computa-
tional cost of implementing the oracle itself. This leads to complexity classes relative to oracles,
for which it is possible to prove separations.
♣♣♣
Acknowledgement.— We thank Maximilian Lutz, Filip Novak, and Tommy Block for their proof-
reading.
These lecture notes were kindly provided by Ignacio Cirac and Sirui Lu.
14