0% found this document useful (0 votes)
24 views97 pages

Notes On Quantum Algorithm

These lecture notes provide an introduction to quantum algorithms in open quantum systems, based on various sources and intended for courses at the University of Trieste. The document includes acknowledgments for contributions and financial support, as well as a suggested bibliography for further reading. It covers topics such as circuit models, variational quantum algorithms, NISQ computation, and quantum error correction.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views97 pages

Notes On Quantum Algorithm

These lecture notes provide an introduction to quantum algorithms in open quantum systems, based on various sources and intended for courses at the University of Trieste. The document includes acknowledgments for contributions and financial support, as well as a suggested bibliography for further reading. It covers topics such as circuit models, variational quantum algorithms, NISQ computation, and quantum error correction.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 97

Matteo Carlesso

arXiv:2406.11613v1 [quant-ph] 17 Jun 2024

Lecture Notes on Quantum Algorithms in Open


Quantum Systems
Department of Physics, University of Trieste

Version 1.0 – June 2024


Preface

These lecture notes aim to provide a clear and comprehensive introduction to using open quantum system theory
for quantum algorithms. They are based on various sources, including research papers and textbooks, which can
be found in literature. While I have focused on clarity and consistency, there is always space for improvement.
I will work on expanding these notes and welcome your constructive feedback and comments. Feel free to send
them to [email protected].

In the Suggested Bibliography reported below, the reader can find the list of references I considered to prepare
these notes. Some of these are unpublished (please contact me directly for more info). I apologise in advance
to all the numerous authors whose contributions I did not cite. The field is vast and the intent of these notes is
not to serve as a comprehensive review article. I have certainly not done justice to the literature.

These notes will be used as a basis for some courses that I held at the Department of Physics of the University
of Trieste. Specifically, these are
• 357SM - Quantum Algorithms in Opens Quantum Systems (Spring 2024)
• 987DF - Quantum Computing Algorithms (Autumn 2024)

Acknowledgments

For the preparation of these lecture notes, I am in great debt with several people. Among these Angelo Bassi,
Francesco Cesa, Giulio Crognaletti, Giovanni di Bartolomeo, Sandro Donadi and Michele Vischi for inputs,
discussion and support.

I also acknowledge the financial support from the National Quantum Science and Technology Institute
through the PNRR MUR project PE0000023-NQSTI, the University of Trieste and the Italian National In-
stitute for Nuclear Physics (INFN).

©Matteo Carlesso1,2 , June 2024, Trieste


1
Department of Physics, University of Trieste, Strada Costiera 11, 34151 Trieste, Italy
2
Istituto Nazionale di Fisica Nucleare, Trieste Section, Via Valerio 2, 34127 Trieste, Italy

i
Suggested Bibliography

Open Quantum Systems

Although not explicitly discussed in these notes, a part of the above mentioned courses regards the theory of
open quantum systems. For this part of the courses, I suggest the following literature.
• Angelo Bassi. Lecture Notes on Advanced Quantum Mechanics. Unpublished.
• Heinz-Peter Breuer, Francesco Petruccione. The theory of open quantum systems. Oxford, 2022.
• Mahn-Soo Choi. A Quantum Computation Workbook. Springer, 2022.
• Roberto Floreanini. Lecture Notes on Quantum Information. Unpublished.
• Daniel A. Lidar. Lecture Notes on Theory of Open Quantum Systems. arXiv preprint arXiv:1902.00967.
• Ahsan Nazir. Lecture notes on open quantum systems. https://www.yumpu.com/en/document/view/8219582/
lecture-notes-on-open-quantum-systems-workspace.
• Stefano Olivares. Lecture Notes on Quantum Computing. University of Milano, 2020.

Quantum Computation

• Giuliano Benenti, Giulio Casati, Davide Rossini, and Giuliano Strini. Principles of quantum computation
and information: a comprehensive textbook. World Scientific, 2019.
• Mahn-Soo Choi. A Quantum Computation Workbook. Springer, 2022.
• Christoph Dittel. Lecture Notes on Quantum information theory. arXiv preprint arXiv:2311.12442.
• Ronald de Wolf. Lecture Notes on Quantum Computing. arXiv preprint arXiv:1907.09415.
• Aram W Harrow, Avinatan Hassidim, and Seth Lloyd. Quantum algorithm for linear systems of equations.
Physical Review Letters 103, 150502, (2009).
• Anton Frisk Kockum, Ariadna Soro, Laura Garcı́a-Álvarez, Pontus Vikstål, Tom Douce, Göran Johansson,
and Giulia Ferrini. Lecture Notes on Quantum Computing. arXiv preprint arXiv:2311.08445.
• Lin Lin. Lecture notes on quantum algorithms for scientific computation. arXiv preprint arXiv:2201.08309.
• M. A. Nielsen and I. L. Chuang Quantum Computation and Quantum Information. Cambridge University
Press 2010.
• Stefano Olivares. Lecture Notes on Quantum Computing. University of Milano, 2020.
• Oswaldo Zapata. A Short Introduction to Quantum Computing for Physicists. arXiv preprint arXiv:2306.09388.

ii
iii

Quantum Error Correction

• Giuliano Benenti, Giulio Casati, Davide Rossini, and Giuliano Strini. Principles of quantum computation
and information: a comprehensive textbook. World Scientific, 2019.
• Mahn-Soo Choi. A Quantum Computation Workbook. Springer, 2022.
• Andrew N. Cleland. An introduction to the surface code. SciPost Phys. Lect. Notes 49 (2022).
• Ronald de Wolf. Lecture Notes on Quantum Computing. arXiv preprint arXiv:1907.09415.
• Sandro Donadi. Lecture Notes on Quantum Algorithms in Open Quantum Systems. Unpublished.
• Ekert, A and Hosgood, T and Kay, A and Macchiavello, C. Introduction to Quantum Information Science.
https://qubit.guide.
• Austin G. Fowler, Matteo Mariantoni, John M. Martinis, and Andrew N. Cleland. Surface codes: Towards
practical large-scale quantum computation. Phys. Rev. A, 86:032324, 2012.
• Steven M. Girvin. Introduction to quantum error correction and fault tolerance. SciPost Phys. Lect. Notes
70 (2023).
• Stefano Olivares. Lecture Notes on Quantum Computing. University of Milano, 2020.
• Andrew M. Steane. A Tutorial on Quantum Error Correction. IOS Press 2006.
• Oswaldo Zapata. A Short Introduction to Quantum Computing for Physicists. arXiv preprint arXiv:2306.09388.

Dynamical Decoupling and Quantum Error Mitigation

• Zhenyu Cai, Ryan Babbush, Simon C. Benjamin, Suguru Endo, William J. Huggins, Ying Li, Jarrod R.
McClean, and Thomas E. O’Brien. Quantum error mitigation. Review Modern Physics 95,045005 (2023).
• Sandro Donadi. Lecture Notes on Quantum Algorithms in Open Quantum Systems. Unpublished.
• Tudor Giurgica-Tiron, Yousef Hindy, Ryan LaRose, Andrea Mari, and William J. Zeng. Digital zero noise
extrapolation for quantum error mitigation. In 2020 IEEE International Conference on Quantum Computing
and Engineering (QCE). IEEE, 2020.
Contents

1 Circuit model for quantum computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


1.1 Qubit gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Hadamard test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 No-cloning theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Dense coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Quantum teleportation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Quantum Phase estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5.1 Single-qubit quantum phase estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.5.2 Kitaev’s method for single-qubit quantum phase estimation . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.5.3 n-qubit quantum phase estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.6 Harrow-Hassidim-Lloyd algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2 Variational Quantum Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15


2.1 The Ising model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2 Mapping combinatorial optimisation problems into the Ising model . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3 Adiabatic Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4 Quantum Annealing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.5 Quantum Approximate Optimisation Algorithm (QAOA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.6 Variational Quantum Eigensolver (VQE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3 Noisy Intermediate-Scale Quantum (NISQ) computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24


3.1 Miscalibrated gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2 Projection noise and sampling error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3 Measurement error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.3.1 Environmental noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.3.2 Global noise action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

4 Quantum Error Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33


4.1 Quantum Error Correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.1.1 Classical error correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.1.2 Quantum information context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.1.3 The 3-qubit bit-flip code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.1.4 The 3-qubit phase-flip code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.1.5 The 9-qubit Shor code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.1.6 On the redundancy and threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.1.7 More layers of encoding or only more qubits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.2 Stabiliser formalism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.2.1 Inverting quantum channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

iv
Contents v

4.2.2 Correctable errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51


4.2.3 Stabilisers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.2.4 Normalisers and Centralisers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.2.5 Stabiliser code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.3 Surface code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.3.1 Detecting errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.4 Fault-tolerant computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.4.1 Stean code or 7-qubit code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

5 Dynamical Decoupling and Quantum Error Mitigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70


5.1 Dynamical Decoupling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5.2 Quantum Error Mitigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.2.1 Zero noise extrapolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
5.2.2 Probabilistic error cancellation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

A Solutions of the exercises ............................................................... 88


A.1 Solution to Exercise 1.1 ............................................................... 88
A.2 Solution to Exercise 1.2 ............................................................... 88
A.3 Solution to Exercise 1.3 ............................................................... 89
A.4 Solution to Exercise 1.4 ............................................................... 90
Chapter 1
Circuit model for quantum computation

In quantum computation, the basic ingredients are qubits and gates. The composition of different gates acting
on a series of qubits is what we called an algorithm. Here we introduce quantum gates and some algorithms.

1.1 Qubit gates

The single qubit algebra can be described in terms of the identity 1̂ and Pauli σ̂x , σ̂y and σ̂z operators. All
single qubit gates are a linear composition of these. In particular, they can be visualised as rotations of the state
|ψ⟩ on the Bloch sphere. The three elementary rotations by an angle θ around the Cartesian axes are defined
as R̂j (θ) = e−iθσ̂j /2 for j = x, y, z. In particular, in the computational basis, which is the one mainly used in
quantum computation, one has  
cos(θ/2) −i sin(θ/2)
Rx (θ) = ,
−i sin(θ/2) cos(θ/2)
 
cos(θ/2) − sin(θ/2)
Ry (θ) = , (1.1)
sin(θ/2) cos(θ/2)
 
exp(−iθ/2) 0
Rz (θ) = .
0 exp(iθ/2)
Then, the rotation of an angle θ around the unit axis n is given by

R̂n (θ) = e−iθn·σ̂/2 = cos(θ/2)1̂ − i sin (θ/2)n · σ̂. (1.2)

Beside the rotations, there are six important single-qubit gates that are standard. These are X, Y , Z and
     
1 1 1 10 1 0
H=√ , S= , T = . (1.3)
2 1 −1 0i 0 eiπ/4

In particular, X, Y and Z are respectively the Pauli operators σ̂x , σ̂y and σ̂z represented in the computational
basis, and H is known as the Hadamard gate.

Eventually, the state of the qubit is measured. In particular, this is always the measurement of σ̂z and one
always obtains one of the two discrete outcomes: “0” or “1”. Given the generic state |ψ⟩ = α |0⟩ + β |1⟩, with
α and β being complex and |α|2 + |β|2 = 1, then one has a probability p0 = |α|2 to have the outcome “0” and
p1 = |β|2 to have the outcome “1”.

1
2 1 Circuit model for quantum computation

Example 1.1
The gate X flips states. Indeed,       
α 01 α β
X = = . (1.4)
β 10 β α

Example 1.2
The Hadamard gate H generates uniform superpositions. In particular, one has
      
1 1 1 1 1 1 1
H = √ = √ ,
0 2 1 −1 0 2 1
       (1.5)
0 1 1 1 0 1 1
H = √ = √ .
1 2 1 −1 1 2 −1

Namely, one has


Ĥ |0⟩ = |+⟩ , and Ĥ |0⟩ = |−⟩ , (1.6)

where |±⟩ = (|0⟩ ± |1⟩)/ 2. Notably, the Hadamard gate maps the basis of σ̂z in that of σ̂x , and back.

Exercise 1.1
Express the Hadamard gate as a rotation.

Exercise 1.2
Prove that, given two fixed non-parallel normalised vectors n and m, any unitary single qubit gate Û can
be expressed as
Û = eiα R̂n (β)R̂m (γ)R̂n (δ), (1.7)
with α, β, γ, δ ∈ R.
It is common to represent quantum circuits with diagrams with the time running from left to right, where
lines correspond to qubits and boxes to gates. For example, the following diagram

|0⟩ H RZ (θ) (1.8)

corresponds to the following logical consecutive operations


0) Prepare the qubit in the ground state |0⟩.
1) Apply the Hadamard gate H.
2) Apply a rotation of an angle θ around the z axis.
3) Measure the state of the qubit.
When one is working with more than one qubit, there is the need to construct the representation of the states
the common computational basis. In the case of two qubits, the basis is given by { | 00⟩, | 01⟩, | 10⟩, | 11⟩ },
whose representation in the common computational basis is
       
1 0 0 0
0 1 0 0
|00⟩ ∼      
0 , |01⟩ ∼ 0 , |10⟩ ∼ 1 , |11⟩ ∼ 0 ,
  (1.9)
0 0 0 1

where the symbol ∼ indicates that the state |ψ⟩ was represented on the computational basis. This is constructed
through the tensor product, i.e.
1.1 Qubit gates 3
 
    ψ1 ϕ1
ψ1 ϕ1 ψ1 ϕ2 
|ψϕ⟩ ∼ ⊗ = 
ψ2 ϕ1  . (1.10)
ψ2 ϕ2
ψ2 ϕ2
Owning the computational representation, we can introduce some 2-qubit gates. One of the most useful
among these gates is the CNOT or control-NOT gate:
 
1000
0 1 0 0
CN OT =  
0 0 0 1 , (1.11)
0010

and is represented as

or equivalentely as (1.12)
X

It acts on a target qubit (qubit 1) in a way that depends on the state of a control qubit (qubit 0). Namely, it
applies an X gate to the qubit 1 if the state of qubit 0 is 1, otherwise it does not change the state:

CN OT |00⟩ = |00⟩ , CN OT |01⟩ = |01⟩ , CN OT |10⟩ = |11⟩ , CN OT |11⟩ = |10⟩ . (1.13)

Exercise 1.3
Prove that CNOT can generate entanglement.

A second important 2-qubit gate is the SWAP, which swaps the state between two qubits. Namely

SW AP |a⟩ ⊗ |b⟩ = |b⟩ ⊗ |a⟩ . (1.14)

A SWAP operation can be constructed using a concatenation of CNOT gates. In particular:

SW AP ∼ = = (1.15)

Similarly as the CNOT, one can construct a controlled unitary gate, where the state of the control qubit
determines if a unitary gate Û is applied to the target qubit:
 
10 0 0
0 1 0 0 
C(U ) ∼  
0 0 U00 U01  ∼ (1.16)
U
0 0 U10 U11

where Uij are the matrix elements of Û .


4 1 Circuit model for quantum computation

1.1.1 Hadamard test

The Hadamard test is a useful tool for computing expectation values of a unitary, black-box operator Û with
respect to a state |ψ⟩, which can be in principle a multi-qubit state. Since in general Û is not Hermitian, one
measures independently the real and immaginary part of ⟨ψ|Û |ψ⟩.
The circuit for the real Hadamard test is

|0⟩ H H
(1.17)
|ψ⟩ U

and it performs as follows. The first step is to generate a superposition in the first qubit (qubit 0):

Ĥ⊗1̂
|0⟩ |ψ⟩ −−−→ √1 (|0⟩ + |1⟩) |ψ⟩ . (1.18)
2

Then, we entangle the qubits with the C(U ) gate:


C(U )
√1 (|0⟩ + |1⟩) |ψ⟩ −−−→ √1 (|0⟩ |ψ⟩ + |1⟩ Û |ψ⟩), (1.19)
2 2

and apply the Hadamard gate to qubit 0:


h i h i
Ĥ⊗1̂ 1 1
−−−→ 2 (|0⟩ + |1⟩) |ψ⟩ + (|0⟩ − |1⟩)Û |ψ⟩ = 2 |0⟩ (1̂ + Û ) |ψ⟩ + |1⟩ (1̂ − Û ) |ψ⟩ . (1.20)

Finally, one measures qubit 0, and the probability of finding the qubit in |0⟩ is
    
P (|0⟩) = 41 ⟨ψ| 1̂ + Û † 1̂ + Û |ψ⟩ = 12 1 + ℜ ⟨ψ|Û |ψ⟩ . (1.21)

Thus, by measuring only one qubit (qubit 0) one has an indication of the real part of ⟨ψ|Û |ψ⟩. To estimate the
imaginary part, the circuit is modified as follows:

|0⟩ H S† H
(1.22)
|ψ⟩ U

Then, the state before the measurement is


h i
1
2 |0⟩ ( 1̂ − iÛ ) |ψ⟩ + |1⟩ (1̂ + iÛ ) |ψ⟩ , (1.23)

and correspondingly one has  


1
P̃ (|0⟩) = 2 1 + ℑ ⟨ψ|Û |ψ⟩ . (1.24)

Notably, to well characterise these probabilities, there is the need to run the protocol several times to construct
a statistics.

Exercise 1.4
Prove that the circuit in Eq. (1.22) provides the result in Eq. (1.24).
1.3 Dense coding 5

1.2 No-cloning theorem

For different computational reasons, one would like to create an independent and identical copy of an arbitrary
state with a unitary operation. Nevertheless, the following theorem prevents it.

Theorem 1.1 (No-cloning).


Consider two quantum systems A and B with corresponding Hilbert spaces of the same dimensions HA and
HB . Then, it is not possible to construct a unitary operation Û acting on HA ⊗ HB that copies an arbitrary state
of A over an initial, reference state of B. Namely, ∄Û such that

Û |ψ⟩ |e⟩ = |ψ⟩ |ψ⟩ , (1.25)

where |ψ⟩ is an arbitrary state and |e⟩ is a reference state.

Proof. A simple proof goes as follows. Suppose there exists Û such that described in Eq. (1.25). Then, one
considers the scalar product between the state |ψ, e⟩ = |ψ⟩ |e⟩ and |ϕ, e⟩ = |ϕ⟩ |e⟩, where |ϕ⟩ is a second arbitrary
state. This gives
⟨ϕ, e|ψ, e⟩ = ⟨ϕ|ψ⟩ ⟨e|e⟩ . (1.26)
Exploiting the unitarity of Û we have

⟨ϕ, e|ψ, e⟩ = ⟨ϕ, e|Û † Û |ψ, e⟩ (1.27)

Now, we apply Eq. (1.25) to both these states:


2
⟨ϕ, e|Û † Û |ψ, e⟩ = ⟨ϕ, ϕ|ψ, ψ⟩ = ⟨ϕ|ψ⟩ . (1.28)

By putting together the last three expressions we find


2
⟨ϕ|ψ⟩ ⟨e|e⟩ = ⟨ϕ|ψ⟩ , (1.29)

which holds true only if ⟨ϕ|ψ⟩ = 0 or |ϕ⟩ = eiα(ϕ,ψ) |ψ⟩ with α(ϕ, ψ) being a phase possibly depending on the two
input states. In both cases, one does not allow for full arbitrariness, thus proving the no-cloning theorem.

Importantly for the quantum computation field, the no-cloning theorem prevents the employment of classical
error correction techniques on quantum states. One needs to employ quantum error corrections, which will be
subject of Chapter 4, that effectively circumvent the no-cloning theorem.

1.3 Dense coding

An interesting quantum algorithm is that of dense coding. Suppose Alice has two classical bits x and y that
wants to communicate (securely) to Bob, and can do it only via a single qubit. The following protocol allows
for it. It assumes to have two qubits on which six operations are performed:

share send
|0⟩ H U H
(1.30)
|0⟩

The first operation is to prepare an initial entangled state


6 1 Circuit model for quantum computation

Ĥ⊗1̂ CN OT
|0⟩ |0⟩ −−−→ √1 (|0⟩ + |1⟩) |0⟩ −−−−→ √1 (|0⟩ |0⟩ + |1⟩ |1⟩) = |ψ+ ⟩ . (1.31)
2 2

The second operation is to share the state among Alice (qubit 0) and Bob (qubit 1). Then, the third operation
is the encoding: Alice encodes the state of (x, y) in the operation performed with the gate Û :

x, y Û
0, 0 1̂ ⊗ 1̂
0, 1 σ̂x ⊗ 1̂
1, 0 σ̂z ⊗ 1̂
1, 1 iσ̂y ⊗ 1̂

This leads to 
 √1 (|0⟩ |0⟩ + |1⟩ |1⟩) = |ψ+ ⟩ , if (x, y) = (0, 0),

 2

 √1 (|1⟩ |0⟩ + |0⟩ |1⟩) = |ϕ ⟩ ,
Û ⊗1̂ 2 + if (x, y) = (0, 1),
|ψ+ ⟩ −−−→ (1.32)

 √1
(|0⟩ |0⟩ − |1⟩ |1⟩) = |ψ− ⟩ , if (x, y) = (1, 0),

 2
 √1 (|0⟩ |1⟩ − |1⟩ |0⟩) = |ϕ− ⟩ , if (x, y) = (1, 1),
2

where |ψ± ⟩ and |ϕ± ⟩ are the four Bell states (fully entangled state, being a basis of the common Hilbert space).
The fourth operation consists in Alice sending the qubit 0 to Bob. Any operation performed on the two qubits
by Bob is now fully local. The fifth operation is the decoding. Bob applies the last two operations (CNOT and
Ĥ ⊗ 1̂) which together form the inverse operation of the encoding:

|ψ+ ⟩ → |0⟩ |0⟩ ,


|ϕ+ ⟩ → |0⟩ |1⟩ ,
(1.33)
|ψ− ⟩ → |1⟩ |0⟩ ,
|ϕ− ⟩ → |1⟩ |1⟩ .

The last operation is to Bob to measure the state of both qubits, which will identify which bits Alice encoded
in her qubit.

1.4 Quantum teleportation

An application of the dense coding protocol is the quantum teleportation, that allows for sending a generic state
|ψ⟩ = α |0⟩ + β |1⟩ from Alice to Bob without knowing a priory the state. The protocol is based on the use of
three qubits and six operations:

share classical communication


|ψ⟩ H

|0⟩ H (1.34)

|1⟩ U |ψ⟩

The first operation is to prepare an entangled state between qubit 1 and 2 (similarly as in the dense coding
protocol):

1̂⊗Ĥ⊗1̂ 1̂⊗CN OT
|ψ01⟩ −−−−−→ |ψ⟩ √12 (|0⟩ + |1⟩) |1⟩ −−−−−−→ |ψ⟩ √12 (|01⟩ + |10⟩) = |ψ⟩ |ϕ+ ⟩ . (1.35)
1.5 Quantum Phase estimation 7

Then, the second operation is to shared the qubits among Alice (qubit 0 and 1) and Bob (qubit 2). The third
operation consists in applying a decoding operation (see dense coding) to the first two qubits. Namely, the
decoding operation acts as in Eq. (1.33). Thus, owning that |ψ⟩ = α |0⟩ + β |1⟩, one obtains

CN OT ⊗1̂
|ψ⟩ |ϕ+ ⟩ −−−−−−→ √1 [α |0⟩ (|01⟩ + |10⟩) + β |1⟩ (|11⟩ + |00⟩)]
2
(1.36)
Ĥ⊗1̂⊗1̂ 1
−−−−−→ 2 [|00⟩ (α |1⟩ + β |0⟩) + |01⟩ (α |0⟩ + β |1⟩) + |10⟩ (α |1⟩ − β |0⟩) + |11⟩ (α |0⟩ − β |1⟩)] .

The fourth operation consists in Alice measuring her qubits. There are 4 possible couples, and thus four possible
collapses (according to the measurement postulate of quantum mechanics). These are |00⟩ , |01⟩ , |10⟩ and |11⟩
with probability 1/4 each. The fundamental point of the protocol is that the collapse of the state of the first 2
qubit implies that of the last qubit, being in Bob’s hands. In particular, if Alice measures the couple (0, 0), then
qubit 2 collapses in α |1⟩ + β |0⟩; and similarly for the other three measurement outcomes. The fifth operation
is the classical communication of the outcomes of the measurement to Bob. Consequently, the sixth operation
is a unitary operation Û on qubit 2 that depends on the outcomes (q0 and q1 ) of the measurement:

q0 q1 |q2 ⟩ Û
0 0 α |1⟩ + β |0⟩ σ̂x
0 1 α |0⟩ + β |1⟩ 1̂ (1.37)
1 0 α |1⟩ − β |0⟩ iσ̂y
1 1 α |0⟩ − β |1⟩ σ̂z

where |q2 ⟩ is the state on which qubit 2 has collapsed after the measurement. By applying the unitary we obtain

x σ̂
α |1⟩ + β |0⟩ −−→ |ψ⟩ ,

α |0⟩ + β |1⟩ −−→ |ψ⟩ ,
(1.38)
iσ̂y
α |1⟩ − β |0⟩ −−→ |ψ⟩ ,
z σ̂
α |0⟩ − β |1⟩ −−→ |ψ⟩ .

In such a way, Bob retrieves the state |ψ⟩ without that neither Bob or Alice had measure it.
We notice that there is a strong difference with the case studied in the no cloning theorem. Here, one needs to
measure two qubits to perform the protocol: this a fundamentally different procedure with respect to a unitary
operation.

1.5 Quantum Phase estimation

The framework of quantum phase estimation (QPE) is the following. Consider a unitary operation Û where the
state |ψ⟩ is one of its eigenstates. In particular, one has

Û |ψ⟩ = e2πiφ |ψ⟩ . (1.39)

Then, the task is to determine the phase φ with a certain given precision.
8 1 Circuit model for quantum computation

1.5.1 Single-qubit quantum phase estimation

The Hadamard test described in Sec. 1.1.1 can be used to implement a single qubit phase estimation. Indeed,
from Eq. (1.39) one gets that
⟨ψ|Û |ψ⟩ = e2πiφ . (1.40)
Then, by merging with Eq. (1.21) one has

P (|0⟩) = 12 (1 + cos(2πφ)), (1.41)

which implies
arccos (1 − 2P (|0⟩))
φ=± + 2πk, (1.42)

where k ∈ N. Notice that such a circuit cannot distinguish the sign of φ. Conversely, using both Eq. (1.21) and
Eq. (1.24), one has  
1 − 2P (|0⟩)
φ = arctan . (1.43)
1 − 2P̃ (|0⟩)
Now, for the sake of simplicity, let us restrict to the case of φ ∈ [0, 1[. Suppose we would like to estimate
the value of φ with a single run of the circuit in Eq. (1.17). Then, if the outcome is +1 (i.e., the state collapses
on |0⟩), we have P (|0⟩) = 1. Conversely, with the outcome being −1 we have P (|0⟩) = 0. Then, by employing
Eq. (1.42) we obtain
outcome P (|0⟩) φ̄ φv
+1 1 0 [0, 1/2[ (1.44)
−1 0 1/2 [1/2, 1[
where φ̄ gives the best estimation for the real value of the phase φv . Since there are no other possible outcomes
with a single run, the phase is estimated with an error ϵ = 1/2, namely φv ∈ [φ̄, φ̄ + ϵ[. This is a really low
accuracy for a deterministic algorithm. To improve this accuracy, one should run the algorithm several times
(namely, a number of times that scales as O(1/ϵ2 ), where ϵ is the target error bound), or consider alternative
methods, as the N-qubit quantum phase estimation described below.

1.5.2 Kitaev’s method for single-qubit quantum phase estimation

In the fixed point representation, a natural number k can be represented with a real number φ ∈ [0, 1[ by
employing d bits, i.e.
φ = (.φd−1 . . . φ0 ), (1.45)
where φk ∈ {0, 1}, as far as k ≤ 2d − 1.

Example 1.3
To make an explicit example of the fixed point representation, the value of k = 41 corresponds to the d = 6
bit’s string [101001] and can be represented with φ = 0.640625 being equivalent to (.101001). Indeed, by
employing the following expression with the string φ = (.φd−1 . . . φ0 ) = (.101001) one has
d−1
X
φi 2i−d = φ5 2−1 + φ4 2−2 + φ3 2−3 + φ2 2−4 + φ1 2−5 + φ0 2−6 = 2−1 + 2−3 + 2−6 = 0.640625. (1.46)
i=0

Such a value, when multiplied by 26 gives exactly 41.

In the simplest scenario of d = 1, one has φ = (.φ0 ) with φ0 ∈ {0, 1}. Thus, when performing once the real
Hadamard test, one has P (|0⟩) = 1 if φ0 = 0 (i.e., φ̄ = 0), and P (|0⟩) = 0 if φ0 = 1 (i.e., φ̄ = 1/2).
1.5 Quantum Phase estimation 9

Next, we consider the case of d bits, where φ = (.0 . . . 0φ0 ). Here, the first d bits are 0 and the last one is φ0 .
To determined the value of φ0 one needs to reach a precision of ϵ < 2−d . This would require O(1/ϵ2 ) = O(22d )
repeated applications of the single-qubit quantum phase estimation, or number of queries to Û . The observation
from Kitaev’s method is that if we can have access to Û j for a suitable power j, then the number of queries to
Û can be reduced. If one substitutes Û j to Û , with the corresponding circuit being

|0⟩ H H
(1.47)
|ψ⟩ U j

then the probability changes in


P (|0⟩) = 12 (1 + cos(2πjφ)). (1.48)
Importantly, every time one multiplies a number by a factor 2, the bits in the fixed point representation are
shifted to the left. To make an example,
2 × (.00φ0 ) = (.0φ0 ). (1.49)
Then, one has that 2d−1 φ = 2d−1 (.0 . . . 0φ0 ) = (.φ0 ). Thus, applying the circuit in Eq. (1.47) with j = d − 1 to
estimate (.0 . . . 0φ0 ) is equivalent to apply the circuit in Eq. (1.17) to estimate (.φ0 ).
This idea can be extended to general phases with d bits, i.e. φ = (.φd−1 . . . φ0 ). Indeed, one has

Û e2πiφ |ψ⟩ = Û e2πi(.φd−1 ...φ0 ) |ψ⟩ = e2πi(φd−1 .φd−2 ...φ0 ) |ψ⟩ = e2πiφd−1 e2πi(.φd−2 ...φ0 ) |ψ⟩ , (1.50)

but e2πiφd−1 = 1 independently from the value of φd−1 . Thus

Û e2πiφ |ψ⟩ = e2πi(.φd−2 ...φ0 ) |ψ⟩ , (1.51)

i.e. the application of Û shifts the bits and allows the evaluation of the first bit after the decimal point.

1.5.3 n-qubit quantum phase estimation

Notably, both the previous algorithms necessitate an important classical post-processing. Employing n ancillary
qubits allow the reduction of such post-processing. This is based on the application of the Inverse Quantum
Fourier Transform F̂ † .

Recall 1.1 (Quantum Fourier transform)


The discrete Fourier transform of a N -component vector with complex components { f (0), . . . , f (N − 1) }
is a new complex vector { f˜(0), . . . , f˜(N − 1) }, defined as
N
X −1
F (f (j), k) = f˜(k) = √1
N
e2πijk/N f (j). (1.52)
j=0

The Quantum Fourier transform (QFT) acts similarly: it acts as the unitary operator F̂ on a quantum
register of n qubits, where N = 2n , in the computational basis as
n
2X −1
n
F̂ |j⟩ = √1
2n
e2πijk/2 |k⟩ , (1.53)
k=0
10 1 Circuit model for quantum computation

where |j⟩ = |jn−1 . . . j0 ⟩ and |k⟩ = |kn−1 . . . k0 ⟩. Namely, the application of the quantum Fourier transform
F̂ to the state |j⟩ = |jn−1 . . . j0 ⟩ gives
    
F̂ |j⟩ = √12n |0⟩ + e2πi(0.j0 ) |1⟩ |0⟩ + e2πi(0.j1 j0 ) |1⟩ . . . |0⟩ + e2πi(0.jn−1 ...j0 ) |1⟩ . (1.54)
P
In the case of a superposition |ψ⟩ = j f (j) |j⟩, one has
n
2X −1
|ψ̃⟩ = F̂ |ψ⟩ = f˜(k) |k⟩ , (1.55)
k=0

where the coefficients f˜(k) are the discrete Fourier transform of the coeficients f (j).
The inverse quantum Fourier transform F̂ † acts as
n
2X −1
n

F̂ |j⟩ = √1
2n
e−2πijk/2 |k⟩ , (1.56)
j=0

in a completely similar way as Eq. (1.53) but with negative phases.

Example 1.4
The application of the quantum Fourier transform F̂ to the state |j⟩ = |10⟩ = |j1 = 1, j0 = 0⟩ gives
  
F̂ |j⟩ = 1
2 |0⟩ + e2πi(0.j0 ) |1⟩ |0⟩ + e2πi(0.j1 j0 ) |1⟩ ,
(1.57)
= √1 (|0⟩ + |1⟩) √12 (|0⟩ − |1⟩).
2

The algorithm implementing the (standard) quantum phase estimation uses a first register of n ancillary
qubits and a second register of which we want to compute the phase. The first register is initially prepared in
the |0⟩ state for all the qubits. The circuit implementing the algorithm is the following

end first step

|0⟩ H ...

..
.
First register, ...
|0⟩ H F†
n qubits
(1.58)
|0⟩ H ...

|0⟩ H ...

Second register, ...


|ψ⟩ U2
0
U2
1
U2
2
U2
n−1
|ψ⟩
t qubits

In particular, the state of the first register after the end of the first part of the algorithm (see red dashed line)
reads    
√1 2πi(2n−1 φ) 2πi(20 φ)
2n
|0⟩ + e |1⟩ . . . |0⟩ + e |1⟩ . (1.59)

Now, by considering the binary representation of φ = (φn−1 . . . φ0 ), the latter expression becomes
1.6 Harrow-Hassidim-Lloyd algorithm 11
    
√1
2n
|0⟩ + e2πi(0.φ0 ) |1⟩ |0⟩ + e2πi(0.φ1 φ0 ) |1⟩ . . . |0⟩ + e2πi(0.φn−1 ...φ0 ) |1⟩ , (1.60)

which is exactly equal to F̂ |j⟩ in Eq. (1.54) for |j⟩ = |φ⟩. Thus, applying the inverse Fourier transform F̂ † one
gets |φ⟩, which is then measured.

1.6 Harrow-Hassidim-Lloyd algorithm

The Harrow-Hassidim-Lloyd (HHL) algorithm allows for the resolution of linear system problems on a quantum
computer. To be precise, the problem to be solved is described as finding the Nb complex entries of x that solve
the following problem
Ax = b, (1.61)
where A is an hermitian and non-singular Nb × Nb matrix and b is a Nb vector, both defined on C. Classically,
the solution is given by
x = A−1 b. (1.62)
The question is then how one can implement this on a quantum computer.
First, let us assume that the entries of b are such that ||b|| = 1. Then, b can be stored in a nb -qubit state
|b⟩, through the following mapping:
 
b0
 
b =  ...  ↔ b0 |0⟩ + · · · + bNb −1 |Nb − 1⟩ = |b⟩ , (1.63)
bNb −1

where Nb = 2nb . For example, this can be done via a unitary operation Ûb . Now, we define |x⟩ = Â−1 |b⟩,
where  in the computational representation gives the classical matrix A. Notably, the state |x⟩ needs to be
normalised to be stored in a quantum register. Thus, one has

Â−1 |b⟩
|x⟩ = , (1.64)
||Â−1 |b⟩ ||

where the normalisation problem can be tackled in a second moment.


Consider the spectral decomposition of Â:

 |vj ⟩ = λj |vj ⟩ , (1.65)

where λj and |vj ⟩ are respectively the eigeinvalues and eigeinstates of Â. We also assume that the ordering of
the eigeinvalues is such that
0 < λ0 ≤ · · · ≤ λNb −1 < 1. (1.66)
In general this will not be the case, but one can remap the problem in order to fall within this case. We also
assume that all the Nb eigeinvalues have an exact d-bit representation.
By applying what in Sec. 1.5, we can query  via an unitary operation Û = e2πi using QPE. For example,
suppose |b⟩ = |vj ⟩, then we have
⊗d
ÛQPE |0⟩ |vj ⟩ = |λj ⟩ |vj ⟩ . (1.67)
In particular, the (not-normalised) solution of the linear system problem would be

Â−1 |b⟩ = Â−1 |vj ⟩ = 1


λj |vj ⟩ . (1.68)

More generally, one can decompose the state |b⟩ on the basis of Â, i.e.
12 1 Circuit model for quantum computation

2n
Xb −1

|b⟩ = βj |vj ⟩ , (1.69)


j=0

where βj are a linear combination of bj . Then the QPE procedure gives


⊗d
X
ÛQPE |0⟩ |b⟩ = βj |λj ⟩ |vj ⟩ , (1.70)
j

and the solution of the problem is given by


2n
X b −1
−1 βj
 |b⟩ = |vj ⟩ . (1.71)
j=0
λj

The aim of the HHL algorithm is to generate the normalised version of the state in Eq. (1.71) from the general
state |b⟩ as shown in Eq. (1.69).
The algorithm works with three registers. The first one is an ancillary register made of a single qubit, the
second is also an ancillary register but made of d qubits, the third register is made of nb qubits and will encode
the solution of the problem. The HHL circuit is the following

|Ψ1 ⟩ |Ψ4 ⟩ |Ψ5 ⟩ |Ψ6 ⟩ |Ψ9 ⟩

|0⟩ R

⊗d d ⊗d
|0⟩ |0⟩ (1.72)
UQPE −1
UQPE
⊗nb nb
|0⟩ Ûb |x⟩

The algorithm works as the following. Initially, all the qubits are prepared in |0⟩:
⊗d ⊗nb
|Ψ0 ⟩ = |0⟩ |0⟩ |0⟩ , (1.73)

then the information about b is encoded in the last register:


⊗d
|Ψ1 ⟩ = 1̂ ⊗ 1̂⊗d ⊗ Ûb |Ψ0 ⟩ = |0⟩ |0⟩ |b⟩ . (1.74)

We apply the QPE procedure, which is here broke down in the corresponding three steps. The first is the
application of the Hadamard gate:

|Ψ2 ⟩ = 1̂ ⊗ Ĥ ⊗d ⊗ 1̂ |Ψ1 ⟩ = |0⟩ 2d/2


1
(|0⟩ + |1⟩)⊗d |b⟩ . (1.75)

This is followed by the controlled unitary Û j :


d
2X −1
j
|Ψ3 ⟩ = 1̂ ⊗ C(U ) |Ψ2 ⟩ = |0⟩ 2d/2 1
e2πikφ |k⟩ |b⟩ , (1.76)
k=0

where Û |b⟩ = e2πiφ |b⟩ with φ ∈ [0, 1[. Finally, we apply the inverse Fourier transform to the second register
1.6 Harrow-Hassidim-Lloyd algorithm 13

|Ψ4 ⟩ = 1̂ ⊗ F̂ † ⊗ 1̂⊗nb |Ψ3 ⟩ ,


d
2X −1
= |0⟩ 2d/2 1
e2πikφ F̂ † |k⟩ |b⟩ ,
k=0 (1.77)
d d
−1
2X −1
2X
d
= |0⟩ 21d e2πikφ e−2πiyk/2 |y⟩ |b⟩ .
k=0 y=0

However, one has that


d
−1
(P
2X 2d −1 0
2πik(φ−y/2 ) d
k=0 e = 2d , if φ = y/2d ,
e = (1.78)
k=0
0, ̸ y/2d ,
if φ =

meaning that the k sum selects the value of y = φ2d . Thus,

|Ψ4 ⟩ = |0⟩ |φ2d ⟩ |b⟩ . (1.79)

In general, |b⟩ is in a superposition of |vj ⟩, then

Û |vj ⟩ = e2πi |vj ⟩ = e2πiλj |vj ⟩ . (1.80)

Then, the entire QPE gate maps


2n
Xb −1 2n
X b −1
⊗d UQPE
|Ψ1 ⟩ = |0⟩ |0⟩ βj |vj ⟩ −−−→ |Ψ4 ⟩ = |0⟩ βj |λj 2d ⟩ |vj ⟩ . (1.81)
j=0 j=0

We apply a controlled rotation on the first register, such that


2n
X b −1 r 
⊗nb C2
|Ψ5 ⟩ = C(R) ⊗ 1̂ |Ψ4 ⟩ = βj 1− λ2j
|0⟩ + C
λj |1⟩ |λj 2d ⟩ |vj ⟩ , (1.82)
j=0

where C ∈ R is an arbitrary constant. At this point we perform the measurement of the first register. If the
outcome is +1 and the state collapses in |0⟩ then we discard the run; if the outcome is −1 with the state
collapsed in |1⟩ then we retain the run. To increase the probabilities of having the outcome −1, we make C as
large as possible. After the collapse of the first register in |1⟩, the state of the second and third register is
2n
X b −1
1 βj
|Ψ6 ⟩ =  1/2 |λj 2d ⟩ |vj ⟩ , (1.83)
P 2nb −1
λj
j=0 |βj /λj |2 j=0

where we exploited that C ∈ R. Now, we apply the inverse QPE, which has also three steps. The first is the
application of the QFT:

|Ψ7 ⟩ = F̂ ⊗ 1̂⊗nb |Ψ6 ⟩ ,


2n
Xb −1
1 βj
= 1/2 λj F̂ |λj 2d ⟩ |vj ⟩ ,
P2nb −1
j=0 |βj /λj |2 j=0
(1.84)
2n
Xb −1 d
2X −1
1 βj 1 d
)/2d
= 1/2 e2πiy(λj 2 |y⟩ |vj ⟩ .
P2nb −1 λj 2d/2
j=0 |βj /λj |2 j=0 y=0

Then, we apply the controlled unitary C(U −j ), which gives


14 1 Circuit model for quantum computation

|Ψ8 ⟩ = C(U −j ) |Ψ7 ⟩ ,


2n
Xb −1 d
2X −1
1 βj 1 (1.85)
= 1/2 e2πiyλj |y⟩ e−2πiλj y |vj ⟩ ,
P2nb −1 λj 2d/2
j=0 |βj /λj |2 j=0 y=0

where the two phases cancel and thus


d
2X −1 2n
X b −1
1 βj 1
|Ψ8 ⟩ = 2d/2
|y⟩ λj P 1/2 |vj ⟩ . (1.86)
2nb −1
y=0 j=0
j=0 |βj /λj |2

Finally, the application of Hadamard’s gates on the second register gives


2n
X b −1
⊗d ⊗nb ⊗d βj 1
|Ψ9 ⟩ = Ĥ ⊗ 1̂ |Ψ8 ⟩ = |0⟩ λj P 1/2 |vj ⟩ , (1.87)
2nb −1
j=0
j=0 |βj /λj |2

where the third register is exactly in the form in Eq. (1.71) after the proper normalisation. Thus,
⊗d
|Ψ9 ⟩ = |0⟩ |x⟩ , (1.88)

embeds the solution of the linear system Ax = b.


Chapter 2
Variational Quantum Algorithms

This class of algorithms employs a quantum and a classical computer to solve some optimisation problems.
The quantum computer performs the quantum evolution of a state with respect to an Hamiltonian that is
transformed, say from Ĥ0 to Ĥ1 . The classical computer determines how such a transformation should take
place employing the variational principle. Typically, the problem is to map the state from the ground state of
Ĥ0 to that of Ĥ1 , whose ground state is unknown. Thus, one wants to have a well-known Ĥ0 . This is often
taken as that of the Ising model.

2.1 The Ising model

In a combinatorial optimisation problem, one has a string of n bits and wants to optimise a particular problem.
n
The problem is mapped in a minimisation (or maximisation) of a cost function C : { 0, 1 } → R. Notably, the
maximisation problem can be obtained from the minimisation one buy a minus sign: C → −C.
To solve a combinatorial optimisation problem via a quantum algorithm, one needs to encode the problem
onto a quantum system. In the following, we show how the Ising Hamiltonian can be used to embed such an
optimisation problem.
The Ising model was developed to study the phase transition in magnetic materials. It consists in n spins
that can be coupled via long-range interactions. The corresponding Hamiltonian is
n
X X
ĤC = − hi σ̂z(i) − Jij σ̂z(i) σ̂z(j) , (2.1)
i=1 1≤i<j≤n

where hi are the single spin magnetic fields describing the single spin evolution and Jij the spin-spin couplings.
The choice of the latter encodes if the spins are encouraged to be aligned (ferromegnetic phase) or anti-aligned
(antiferromagnetic phase). Since only σ̂z are appearing in ĤC , then its spectral decomposition can be expressed
in the computational basis:
n
2X −1
ĤC = C(z) |z⟩ ⟨z| , (2.2)
z=0

where C(z) is the energy of the specific spin configuration |z⟩. Then, by properly mapping a combinatorial
problem in the choice of { hi } and { Jij }, one can find the optimal solution by minimizing the energy, i.e. by
finding the configuration |z⟩ that corresponds to minimal energy (or cost) C(z).

15
16 2 Variational Quantum Algorithms

2.2 Mapping combinatorial optimisation problems into the Ising model

Many problems can be mapped in the form in Eq. (2.1), and hence solve with a quantum computer, by choosing
the appropriate values of { hi } and { Jij }. Here we consider some explicit examples.

Subset sum problem. Given an integer number m (total value) and a set of N positive and negative integers
n = { n1 , . . . , nN }, which is the subset of the latter integers whose sum gives m?

Example 2.1
Consider the case of m = 7 and n = { −5, −3, 1, 4, 9 }. The subset { −3, 1, 9 } solves the problem: −3+1+9 =
7 = m.

Exercise 2.1
Consider the case of m = 13 and n = { −3, 2, 8, 4, 20 }. Show that the corresponding subset sum problem
has no solution.

PNThe subset sum problem can be framed as an energy minimisation problem as follows. Consider the sum
i=1 ni zi − m, where ni are the elements of n and zi ∈ { 0, 1 } are weights that select or not the corresponding
element ni in the sum (effectively, this is the way to select a specific subsection). We define E(z) as the square
of such a sum: !2
N
X
E(z) = E(z1 , . . . , zN ) = ni zi − m . (2.3)
i=1

Then, if there is a subset solving the problem, one has that exists a value of z = { z1 , . . . , zN } such that E(z) = 0.
Conversely, if all the possible values of z give E(z) ̸= 0, then there is no subset that can solve the subset sum
problem. One can already see that the z corresponding to the solution of the problem is the one minimising
E(z). We now show the connection with the Ising model. We introduce the classical spins si = ±1, which will
be employed in place of the weights zi . Namely, one uses

zi = 21 (1 − si ), (2.4)

so that si = +1 (spin up) corresponds to zi = 0 and si = −1 (spin down) to zi = 1. We define the corresponding
classical Hamiltonian
N
!2
X
1
H(s1 , . . . , sN ) = ni 2 (1 − si ) − m ,
i=1
  !2 (2.5)
N
X N
X N
X N
X
= 1
ni nj si sj − 1 nj − m ni si + 1
ni − m ,
4 2 2
i,j=1 i=1 j=1 i=1

where the last term is independent from si and thus is a negligible constant of the problem. After having defined
 
XN
ni nj
Jij = − , and hi =  21 nj − m  ni , (2.6)
4 j=1

the Hamiltonian becomes


X n
X
H(s1 , . . . , sN ) = − Jij si sj − hi si + const, (2.7)
1≤i<j≤n i=1

where
2.3 Adiabatic Theorem 17

N
!2 N
X X
const = 1
2 ni − m − Jii s2i , (2.8)
i=1 i=1

is si independent since s2i = 1 for any value of i. To solve the problem on a quantum computer, one quantises
(i)
the Hamiltonian in Eq. (2.7) by substituting si → σ̂z and gets Eq. (2.1).

Number partitioning problem. Another combinatory problem that can be mapped in an Ising Hamiltonian
is the number partitioning problem. It asks if a set of N integers { n1 , . . . , nN } can be partitioned in two subsets
such that the sum of the elements in the individual subsets is equal.

Example 2.2
Consider the set n = { 1, 2, 3, 4, 6, 10 }. In such a case, one can consider the case of { 1, 2, 4, 6 } and { 3, 10 },
whose individual sums are both equal to 13.

The classical Hamiltonian for this problem can be straightforwardly constructed as

N
!2
X
H(s1 , . . . , sN ) = ni si , (2.9)
i=1

with si = ±1. Clearly, the solution s = { s1 , . . . , sN } is such that H(s) = 0. Expanding the square, we find
X
H(s) = − Jij si sj − Tr [Jij ] , (2.10)
1≤i<j≤N

where
N
X
ni nj
Jij = − , and Tr [Jij ] = Jii s2i . (2.11)
2 i=1

The classical Hamiltonian in Eq. (2.10) can be quantised and one obtains that in Eq. (2.1) with no need to
introduce the magnetic fields, i.e. hi = 0.

2.3 Adiabatic Theorem

Adiabatic quantum computation is based on the adiabatic theorem. The latter considers the case of a time
dependent Hamiltonian, that changes from Ĥ0 at time t = 0 to Ĥ1 at time t = τ . We also assume that the
two Hamiltonians do not commute, i.e.[Ĥ0 , Ĥ1 ] ̸= 0. The theorem states that a system prepared in the n-th
eigeinstate of Ĥ0 goes in the n-th eigeinstate of Ĥ1 if the transformation is made slowly enough, i.e. adiabatically.
The application to quantum computation then is to take an initial Hamiltonian with a ground state that can be
easily prepared and then adiabatically change the Hamiltonian to that of the problem one wants to optimise. If
the system is initially in the ground state of Ĥ0 , then will remain in the ground state of the target Hamiltonian
Ĥ1 and it will encode the solution of the optimisation problem.
The proof of the adiabatic theorem is the following. Consider the instantaneous spectralisation of a time-
dependent Hamiltonian Ĥ(t), which is

Ĥ(t) |n(t)⟩ = En (t) |n(t)⟩ , (2.12)

where En (t) and |n(t)⟩ are respectively the corresponding instantaneous eigeinvalues and eigeinstates. Given a
state |ψ(t)⟩ at time t, one can always express it as a superposition of the instantaneous eigeinstates as
X
|ψ(t)⟩ = cn (t) |n(t)⟩ , (2.13)
n
18 2 Variational Quantum Algorithms

where
cn (t) = ⟨n(t)|ψ(t)⟩ , (2.14)
determine the probabilities Pn (t) = |cn (t)|2 of being in |n(t)⟩ at time t. The evolution of cn (t) can be determined
via
ċn (t) = ⟨ṅ(t)|ψ(t)⟩ + ⟨n(t)|ψ̇(t)⟩ ,
i (2.15)
= ⟨ṅ(t)|ψ(t)⟩ − ℏ ⟨n(t)|Ĥ(t)|ψ(t)⟩ ,
i
= ⟨ṅ(t)|ψ(t)⟩ − ℏ En (t) ⟨n(t)|ψ(t)⟩ ,
d
where we defined |ṅ(t)⟩ = dt |n(t)⟩, and we applied the Schrödinger equation and applied the Hamiltonian to
its eigeinstate. Then, the imposing Eq. (2.13), we get
X
ċn (t) = cm (t) ⟨ṅ(t)|m(t)⟩ − ℏi En (t)cn (t), (2.16)
m

which determines a system of coupled differential equations. In complete generality, the evolution of cn (t)
depends on cm (t) for all values of m. To determine the first term of Eq. (2.16), we consider the time derivative
of Eq. (2.12) with |n(t)⟩ subsituted with |m(t)⟩ and projecting it on ⟨n(t)|. This gives
d
⟨n(t)| dt Ĥ(t)|m(t)⟩ + ⟨n(t)|Ĥ|ṁ(t)⟩ = Ėm (t)δnm + Em (t) ⟨n(t)|ṁ(t)⟩ , (2.17)

which can be recasted as


d
(En (t) − Em (t)) ⟨n(t)|ṁ(t)⟩ = Ėm (t)δnm − ⟨n(t)| dt Ĥ(t)|m(t)⟩ . (2.18)

For m ̸= n, one then has


d
⟨n(t)| dt Ĥ(t)|m(t)⟩
⟨ṅ(t)|m(t)⟩ = , (2.19)
(En (t) − Em (t))
where we exploited that ⟨ṅ(t)|m(t)⟩ = − ⟨n(t)|ṁ(t)⟩. Thus, by separating the case of m = n and m ̸= n in
Eq. (2.16), we have

 X d
⟨n(t)| dt Ĥ(t)|m(t)⟩
ċn (t) = ⟨ṅ(t)|n(t)⟩ − ℏi En (t) cn (t) + cm (t) . (2.20)
(En (t) − Em (t))
m̸=n

d
In the limit where the Hamiltonian Ĥ(t) changes slowly enough, i.e. for ⟨n(t)| dt Ĥ(t)|m(t)⟩ ≪ (En (t) − Em (t))
for all n and m, then one can neglect the last term in Eq. (2.20). This is the so-called adiabatic approximation,
which gives the following solutions
cn (t) = eiθn (t) eiγn (t) cn (0), (2.21)
where we defined Z Z
t t
θn (t) = − ℏ1 ds En (s), and γn (t) = −i ds ⟨ṅ(s)|n(s)⟩ . (2.22)
0 0

In particular, γn (t) ∈ R is known as the Berry phase.


Importantly, under the adiabatic approximation, one has that the probabilities evolve as

Pn (t) = |cn (t)|2 = |cn (0)|2 = Pn (0), (2.23)

which is the final proof of the theorem.

Remark 2.1. It is important to understand the limits in which the adiabatic approximation is valid. To prove it
in complete generality, one should require that the time-scale τ of the transformation is such that
2.4 Quantum Annealing 19

d
⟨n(t)| dt Ĥ(t)|m(t)⟩
τ ≫ max max . (2.24)
n̸=m 0≤t≤τ (En (t) − Em (t))

For the perspective of quantum computation, one can restrict to the case of n = 0 and m = 1. This is the case
where the system is initially prepared in the ground state n = 0 and one does not want a jump in the first
excited state m = 1. In such a case, the approximation is valid if
d
⟨ψ0 (t)| dt Ĥ(t)|ψ1 (t)⟩
τ ≫ max . (2.25)
0≤t≤τ (E0 (t) − E1 (t))

Notably, the more the energy gap E1 − E0 closes, the larger value of τ one has to consider. In the case of a
linear transition between the initial Ĥ0 and final Hamiltonian Ĥ1 (i.e. Ĥ(t) = (1 − t/τ )Ĥ0 + t/τ Ĥ1 ), a necessary
condition for keeping the energy gap open is that [Ĥ0 , Ĥ1 ] ̸= 0. Figure 2.1 represents graphically how the gap
should remain open during the Hamiltonian change so that the initial state being the ground state of Ĥ0 is
mapped150 to the ground state of Ĥ1 , which Chapter 12: Quantum
encodes the solution of computation
the problem. and adiabatic evolution

<latexit sha1_base64="87cR+E4ITDbNfWvSB84oqg/i+18=">AAAB8HicbZDNSgMxFIUz/tb6V3XpJlgEF1JmpKDuCiK4bMGxhXYomfROG5pJhiQj1KFP4FYXrsStbyS+jJl2Ftp6IPBx7r3k3hMmnGnjul/Oyura+sZmaau8vbO7t185OHzQMlUUfCq5VJ2QaOBMgG+Y4dBJFJA45NAOxzd5vf0ISjMp7s0kgSAmQ8EiRomxVuu2X6m6NXcmvAxeAVVUqNmvfPcGkqYxCEM50brruYkJMqIMoxym5V6qISF0TIbQtShIDDrIZotO8al1BjiSyj5h8Mz9PZGRWOtJHJ7HxIwS8iTtSI56sSk3/6t1UxNdBRkTSWpA0PmPUcqxkTg/Hw+YAmr4xAKhitmlMR0RRaixIZVtGt7i7cvgX9Sua26rXm3Ui1hK6BidoDPkoUvUQHeoiXxEEaBn9IJeHe28Oe/Ox7x1xSlmjtAfOZ8/Tc6QVA==</latexit>
<latexit
E
E1 (s)
E1 (1) ! |f1 (1)i
|f1 (0)i ! E1 (0)
<latexit sha1_base64="ftkTgE75u+JN/org0IyfqvyQib4=">AAAB9XicbZDNSsNAFIVv6l+tf1WXboJFqCAlEUHdFURwWcG0hTaUyXTSjp3MhJmJWEPfwa0uXIlbn0d8GSdtFtp6YeDj3Hu4d04QM6q043xZhaXlldW14nppY3Nre6e8u9dUIpGYeFgwIdsBUoRRTjxNNSPtWBIUBYy0gtFV1m89EKmo4Hd6HBM/QgNOQ4qRNlLzuudW1XGvXHFqzrTsRXBzqEBejV75u9sXOIkI15ghpTquE2s/RVJTzMik1E0UiREeoQHpGOQoIspPp9dO7COj9O1QSPO4tqfqb0eKIqXGUXASIT2M0ZMwlgzV/FAm/tfrJDq88FPK40QTjmcbw4TZWthZBnafSoI1GxtAWFJztI2HSCKsTVIlk4Y7//dF8E5rlzXn9qxSd/JYinAAh1AFF86hDjfQAA8w3MMzvMCr9Wi9We/Wx2y0YOWeffhT1ucPF5KR1g==</latexit>

DEmin
<latexit sha1_base64="sgalzsolUnYAU0J2g2/K2xOJHNk=">AAACD3icbVBPS8MwHE3nvzn/VT0KEhzCBBmtDNTbQASPE6wbrKWkWbqFpWlJUmHW3fwEfgyvevAkXv0I4pcx3XrQzQeBl/f7PZL3goRRqSzryygtLC4tr5RXK2vrG5tb5vbOrYxTgYmDYxaLToAkYZQTR1HFSCcRBEUBI+1geJHP23dESBrzGzVKiBehPqchxUhpyTf3L327Zh9BV8XwAbrJgBZ3gXifEd+sWnVrAjhP7IJUQYGWb367vRinEeEKMyRl17YS5WVIKIoZGVfcVJIE4SHqk66mHEVEetkkxxgeaqUHw1jowxWcqL8dGYqkHEXBcYTUIEH3sbbkVM4u5eJ/s26qwjMvozxJFeF4+mKYMqjT5+3AHhUEKzbSBGFB9achHiCBsNIdVnQb9mz2eeKc1M/r1nWj2mwUtZTBHjgANWCDU9AEV6AFHIDBI3gGL+DVeDLejHfjY7paMgrPLvgD4/MHGJ2aeA==</latexit>

<latexit sha1_base64="c3ZMf0I+4SZjF36IS7vXZAOAGT8=">AAACD3icbVDNSsNAGNzUv1r/oh4FWSxCBSmJFNRbQQSPFYwtNCFstpt26WYTdjdCrb35BD6GVz14Eq8+gvgybtIctHVgYZjvG76dCRJGpbKsL6O0sLi0vFJeraytb2xumds7tzJOBSYOjlksOgGShFFOHEUVI51EEBQFjLSD4UU2b98RIWnMb9QoIV6E+pyGFCOlJd/cf4BuMqC+XbOOoCsQ7zMCXRXDy1zyzapVt3LAeWIXpAoKtHzz2+3FOI0IV5ghKbu2lShvjISimJFJxU0lSRAeoj7paspRRKQ3znNM4KFWejCMhX5cwVz97RijSMpRFBxHSA0SdB9rS0bl7FIm/jfrpio888aUJ6kiHE8vhimDOnDWDuxRQbBiI00QFlR/GuIBEggr3WFFt2HPZp8nzkn9vG5dN6rNRlFLGeyBA1ADNjgFTXAFWsABGDyCZ/ACXo0n4814Nz6mqyWj8OyCPzA+fwAmlZp2</latexit>

<latexit sha1_base64="EPBgn5D3p2fn7K5W+ev2KpWuuwE=">AAACA3icbZBPS8MwGMbT+W/Of3UevQSH4GGMTgT1NlDB4wTrBmspaZZuYUlaklScZVc/hlc9eBKvfhDxy5huPejmC4Efz/s+vG+eMGFUacf5skpLyyura+X1ysbm1vaOvVu9U3EqMXFxzGLZDZEijAriaqoZ6SaSIB4y0glHF3m/c0+korG41eOE+BwNBI0oRtpIgV31LgnTCF4FmSc55FRMArvmNJxpwUVoFlADRbUD+9vrxzjlRGjMkFK9ppNoP0NSU8zIpOKliiQIj9CA9AwKxInys+ntE3holD6MYmme0HCq/nZkiCs15mGdIz1M0GNsLDmq+aFc/K/XS3V05mdUJKkmAs82RimDOoZ5IrBPJcGajQ0gLKk5GuIhkghrk1vFpNGc//siuMeN84Zzc1Jr1YtYymAfHIAj0ASnoAWuQRu4AIMH8AxewKv1ZL1Z79bHbLRkFZ498Keszx9Gd5eD</latexit>

<latexit sha1_base64="yPzzMBr8Mhh4ynjLJv6/X3DJ+14=">AAACL3icbVDLSgMxFM34rPVVdekmWIQKUmakoG5EEMFlBatCpwyZ9LYNzWRikhHq2L/xC/wMt7pQBHHrX5hpK2jrgcDhnHu4uSeUnGnjum/O1PTM7Nx8biG/uLS8slpYW7/UcaIo1GjMY3UdEg2cCagZZjhcSwUkCjlchd2TzL+6BaVZLC5MT0IjIm3BWowSY6WgcHQauCVvB/smxvfYlx0WpG5/oCgi2hywDzcJu83MqramryIs+z9uUCi6ZXcAPEm8ESmiEapB4d1vxjSJQBjKidZ1z5WmkRJlGOXQz/uJBklol7ShbqkgEehGOrizj7et0sStWNknDB6ovxMpibTuReFuRExHkrvYRjKqx4cy8T+vnpjWQSNlQiYGBB1ubCUc23ay9nCTKaCG9ywhVDH7aUw7RBFqbMd524Y3fvskqe2VD8vueaV4XBnVkkObaAuVkIf20TE6Q1VUQxQ9oCf0jF6cR+fV+XA+h6NTziizgf7A+foGJ7Wnrw==</latexit>
E0 (1) ! |f0 (1)i ⌘ |Yp i
|y0 i ⌘ |f0 (0)i ! E0 (0) <latexit sha1_base64="0IznMjCKHwdhcM7FBeJGcaN2gbg=">AAAB9XicbZDNSgMxFIUz9a/Wv6pLN8EiVJCSEUHdFURwWcFpC+1QMmmmjc0kQ5IR69B3cKsLV+LW5xFfxkw7C229EPg49x7uzQlizrRB6MspLC2vrK4V10sbm1vbO+XdvaaWiSLUI5JL1Q6wppwJ6hlmOG3HiuIo4LQVjK6yfuuBKs2kuDPjmPoRHggWMoKNlZrXPVTVx71yBdXQtOAiuDlUQF6NXvm725ckiagwhGOtOy6KjZ9iZRjhdFLqJprGmIzwgHYsChxR7afTayfwyCp9GEplnzBwqv52pDjSehwFJxE2wxg/SWvJUM8PZeJ/vU5iwgs/ZSJODBVktjFMODQSZhnAPlOUGD62gIli9mhIhlhhYmxSJZuGO//3RfBOa5c1dHtWqaM8liI4AIegClxwDurgBjSABwi4B8/gBbw6j86b8+58zEYLTu7ZB3/K+fwBFgOR1Q==</latexit>
E0 (s)
S
<latexit sha1_base64="CxkcAJIiNy7g1fb9pCL011jYRMw=">AAACJ3icbZDLSgMxFIYzXmu9jbp0EyxCBSlTKV52BRFcVrC20Cklk562oZnMmGQKdeyb+AQ+hltduBLFlW9iZlpQW38I/HznHE7O74WcKe04H9bc/MLi0nJmJbu6tr6xaW9t36ggkhSqNOCBrHtEAWcCqpppDvVQAvE9DjWvf57UawOQigXiWg9DaPqkK1iHUaINatnH99gNFWs52JVEdDlgF24jNsAJ7xmedw5+SjrAFylq2Tmn4KTCs6Y4MTk0UaVlf7rtgEY+CE05UapRdELdjInUjHIYZd1IQUhon3ShYawgPqhmnN43wvuGtHEnkOYJjVP6eyImvlJD3zv0ie6F5C4wI4lV000J/K/WiHTntBkzEUYaBB1v7EQcm4OT1HCbSaCaD40hVDLzaUx7RBKqTbZZk0Zx+vZZUz0qnBWcq1KuXJrEkkG7aA/lURGdoDK6RBVURRQ9oCf0jF6sR+vVerPex61z1mRmB/2R9fUNQyaj8g==</latexit>

<latexit sha1_base64="T8VFM2urIVRzrsS0WxlXJBT9cUM=">AAAB8HicbZDNSgMxFIXv+FvrX9Wlm2ARXEiZkYK6K7hx2aJjC+1QMmmmDc0kQ5IR6tAncKsLV+LWNxJfxkw7C209EPg4915y7wkTzrRx3S9nZXVtfWOztFXe3tnd268cHD5omSpCfSK5VJ0Qa8qZoL5hhtNOoiiOQ07b4fgmr7cfqdJMinszSWgQ46FgESPYWKt1169U3Zo7E1oGr4AqFGr2K9+9gSRpTIUhHGvd9dzEBBlWhhFOp+VeqmmCyRgPadeiwDHVQTZbdIpOrTNAkVT2CYNm7u+JDMdaT+LwPMZmlOAnaUdy1ItNuflfrZua6CrImEhSQwWZ/xilHBmJ8vPRgClKDJ9YwEQxuzQiI6wwMTaksk3DW7x9GfyL2nXNbdWrjXoRSwmO4QTOwINLaMAtNMEHAhSe4QVeHe28Oe/Ox7x1xSlmjuCPnM8fY3aQYg==</latexit>
<latexit

S
0 1
<latexit sha1_base64="O4slmpJ3Tu13f3ArCmmhCFw9zQ4=">AAAB8HicbZDNSgMxFIUz9a/Wv6pLN8EiuJAyI4K6K7hx2aJjC+1QMumdNjSTDElGqEOfwK0uXIlb30h8GTPtLLT1QODj3HvJvSdMONPGdb+c0srq2vpGebOytb2zu1fdP3jQMlUUfCq5VJ2QaOBMgG+Y4dBJFJA45NAOxzd5vf0ISjMp7s0kgSAmQ8EiRomxVuuuX625dXcmvAxeATVUqNmvfvcGkqYxCEM50brruYkJMqIMoxymlV6qISF0TIbQtShIDDrIZotO8Yl1BjiSyj5h8Mz9PZGRWOtJHJ7FxIwS8iTtSI56sSk3/6t1UxNdBRkTSWpA0PmPUcqxkTg/Hw+YAmr4xAKhitmlMR0RRaixIVVsGt7i7cvgn9ev627rotZwi1jK6Agdo1PkoUvUQLeoiXxEEaBn9IJeHe28Oe/Ox7y15BQzh+iPnM8fYkKQXg==</latexit>
<latexit

<latexit sha1_base64="f2VPWSSMtSvdpqKEyPvNOjE5RVU=">AAAB8HicbZDNSgMxFIUz9a/Wv6pLN8EiuJAyIwV1V3DjsgXHFtqhZNI7bWgmGZKMUIc+gVtduBK3vpH4MmbaWWjrgcDHufeSe0+YcKaN6345pbX1jc2t8nZlZ3dv/6B6ePSgZaoo+FRyqboh0cCZAN8ww6GbKCBxyKETTm7zeucRlGZS3JtpAkFMRoJFjBJjrbY7qNbcujsXXgWvgBoq1BpUv/tDSdMYhKGcaN3z3MQEGVGGUQ6zSj/VkBA6ISPoWRQkBh1k80Vn+Mw6QxxJZZ8weO7+nshIrPU0Di9iYsYJeZJ2JEe93JSb/9V6qYmug4yJJDUg6OLHKOXYSJyfj4dMATV8aoFQxezSmI6JItTYkCo2DW/59lXwL+s3dbfdqDUbRSxldIJO0Tny0BVqojvUQj6iCNAzekGvjnbenHfnY9FacoqZY/RHzucPLVKQPw==</latexit>
<latexit <latexit sha1_base64="K/fQx6GaDwt5Z4A4mPIQWv6kXfE=">AAAB8HicbZDNSgMxFIUz9a/Wv6pLN8EiuJAyIwV1V3DjsgXHFtqhZNI7bWgmGZKMUIc+gVtduBK3vpH4MmbaWWjrgcDHufeSe0+YcKaN6345pbX1jc2t8nZlZ3dv/6B6ePSgZaoo+FRyqboh0cCZAN8ww6GbKCBxyKETTm7zeucRlGZS3JtpAkFMRoJFjBJjrbY3qNbcujsXXgWvgBoq1BpUv/tDSdMYhKGcaN3z3MQEGVGGUQ6zSj/VkBA6ISPoWRQkBh1k80Vn+Mw6QxxJZZ8weO7+nshIrPU0Di9iYsYJeZJ2JEe93JSb/9V6qYmug4yJJDUg6OLHKOXYSJyfj4dMATV8aoFQxezSmI6JItTYkCo2DW/59lXwL+s3dbfdqDUbRSxldIJO0Tny0BVqojvUQj6iCNAzekGvjnbenHfnY9FacoqZY/RHzucPLt6QQA==</latexit>
<latexit

Fig. 2.1:Figure 12.1: In


Graphical this plot we summarize
representation of how thethe working
energy principle
levels of quantum
of Ĥ(t) change incomputation
time. As longassisted by minimum
as the the
energy adiabatic
gap ∆Emin evolution.
is finite,Inone
particular we plot
can employ thetwo energy levels
adiabatic ) and
E0 (sto
theorem as functions
E1 (s) the
go from of s =oft/T
ground state Ĥ0 (here
as |ψ0 ⟩) that
denotedassuming to that of
they satisfy
Ĥ ⟩).
1 thep adiabatic theorem: if the time T is large enough, the systems remains in itssτ .
(|Ψ Here, we used the parameter s to parametrise the time flow: t =
ground state during the whole evolution. See the text for details.

namely, during the evolution the state |y(t)i of the system remains very close to the instanta-
neous ground
2.4 Quantum state of the Hamiltonian Ĥ (t), 8t 2 [0, T ], if T is large enough. More in details,
Annealing
the adiabatic theorem states that if
The quantum annealing is an heuristic quantumTalgorithm Gmaxbased on the adiabatic theorem. It aims at solving
(12.16)
hard combinatorial optimisation problems using the Ising(DEmin )2
Hamiltonian as a target Hamiltonian.
The algorithm exploits an Hamiltonian transformation of the form
where ⌧
d H̃ (s)
GmaxĤ(t)
= max f1 (s)Ĥ0 + s(t)fĤ0 (Cs,) ,
= (1 − s(t)) (12.17) (2.26)
s2[0,1] ds
where s(t)
andis a suitable smooth function of time with s(0) = 0 and s(τ ) = 1, and ĤC is the Ising Hamiltonian
in Eq. (2.1) whose ground state encodes the solution of the problem. Moreover, one requires that H0 has a
DE = min [ E1 (s) E0 (s)] , (12.18)
non-degenerate ground state that is easy tomin
prepare and
s2[0,1 ] that [Ĥ0 , Ĥ1 ] ̸= 0. A simple choice is

then |hf0 (1)|y( T )i| ! 1. n


X
Ĥ0 = − σ̂x(i) , (2.27)
We are ready to apply the adiabatic theoremi=1
to the satisfiability problems.

⊗n ⊗n ⊗n
which has |+⟩ as ground state. This can be easily prepared via Hadamard gates: |+⟩ = Ĥ ⊗n |0⟩ .
If the12.3
quantum Finding theτ solutions
annealing time through
is not sufficiently thetransformation
long (i.e. the adiabaticisevolution
not sufficiently adiabatic),
which is essentially always the case, then one reach a state |ψ(τ )⟩, which has a probability p of being the solution
The simplest interpolating, time-dependent Hamiltonian Ĥ (t) such that Ĥ (0) = Ĥ0 and Ĥ ( T ) =
Ĥp , the problem Hamiltonian, is:
✓ ◆
t t
Ĥ (t) = 1 Ĥ0 + Ĥp , t 2 [0, T ] , (12.19)
T T
20 2 Variational Quantum Algorithms

of the problem. Such a probability (of success) is given by p = | ⟨zsol |ψ(τ )⟩ |2 , where |zsol ⟩ is the state encoding
the exact solution. To obtain the solution with a 99% certainty, one has to repeat the annealing procedure m
times. Indeed,
m
Psucc = 1 − (1 − p)m = 0.99. (2.28)
The corresponding total time required is given by

ln(1 − 0.99)
T99% = mτ = τ (2.29)
ln(1 − p)

A strong challenge for the quantum annealing is the full connectivity of the qubits. Indeed, in a quantum
computer, the qubits interactions, which are parameterised by Jij , are typically null beyond nearest-neighbour
sites. This strongly limits the scaling of universally annealing where one can suitably tune all the values of Jij .

2.5 Quantum Approximate Optimisation Algorithm (QAOA)

The Quantum Approximate Optimisation Algorithm (QAOA) is a hybrid quantum-classical algorithm that
allows for optimising a cost function and finding an approximated solution. It is an application of the adiabatic
theorem, similarly as the quantum annealing, which is run on a quantum computer, while a classical computer
optimises the cost function.
We start from a quantum annealing Hamiltonian of the form

Ĥ(t) = (1 − s(t))ĤM + s(t)ĤC , (2.30)

where s(t) is an arbitrary function such that s(0) = 0 and s(τ ) = 1 with τ being the total time of the
algorithm. The initial Hamiltonian ĤM is such that its ground state can be prepared easily. ĤC is instead
the cost Hamiltonian whose ground state encodes the solution to the problem. The QAOA is based on the
observation that the best way to implement the annealing Hamiltonian in Eq. (2.30) is a Trotter procedure.
Namely, this is to consider the unitary evolution with respect to Ĥ(t) and decompose it in small time steps.
Then, we have
 Z τ  Yp h i
i
Û (τ ) = T exp − ℏ dt Ĥ(t) ≃ exp − ℏi Ĥ(k∆t)∆t , (2.31)
0 k=1

where T indicates the time ordering, one assumes a large number of steps p ≫ 1 of length ∆ = τ /p. Owing that
for [Â, B̂] ̸= 0 one has
ei(Â+B̂)∆t = eiÂ∆t eiB̂∆t + O((∆t)2 ), (2.32)
and since we require that [ĤC , ĤM ] ̸= 0, one has that at each time step the following approximation is valid to
the order (∆t)2 :
Yp h i h i
Û (τ ) ≃ exp − ℏi (1 − s(k∆t)) ĤM ∆t exp − ℏi s(k∆t)ĤC ∆t . (2.33)
k=1

Now, the key idea of QAOA is to redefine the time dependence in the following way:
1 1
ℏ (1 − s(k∆t)) ∆t → βk , and ℏ s(k∆t)∆t → γk . (2.34)

Thus, we have
p
Y h i h i
Û (τ ) ≃ exp −iβk ĤM exp −iγk ĤC , (2.35)
k=1

where the parameters β = (β1 , . . . , βp ) and γ = (γ1 , . . . , γp ) become the variational parameters to be optimised.
Crucial difference with respect to the quantum annealing case is that one optimises over a set of 2p parameters
2.5 Quantum Approximate Optimisation Algorithm (QAOA) 21

instead of a fixed time segments. Finally, one constructs the variational state
p
Y
|γ, β⟩ = e−iβk ĤM e−iγk ĤC |init⟩ , (2.36)
k=1

where the initial state |init⟩ is the ground state of ĤM . In the case of ĤM being equal to Eq. (2.27), one has
⊗n
|init⟩ = Ĥ ⊗n |0⟩ . (2.37)

In the computational basis, the variational state reads


n
2X −1
|γ, β⟩ = dz (γ, β) |z⟩ , (2.38)
z=0

where dz (γ, β) defines the superposition in the Z basis. Notably, since ĤC encodes in its ground state the
solution of the problem, one needs to minimise the expectation value of ĤC computed on the variational state.
Namely
n
2X −1
Ep (γ, β) = ⟨γ, β|ĤC |γ, β⟩ = Pz (γ, β)C(z), (2.39)
z=0

where Pz (γ, β) = |dz (γ, β)|2 is the probability of having the |z⟩ state and C(z) = ⟨z|ĤC |z⟩ is the corresponding
cost. The best (γ, β) are such that
(γ ∗ , β ∗ ) = arg min Ep (γ, β). (2.40)
γ,β

Such an optimisation is performed on classical computer (classical optimiser). The circuit representation of the
QAOA is

quantum computer classical optimiser


e−iβp HM
e−iβ1 HM

e−iγp HC
e−iγ1 HC
H ⊗n

n
|0⟩ ... Compute: Ep (γ, β)

... Yes Stop


Gives the minimum?
... No New (γ, β)

(2.41)

Exercise 2.2
Derive the explicit expression of the cost fucntion C(z) in terms of the coefficients Jij and hi .

The single k step of the QAOA, when considering ĤM as in Eq. (2.27) and ĤC being the Ising Hamiltonian,
is implemented as the following. First we consider ĤM ,
n
X
ĤM = − σ̂x(i) . (2.42)
i=1

Then, the corresponding unitary acts independently on each qubit


22 2 Variational Quantum Algorithms

Pn n
Y
(i) (i)
−iβk ĤM iβk σ̂x
e =e i=1 = eiβk σ̂x . (2.43)
i=1

Then, the corresponding action can be implemented with a rotation on the single i-th qubit. The circuit
implementing it is
RX (−2βk ) (2.44)

Indeed a rotation around n by an angle θ is defined a R̂n (θ) = e−iθn·σ̂/2 . The implementation of the unitary
related to ĤC can be divided in two steps, indeed the two terms of ĤC in Eq. (2.1) commute. Then, one writes

Y n
Y
e−iγk ĤC = eiγk ( hi σ̂z(i) + 1≤i<j≤n Jij σ̂z(i) σ̂z(j) )
Pn (i)
σ̂z(j) (i)
P
i=1 = eiγk Jij σ̂z eiγk hi σ̂z . (2.45)
1≤i<j≤n i=1

Here, the single qubits factors act as rotations, with a circuit being

RZ (−2γk hi ) (2.46)

On the other hand, the two qubits interactions are 2-local gates, which can be implemented via a rotation
between two CNOT gates. Namely, the corresponding circuit will read

(2.47)
RZ (−2γk Jij )

thus becoming very easy to be implemented.

2.6 Variational Quantum Eigensolver (VQE)

Similarly as the QAOA, the Variational Quantum Eigeinsolver (VQE) is an heuristic approach to solve combi-
natorial optimisation problem that exploits a combination of quantum computation and classical optimisation.
In particular, the QAOA can be seen as a specific implementation of the VQE algorithm.
The algorithm is designed to solve problems that can be stated as finding the ground state energy E0 of n
qubit Hamiltonian. Namely, to find the configuration corresponding to the state |Ψ0 ⟩ that

Ĥ |Ψ0 ⟩ = E0 |Ψ0 ⟩ . (2.48)

The generality with respect to QAOA comes in the form of the cost Hamiltonian ĤC . Indeed, one assumes for
it the most general form, which is
X X O n
ĤC = hα P̂α = hα σ̂α(j)
j
, (2.49)
α α j=1

where hα are coefficients and the P̂α are called Pauli strings. The latter are product of n single-qubit Pauli
matrices (including the identity). Thus, compared to QAOA (which exploits the Ising model), this Hamiltonian
is not limited to two qubit interactions only, but can consider n qubit interactions. This is particularly relevant
when considering more complex systems where the Ising model fails to describe the entire complexity of the
problem.
Then, the steps of VQE are the following:
1. Map the problem in a cost Hamiltonian ĤC so that the solution is embedded in its ground state.
2.6 Variational Quantum Eigensolver (VQE) 23

2. Prepare the initial state as the ground state of Ĥ.


3. Generate the trial state |Ψ (θ)⟩, which is determined by a set of parameters θ.
4. Measure the expectation values of the Pauli strings in the Hamiltonian, i.e. ⟨Ψ (θ)|P̂α |Ψ (θ)⟩. This is the end
of the computation on the quantum computer P
5. Compute the corresponding energy, i.e. E(θ) = α hα ⟨Ψ (θ)|P̂α |Ψ (θ)⟩
6. Update or accept the values of θ based on the result.
7. If updated, one goes back to point 2.
Notably, when searching for the ground state energy of the cost Hamiltonian, there are several pitfalls that
the update step must deal with. For example, the parameter landscape may have local minima where one does
not want to remain stacked.
Chapter 3
Noisy Intermediate-Scale Quantum (NISQ) computation

For quantum algorithms to function properly, we need to ensure that the basic units of quantum information, the
qubits, are as reliable as the bits in classical computers. These qubits must be shielded from environmental noise
that can disrupt their states, while still have to be controlled by external agents. This control involves making
the qubits entangle and eventually measuring their states to extract the outputs of the quantum computation.
Technically, it is feasible to minimise the impact of noise without compromising the quantum information
process through the development of Quantum Error Correction (QEC) and Quantum Error Mitigation (QEM)
protocols, see Chap. 4.
Many quantum algorithms that come with guaranteed performance need millions of physical qubits to effec-
tively use QEC methods. It could take decades to build fault-tolerant quantum computers capable of reaching
this scale. Presently, quantum devices typically have around 100-1000 physical qubits, often referred to as noisy
intermediate-scale quantum (NISQ) devices. These devices lack error correction and are imperfect, yet in the
NISQ era, the aim is to maximize the quantum computational capabilities of current devices, while working on
techniques for fault-tolerant quantum computation.

Here, we study how noises impact quantum circuits. The following circuit will be considered as a basis of the
study:
|ψ⟩

|0⟩ Xd (3.1)

where the gate X is repeated d times. The value of d is also called the depth of the circuit. The state before the
measurement, when no noise is considered, is given by

|ψ⟩ = (iR̂x (θ = π))d |0⟩ = id [cos(dπ/2) |0⟩ − sin(dπ/2) |1⟩] , (3.2)

indeed one has that the X gate can be realised as a rotation of an angle π around the x axis: σ̂x = iR̂x (π).
Notably, the factor id is just a negligible global phase. The expectation value of the polarisation is

⟨Z⟩ = ⟨ψ|σ̂z |ψ⟩ = cos2 (dπ/2) − sin2 (dπ/2) = cos(dπ), (3.3)

which is shown in the left panel of Fig. 3.1. Clearly, the value of ⟨Z⟩ jumps from +1 to −1 depending on the
value of d. However, when we perform such a simple experiment the result is quite different due to the noises
and errors acting on the system. This is represented in the right panel Fig. 3.1. Such a result account for the
presence of different noises and errors. These are listed and studied below.

24
3.1 Miscalibrated gates 25

1.0 1.0

0.5 0.5
Measured <Z>

Measured <Z>
0.0 0.0

-0.5 -0.5

-1.0 -1.0
0 20 40 60 80 100 0 20 40 60 80 100
circuit depth d circuit depth d

Fig. 3.1: Expectation value of the polarisation ⟨Z⟩ for the circuit in Eq. (3.1) with respect to the depth d of the
circuit: (left panel) in the case of no noises; (right panel) when noises are accounted.

3.1 Miscalibrated gates

As we saw previously, the gate X can be performed as a rotation of an angle π around the x axis. Now, let us
suppose that the gate is systematic miscalibrated. Specifically, one performs a rotation of an angle of π + ϵ in
place of only π. Then, we have that the actual gate X̃ is given by

X̃ = X iRx (ϵ) (3.4)

indeed one has that


Rx (π + ϵ) = Rx (π)Rx (ϵ). (3.5)
Then, when running the circuit with d repetitions, one simply has

|ψ⟩

|0⟩ X̃ d = |0⟩ Xd iRx (dϵ) (3.6)

where h     i
|ψ⟩ = id cos d (π+ϵ)
2 |0⟩ − i sin d (π+ϵ)
2 |1⟩ . (3.7)

Correspondingly, one has that the expectation value for the polarisation is
   
⟨Z⟩ = cos2 d (π+ϵ)
2 − sin2
d (π+ϵ)
2 = cos(d(π + ϵ)), (3.8)

which is shown in the left panel of Fig. 3.2. For small values of ϵ and d, one performs an error of

| ⟨Z⟩noiseless − ⟨Z⟩miscalibrated | ∼ 12 d2 ϵ2 , (3.9)

which scales quadratically with the miscalibration ϵ. As it is shown in the right panel of Fig. 3.2, the difference
with respect to the noiseless result can be substantial. Indeed, for values of d such that dϵ ∼ (2n + 1)π, with
n ∈ N, we have that
⟨Z⟩miscalibrated = − ⟨Z⟩noiseless . (3.10)
This means that the error completely inverts the output signal.
26 3 Noisy Intermediate-Scale Quantum (NISQ) computation

1.0 2.0

|<Z> noisless -<Z> miscalibrated |


0.5 1.5
Measured <Z>

0.0 1.0

-0.5 0.5

-1.0
0.0
0 20 40 60 80 100 0 20 40 60 80 100
circuit depth d circuit depth d

Fig. 3.2: (Left panel) Expectation value (red dots) of the polarisation ⟨Z⟩ for the circuit in Eq. (3.1) with respect
to the depth d of the circuit when miscalibrated gates are considered. (Right panel) Difference with respect to
the noiseless case (blue line) and the small ϵ and d expansion (red line). Here we considered ϵ = 0.1.

3.2 Projection noise and sampling error

Consider the following trivial circuit

|ψ⟩ (3.11)

whose possible values of the polarisation are z = +1, meaning that the state after the collapse is |0⟩, and z = −1,
with corresponding state |1⟩.
Let us define a measurement operator M̂ that indicates if the state of the qubit is in the |1⟩ state. Such an
operator can be constructed as
M̂ = |1⟩ ⟨1| ,
= 1 |1⟩ ⟨1| + 0 |0⟩ ⟨0| ,
X (3.12)
= mΠ̂m ,
m=0,1
P
where m are the eigeinvalues of M̂ and Π̂m = |m⟩ ⟨m|, with m Π̂m = 1̂. Namely, the expectation value of M̂
indicates the probability p(m = 1) that the state |ψ⟩ is equal to |1⟩:

⟨ψ|M̂ |ψ⟩ = ⟨ψ|1⟩ ⟨1|ψ⟩ = | ⟨1|ψ⟩ |2 = p(m = 1). (3.13)

Correspondingly, one has p(m = 0) = 1−p(m = 1). To ease the notation, in the following we use p = p(m = 1).
The outcomes of the operator M̂ are distributed via a binomial distribution B(p). To be more explicit, let us
consider the repetition of the above circuit N times, meaning that we have N samplings of the protocol.
N
Then, we can construct a series of outputs: { mn }n=1 = { 0, 0, 1, 0, 1, 1, 0, . . . }, where each entry is a random
variable. This corresponds in a series of states into which the system has collapsed after the measurement:
{ | 0⟩, | 0⟩, | 1⟩, | 0⟩, | 1⟩, | 1⟩, | 0⟩, . . . }. Suppose we have N = 3, then we have a total of 2N = 23 outputs
(m1 , m2 , m3 ). Namely
3.2 Projection noise and sampling error 27

(m1 , m2 , m3 ) (|m1 ⟩ , |m2 ⟩ , |m3 ⟩) S


(0, 0, 0) (|0⟩ , |0⟩ , |0⟩) 0
(0, 0, 1) (|0⟩ , |0⟩ , |1⟩) 1/3
(0, 1, 0) (|0⟩ , |1⟩ , |0⟩) 1/3
(0, 1, 1) (|0⟩ , |1⟩ , |1⟩) 2/3 (3.14)
(1, 0, 0) (|1⟩ , |0⟩ , |0⟩) 1/3
(1, 0, 1) (|1⟩ , |0⟩ , |1⟩) 2/3
(1, 1, 0) (|1⟩ , |1⟩ , |0⟩) 2/3
(1, 1, 1) (|1⟩ , |1⟩ , |1⟩) 1
where we also computed the corresponding sampling mean S, which is defined as
N
1 X
S= mn . (3.15)
N n=1

The statement then is that the sampling mean S, which is also a random variable, is distributed as a binomial
distribution B(p), with mean E[S] = p and variance V[S] = p(1 − p)/N . Fig. 3.3 shows some examples. Now,

0.3
prob(S)

0.2

0.1

0.0
0.0 0.2 0.4 0.6 0.8 1.0
S

Fig. 3.3: Binomial distribution followed by the sampling mean S for N = 100 samplings with p = 0.2 (red plot)
and p = 0.5 (blue plot), and for N = 3 with p = 0.5 (green plot).

by assuming that the state |ψ⟩ in Eq. (3.11) is that one has before the measurement in Eq. (3.6), i.e.
h     i
|ψ⟩ = id cos d (π+ϵ)
2 |0⟩ − i sin d (π+ϵ)
2 |1⟩ , (3.16)

then the corresponding distribution B(pd ) depends on the probability of being in the state |1⟩ after a depth d
of the circuit. This is given by  
pd = sin2 d (π+ϵ)
2 . (3.17)

The corresponding expectation value of the polarisation is shown in Fig. 3.4, where we also report its difference
with respect to the case shown in Fig. 3.2.
28 3 Noisy Intermediate-Scale Quantum (NISQ) computation

1.0 0.08

|<Z> miscalibrated -<Z> sampling |


0.5 0.06
Measured <Z>

0.0 0.04

-0.5 0.02

-1.0
0.00
0 20 40 60 80 100 0 20 40 60 80 100
circuit depth d circuit depth d

Fig. 3.4: (Left panel) Expectation value (red dots) of the polarisation ⟨Z⟩ for the circuit in Eq. (3.1) with
respect to the depth d of the circuit when miscalibrated gates and error sampling are considered. (Right panel)
Difference with respect to the miscalibrated case. Here we considered ϵ = 0.1 and N = 10.

3.3 Measurement error

Another source of errors is related to the performance of the measurement apparatus. To be explicit, consider
the following trivial circuit
|ψ⟩

|0⟩ U (3.18)

Suppose that is the state |ψ⟩ = |0⟩ to be fed to the measurement apparatus. Then, if the apparatus is perfectly
set, it will give as the polarisation value z = +1 corresponding to the output m = 0. However, there might be
errors and there could be a non-null probability µ that the measurement apparatus gives as an output m = 1.
Similarly, if |ψ⟩ = |1⟩, one could have a probability ν to have m = 0. The following scheme represents the
supposed outcome and the actual outcome with the corresponding probabilities:

0 (1−µ) 0
µ
supposed m = = actual m̃. (3.19)
ν
1 (1−ν) 1

We can define the probability vectors for the supposed and actual outcomes, which respectively are
   
1−p 1 − p̃
PM = and PM̃ = , (3.20)
p p̃

where p = p(m = 1) and p̃ = p̃(m̃ = 1) are the probability of having the outcome m = 1 in the supposed
and actual case respectively. Such vectors are related by the matrix A, which quantifies the performances of
measurement apparatus: PM̃ = APM , where
 
P (m̃ = 0|m = 0) P (m̃ = 0|m = 1)
A= , (3.21)
P (m̃ = 1|m = 0) P (m̃ = 1|m = 1)

where P (m̃|m) is the conditional probability of having the actual outcome m̃ given the supposed outcome m.
The diagram in Eq. (3.19) sets the entries of A to
3.3 Measurement error 29
 
1−µ ν
A= . (3.22)
µ 1−ν

By merging the latter and Eq. (3.20), we find

p̃ = p + µ − (ν + µ)p, (3.23)

which is represented in Fig.3.5. To recalibrate the measurement apparatus, i.e. to quantify experimentally the

1.0

0.8
ase ase
ec
al c ois
0.6 Ide e nt n
rem
asu
Me

p

0.4
(1 − 𝜈 − 𝜇)

0.2

0.0
0.0 0.2 0.4 0.6 0.8 1.0
p

1.0
0.12
|<Z> miscalibrated -<Z> measurement |

0.5 0.10
Measured <Z>

0.08
0.0
0.06

0.04
-0.5
0.02
-1.0 0.00
0 20 40 60 80 100 0 20 40 60 80 100
circuit depth d circuit depth d

Fig. 3.5: (Top panel) Representation of Eq. (3.23). (Bottom left panel) Expectation value (red dots) of the
polarisation ⟨Z⟩ for the circuit in Eq. (3.1) with respect to the depth d of the circuit when miscalibrated gates
and measurement errors are considered. (Bottom right panel) Difference with respect to the miscalibrated case.
Here we considered ϵ = 0.1, ν = 0.07 and µ = 0.03.

values of µ and ν one would need to run the following two trivial circuits:

|0⟩
(3.24)
|1⟩

They should give 100% of the time the outcomes m = 0 and m = 1 respectively. Variations of such percentage
will characterise the values of µ and ν. The bottom panels in Fig. 3.5 show the corresponding polarisation and
difference with the miscalibrated case.
30 3 Noisy Intermediate-Scale Quantum (NISQ) computation

3.3.1 Environmental noise

We now dwell in the most interesting source of noise, which is the one due to the external environment. In a
circuit-based representation of the evolution, one now has

|0⟩ G̃ (3.25)

where G̃ represents the noisy version of the gate G. There are different possible ways how one can account for
the noise action. Here, we will consider the following way. Every gate G of the noiseless case is substituted by
G̃, where an extra gate, say E, is added with a probability pE . Namely,

Case Probability Effective circuit


G̃A

A 1 − pE |0⟩ 1 G
(3.26)
G̃B

B pE |0⟩ E G

For the sake of simplicity, we will consider the case of E = X and G = X. With this choice, in the case A,
one has G̃ = 1X = X, and the gate is properly implemented. While the case B, one has G̃ = XX = 1, which
nullify the action of the original gate. Now, in the ideal case (E = 1 always), the state before the measurement
is |ψ⟩ = |1⟩, so the outcome is h i
⟨m⟩ = Tr M̂ ρ̂ = 1, (3.27)

indeed, the probability of having m = 1 is p(m = 1) = 1. In the case with the environmental noise, one has
X
⟨m⟩ = m p(m),
m=0,1
(3.28)
= (1 − pE ) + pE × 0,
= (1 − pE ).

In particular, this result can be constructed as follows. Starting from the initial state |0⟩, we construct the
corresponding initial statistical operator ρ̂0 . Then, with a probability pA = (1 − pE ) evolves as in the case A,
and with a probability pB = pE as in the case B. Namely, one has

ρ̂ = pA ρ̂A + pB ρ̂B , (3.29)

where
ρ̂B = σ̂x ρ̂0 σ̂x , and ρ̂B = 1̂ρ̂0 1̂. (3.30)
This gives
ρ̂ = (1 − pE ) |1⟩ ⟨1| + pE |0⟩ ⟨0| , (3.31)
which, in the computational basis, is represented as
 
pE 0
ρ= . (3.32)
0 (1 − pE )

The corresponding expectation value of the measurement operator M̂ is


3.3 Measurement error 31
h i
⟨m⟩ = Tr M̂ ρ̂ ,
   
00 pE 0
= Tr ,
01 0 (1 − pE )
  (3.33)
0 0
= Tr ,
0 (1 − pE )
= (1 − pE ),

as expected. Conversely, the polarisation is

⟨Z⟩ = (2pE − 1). (3.34)

Applying the noisy gate d times, we find


⟨Z⟩ = (2pE − 1)d , (3.35)
which is represented in Fig. 3.6.

Exercise 3.1
Verify the relation in Eq. (3.35).

0.8
1.0
|<Z> noisless -<Z> environment |

0.5 0.6
Measured <Z>

0.0 0.4

-0.5 0.2

-1.0
0.0
0 20 40 60 80 100 0 20 40 60 80 100
circuit depth d circuit depth d

Fig. 3.6: (Left panel) Expectation value (red dots) of the polarisation ⟨Z⟩ for the circuit in Eq. (3.1) with respect
to the depth d of the circuit when the environment noise considered. (Right panel) Difference with respect to
the noiseless case. Here we considered pE = 0.007.

3.3.2 Global noise action

The last step of this section is to put together the different noises and errors discussed here. Namely, when one
has a circuit, to account for the error, such a circuit needs to be substituted as represented

 d
|0⟩ X → |0⟩ E X iRx (ϵ) Sampling Measurement

(3.36)
32 3 Noisy Intermediate-Scale Quantum (NISQ) computation

The action of the environment noise and miscalibration lead the qubit in the state

ρ̂ = (1 − pE ) |ψA ⟩ ⟨ψA | + pE |ψB ⟩ ⟨ψB | , (3.37)

where    
|ψA ⟩ = cos d (π+ϵ)
2 |0⟩ − i sin d (π+ϵ)
2 |1⟩ ,
  (3.38)
|ψB ⟩ = cos d 2ϵ |0⟩ − i sin d 2ϵ |1⟩ .
Specifically, such a state can be rewritten as

ρ̂ = (ρ00 |0⟩ ⟨0| + ρ11 |1⟩ ⟨1| + ρ10 |1⟩ ⟨0| + ρ01 |0⟩ ⟨1|) , (3.39)

where the ρ00 and ρ11 populations are fundamental in computing the expectation value of the polarisation:

⟨Z⟩ = ρ00 − ρ11 ,


(3.40)
= (1 − pE ) cos (d(π + ϵ)) + pE cos (dϵ) .

On the other hand, to compute the effect of the sampling error, one needs only ρ11 , which is equal to the
probability of having m = 1, i.e. of being in the state |1⟩. Thus, Eq. (3.17) becomes

(1 − cos(d(π + ϵ))) (1 − cos(dϵ))


pd = (1 − pE ) + pE , (3.41)
2 2
with respect to which one constructs the statistics of the outcomes that are distributed following a binomial
distribution B(pd ).
Finally, the measurement error can be accounted by mapping the sampling means Sd in those accounting for
diagram in Eq. (3.19). This consists in

Sd → Sd + µ − (ν + µ)Sd . (3.42)

The result of considering all the noises and errors is given by the right panel of Fig. 3.1.
Chapter 4
Quantum Error Correction

4.1 Quantum Error Correction

Several techniques have been developed to correct errors due to the presence of noise. This is not only a considered
issue in the quantum information context, but also in the classical one. In both cases, the key ingredient is the
redundancy.

𝜓 { }𝜓

Decoding
Encoding

Errors

0 0
0 0
Recovery

0 0
0 0

Fig. 4.1: Schematic representation of the Quantum Error Correcting approach.

4.1.1 Classical error correction

Consider the following example, that will make clear the usefulness of redundancies. We have Alice that wants
to send a single bit information to Bob. The communication channel is not perfect: a bit-flip error noise can act
on the bit with the following probabilities:

0 (1−ϵ) 0
ϵ
Alice sends the bit = = is the bit the Bob receives. (4.1)
ϵ
1 (1−ϵ) 1

With this scheme, the protocol has a probability of failing that is

Pfail = ϵ, (4.2)

33
34 4 Quantum Error Correction

which is equal to the probability ϵ of the bit being flipped. The idea of error correction is to suitably modify
the protocol so one can recover the wanted information, with a failing probability being

Pfail < ϵ. (4.3)

Specifically, what Alice does is to send the bit string 000 in place of only the single bit 0. This operation is
called encoding, and in this specific case, one encodes the classical information in the following way

0 → 000,
(4.4)
1 → 111.

Then, Bob receives three bits and needs to decode the information. This is performed via a majority voting.
For example, let us assume the second bit is flipped while the other remain untouched: Bob receives 010, and
the majority voting gives
010 → 0. (4.5)
This is a decoding of the classical information. Considering all the possible three bits strings (A, B, C) that Bob
can receive if Alice sends 000, with the corresponding probabilities p(A, B, C), we have

(A, B, C) p(A, B, C) decoded bit


(0, 0, 0) (1 − ϵ)3 0
At most 1 error
(0, 0, 1) ϵ(1 − ϵ)2 0
2
(0, 1, 0) ϵ(1 − ϵ) 0
Majority voting works
Alice encodes 0 in 000 → Bob receives (1, 0, 0) ϵ(1 − ϵ)2 0 (4.6)
2
(0, 1, 1) ϵ (1 − ϵ) 1
2 or more errors
(1, 0, 1) ϵ2 (1 − ϵ) 1
2
(1, 1, 0) ϵ (1 − ϵ) 1
Majority voting fails
(1, 1, 1) ϵ3 1

The probability that the protocol fails is given by the sum of the probabilities of the failing cases:

Pfail = 3 × ϵ2 (1 − ϵ) + e3 = 3ϵ2 − 2ϵ3 , (4.7)

which is reported in Fig. 4.2.

1.0

0.8

0.6
Pfail

0.4

0.2

0.0
0.0 0.2 0.4 0.6 0.8 1.0
ϵ

Fig. 4.2: Probability of failing Pfail for the single bit channel (dashed red line) and the three-bit classical
correcting code (blue line).
4.1 Quantum Error Correction 35

Specifically, for 0 ≤ ϵ < 1/2, we have that Eq. (4.3) is satisfied. This means that by using this protocol one
has less probability to fail (pfail ) rather than using a single bit (ϵ). Therefore, the redundancy is a good approach
to reduce errors, as long as Eq. (4.3) is satisfied.

4.1.2 Quantum information context

The direct application of redundancy in the quantum information context encounters some important, although
not insurmountable, difficulties.

- The no-cloning theorem (see Sec. 1.1) does not allow to create copies of an unknown quantum state. This
means that Alice cannot generate |ψ⟩ |ψ⟩ |ψ⟩ to protect an unknown state |ψ⟩.
- The second difficulty comes in how the classical error correcting code operates: one measures the state of the
bit and applies a correcting operation accordingly. In the quantum case, the measurement operation would
destroy the coherence of the state and thus the information encoded in the state. To be more quantitative,
take the generic state |ψ⟩ = α |0⟩ + β |1⟩. After the measurement, the state collapses in |0⟩ or in |1⟩ with the
respective probabilities. However, one cannot reconstruct the coherence of the state after its collapse.
- In classical information, the only possible error is a bit-flip: 0 → 1 and 1 → 0. Conversely, in quantum
information the class of possible noises is far wider. For example, the phase-flip maps α |0⟩ + β |1⟩ → α |0⟩ −
β |1⟩, and this does not have a classical counterpart. Moreover, in the quantum context, one can also have
infinitesimal errors that can accumulate as the depth of the algorithm increases. An example can be α |0⟩ +
β |1⟩ → α |0⟩ + R̂x (ϵ)β |1⟩, where R̂x (ϵ) is a rotation of an infinitesimal angle ϵ around the x axis.

4.1.3 The 3-qubit bit-flip code

The first Quantum Error Correction (QEC) code we see is that correcting bit-flip errors. This is the counterpart
of that seen in the classical information context.
Suppose Alice wants to send the generic state |ψ⟩ = α |0⟩+β |1⟩ to Bob via a bit-flip noisy channel. We assume
that the noise acts independently on each of the qubits that Alice sends. This is an important assumption for
the QEC codes we will see here. We assume that the noise leaves the qubit untouched with a probability (1 − ϵ),
while it applies σ̂x with a probability ϵ. Indeed, σ̂x |0⟩ = |1⟩ and σ̂x |1⟩ = |0⟩. This is essentially the quantum
version of what shown in Eq. (4.1).
To protect the information from bit-flip errors, Alice employs the following encoding:

|0⟩ → |0L ⟩ = |0⟩ |0⟩ |0⟩ ,


(4.8)
|1⟩ → |1L ⟩ = |1⟩ |1⟩ |1⟩ ,

where |0⟩ and |1⟩ are physical qubits, while |0L ⟩ and |1L ⟩ are logical qubits. Then, the generic state |ψ⟩ is
encoded in
|ψ⟩ = α |0⟩ + β |1⟩ → α |0L ⟩ + β |1L ⟩ = α |000⟩ + β |111⟩ , (4.9)
with the notation |q1 q2 q3 ⟩ = |q1 ⟩ |q2 ⟩ |q3 ⟩. This encoding can be implemented via the following circuit

|ψ⟩

|0⟩ |Ψ1 ⟩ (4.10)

|0⟩

Indeed, we have
36 4 Quantum Error Correction

CN OT ⊗1̂ 1̂⊗CN OT
|ψ00⟩ = α |000⟩ + β |100⟩ −−−−−−→ α |000⟩ + β |110⟩ −−−−−−→ α |000⟩ + β |111⟩ = |Ψ1 ⟩ . (4.11)

We underline that the entangled state |Ψ1 ⟩ is not equal to |ψ⟩ |ψ⟩ |ψ⟩, so the no-cloning theorem is not violated.
Now, the state |Ψ1 ⟩ is sent to Bob via the noisy channel. Bob receives one of the following states |Ψ2 ⟩ with
the respective probabilities p(|Ψ2 ⟩):

|Ψ2 ⟩ p(|Ψ2 ⟩)
α |000⟩ + β |111⟩ (1 − ϵ)3
α |001⟩ + β |110⟩ ϵ(1 − ϵ)2
At most 1 error
α |010⟩ + β |101⟩ ϵ(1 − ϵ)2
Alice encodes |ψ⟩ in |Ψ1 ⟩ → Bob receives α |100⟩ + β |011⟩ ϵ(1 − ϵ)2 (4.12)
α |011⟩ + β |100⟩ ϵ2 (1 − ϵ)
α |101⟩ + β |010⟩ ϵ2 (1 − ϵ)
2 or more errors
α |110⟩ + β |001⟩ ϵ2 (1 − ϵ)
α |111⟩ + β |000⟩ ϵ3

Let us suppose that Bob receives the state |Ψ2 ⟩ = α |100⟩ + β |011⟩. To correct the bit-flip, Bob would be
(1) (2) (3)
tempted to perform a simultaneous measurement of the spin of the three qubits, i.e. σ̂z σ̂z σ̂z . Such an
operation would give as an outcome 100 with probability |α|2 and 011 with probability |β|2 . Then, by applying
a majority voting, Bob would understand that the first qubit is flipped. However, the coherence of the state is
lost. Indeed, the measurement of the spin of the qubits collapses the state. To solve the problem, one needs to
perform the so-called error syndrome. In particular, Bob employs two ancillary qubits that are prepared in the
|0⟩ state and coupled to the qubits carrying the encoded state. The circuit implementing the correction then is

|Ψ2 ⟩ Û

(4.13)

x0
|0⟩

x1
|0⟩

To be quantitative, starting from |Ψ2 ⟩ = α |100⟩ + β |011⟩, we have


CN OT1,4
|Ψ2 ⟩ |00⟩ = α |10000⟩ + β |01100⟩ −−−−−−→ α |10010⟩ + β |01100⟩ ,
CN OT2,4
−−−−−−→ α |10010⟩ + β |01110⟩ ,
CN OT1,5
−−−−−−→ α |10011⟩ + β |01110⟩ , (4.14)
CN OT3,4
−−−−−−→ α |10010⟩ + β |01111⟩ ,
= (α |100⟩ + β |011⟩) |11⟩ .

Fundamentally, the last two qubits are not entangled with the first three. Thus, the measurement on the last
two qubits does not impose the collapse of the first three. After such a measurement, Bob has the outcomes
x0 = 1 and x1 = 1. In particular, x0 = 1 indicates that one among the first and the second qubit has flipped.
Similarly, x1 = 1 indicates that one among the first and the third qubit has flipped. Then, Bob knows, under
(1)
the assumption of single qubit errors, that the first qubit has flipped and can apply Û = σ̂x to flip it back.
In general, Bob will apply the following unitary operations to correct the errors:
4.1 Quantum Error Correction 37

x0 x1 Û
0 0 1̂
(3) (4.15)
0 1 σ̂x
(2)
1 0 σ̂x
(1)
1 1 σ̂x

After having applied the correction, Bob gets the state |Ψ3 ⟩ with the following probabilities

|Ψ2 ⟩ |Ψ3 ⟩ p(|Ψ3 ⟩)


α |000⟩ + β |111⟩ α |000⟩ + β |111⟩ (1 − ϵ)3
α |001⟩ + β |110⟩ α |000⟩ + β |111⟩ ϵ(1 − ϵ)2
α |010⟩ + β |101⟩ α |000⟩ + β |111⟩ ϵ(1 − ϵ)2
α |100⟩ + β |011⟩ α |000⟩ + β |111⟩ ϵ(1 − ϵ)2 (4.16)
2
α |011⟩ + β |100⟩ α |111⟩ + β |000⟩ ϵ (1 − ϵ)
α |101⟩ + β |010⟩ α |111⟩ + β |000⟩ ϵ2 (1 − ϵ)
α |110⟩ + β |001⟩ α |111⟩ + β |000⟩ ϵ2 (1 − ϵ)
α |111⟩ + β |000⟩ α |111⟩ + β |000⟩ ϵ3

Finally, Bob applies the following decoding circuit

|ϕ⟩

|Ψ2 ⟩ |0⟩ (4.17)

|0⟩

which is the inverse of the circuit in Eq. (4.10). The final state |ϕ⟩ is

|ϕ⟩ = α |0⟩ + β |1⟩ = |ψ⟩ , with probability p = (1 − ϵ)3 + 3ϵ(1 − ϵ)2 ,


(4.18)
|ϕ⟩ = α |1⟩ + β |0⟩ = σ̂x |ψ⟩ , with probability p = 3ϵ2 (1 − ϵ) + ϵ3 .

Thus, the failing probability of this QEC code is

Pfail = 3ϵ2 − 2ϵ3 , (4.19)

which is the same as in the classical correcting algorithm seen previously and it is plotted in Fig. 4.2. Notably,
Bob does not learn anything about the weights α and β thought this QEC code. The coherence of the state
remains intact.

4.1.4 The 3-qubit phase-flip code

Let us consider the case of the phase-flip noise, where the following error generates with a probability ϵ:

|0⟩ → σ̂z |0⟩ = |0⟩ ,


(4.20)
|1⟩ → σ̂z |1⟩ = − |1⟩ .

Consequently, one has


|ψ⟩ = α |0⟩ + β |1⟩ → α |0⟩ − β |1⟩ . (4.21)
38 4 Quantum Error Correction

Notably, this noise does not have a classical counterpart. Since the error is imprinted in the relative phase
between |0⟩ and |1⟩, the bit-flip QEC code developed in Sec. 4.1.3 does not correct this type of errors. However,
a phase-flip error in the computational basis { | 0⟩, | 1⟩ } corresponds to a bit-flip error in the { | +⟩, | −⟩ }
basis. Indeed,
σ̂z |+⟩ = |−⟩ ,
(4.22)
σ̂z |−⟩ = |+⟩ .
Then, by simply adding a Hadamard gate, one changes basis and thus is able to employ the bit-flip QEC code
to correct phase-flip errors. This is done both in the encoding and the decoding parts of the code. The encoding
circuit is then
|ψ⟩ H

|0⟩ H |Ψ1 ⟩ (4.23)

|0⟩ H

while the deconding becomes


H |ϕ⟩

|Ψ2 ⟩ H |0⟩ (4.24)

H |0⟩

The remaining parts of the code remain identical.

4.1.5 The 9-qubit Shor code

We saw how the 3-qubit bit-flip and phase flip QEC codes can correct respectively bit-flip and phase flip
errors. Here, we show that concatenating these two codes, one can protects for generic single qubit errors.
Indeed, consider the situation of a single qubit initially prepared in the state |ψ⟩. Suppose it is coupled to
the surrounding enviroment, whose state is initially |e⟩, and that the latter entangles with the system. Such a
transformation is described as

|ψ⟩ |e⟩ → c0 1̂ |ψ⟩ |e0 ⟩ + c1 σ̂x |ψ⟩ |e1 ⟩ + c2 σ̂y |ψ⟩ |e2 ⟩ + c3 σ̂z |ψ⟩ |e3 ⟩ , (4.25)

where ci are suitable constants, and |ei ⟩ are states of the environment. Then, the state of the system is trans-
formed via the application of the four Pauli operators. Here, σ̂0 = 1̂ does not imply any change in the state, so
no error needs to be corrected. The errors due to σ̂x and σ̂z are respectively corrected via bit-flip and phase-flip
QEC codes. It remains that due to σ̂y . However, one can notice that, since the Pauli matrices form a Lie algebra,
one can express σ̂y in terms of σ̂x and σ̂z . Namely, σ̂y = iσ̂x σ̂z . Then, one needs only to correct two consecutive
errors (phase-flip and then bit-flip) to correct a bit-phase flip. The following QEC code is sufficient to perform
such a correction.
The encoding of the 9-qubit Shore code is given by
1
|0⟩ → |0L ⟩ = √ (|000⟩ + |111⟩) (|000⟩ + |111⟩) (|000⟩ + |111⟩) ,
8
(4.26)
1
|1⟩ → |1L ⟩ = √ (|000⟩ − |111⟩) (|000⟩ − |111⟩) (|000⟩ − |111⟩) .
8
4.1 Quantum Error Correction 39

This implies the following encoding for a generic state |ψ⟩

α β
|ψ⟩ → √ (|000⟩ + |111⟩) (|000⟩ + |111⟩) (|000⟩ + |111⟩) + √ (|000⟩ − |111⟩) (|000⟩ − |111⟩) (|000⟩ − |111⟩) .
8 8
(4.27)
The encoding is implemented via the following circuit

|ψ⟩ H

|0⟩

|0⟩

|0⟩ H

|0⟩ (4.28)

|0⟩

|0⟩ H

|0⟩

|0⟩

The action of the first two CNOT gates and three Hadamard in Eq. (4.28) is to map the qubits 1, 4 and 7
as follows:
|ψ00⟩ = α |000⟩ + β |100⟩ ,
→ α |000⟩ + β |110⟩ ,
(4.29)
→ α |000⟩ + β |111⟩ ,
→ α |+ + +⟩ + β |− − −⟩ .
Namely, they perform the encoding for the phase-flip QEC code:

|0⟩ → |+ + +⟩ ,
(4.30)
|1⟩ → |− − −⟩ .

Then, every |+⟩ and |−⟩ state in these qubits is further encoded with the last CNOT gates. Specifically, one has
1
|+00⟩ = √ (|000⟩ + |100⟩) ,
2
1
→ √ (|000⟩ + |110⟩) , (4.31)
2
1
→ √ (|000⟩ + |111⟩) ,
2
and
40 4 Quantum Error Correction

1
|−00⟩ = √ (|000⟩ − |100⟩) ,
2
1
→ √ (|000⟩ − |110⟩) , (4.32)
2
1
→ √ (|000⟩ − |111⟩) .
2
These, effectively perform the encoding for the bit-flip QEC code. Such an encoding combines the phase-flip
and the bit-flip encoding.
To extract the error syndrome, one employs a collective measurement, similarly as for the bit-flip. In partic-
ular, 8 ancillary qubits are employed to construct the following circuit

H H

H H

H H
d0
|0⟩
d1
|0⟩

H H

H H

H H
d2
|0⟩ (4.33)
d3
|0⟩

H H

H H

H H
d4
|0⟩
d5
|0⟩
d6
|0⟩
d7
|0⟩
4.1 Quantum Error Correction 41

Here, the outcomes (d0 , d1 ), (d2 , d3 ) and (d4 , d5 ) respectively indicate bit-flip errors within the first, second
and third block of three physical qubits. Specifically, for the first block, one employs exactly what described in
Sec. 4.1.3.
The outcomes (d6 , d7 ) are instead used to detect phase-flip errors of the logical state encoded with the three
blocks. The collective measurements to do this are

σ̂x(1) σ̂x(2) σ̂x(3) σ̂x(4) σ̂x(5) σ̂x(6) ,


(4.34)
σ̂x(1) σ̂x(2) σ̂x(3) σ̂x(7) σ̂x(8) σ̂x(9) ,

which provide d6 and d7 respectively. If one gets, for example, (d6 = −1, d7 = −1), then a phase flip occurred
in the first block.

4.1.6 On the redundancy and threshold

As we saw, a fundamental step in the QEC codes is the redundancy of the state. Notably, there is no need in
having exactly 3 copies. It can be extended to any k copies, as long as k > 1 is an odd number. What one wants
is that the probability Pfail that the QEC code fails is smaller than the probability ϵ of an error occurring on a
single physical qubit: Pfail < ϵ.
Consider the case of k physical qubits encoding a single logical qubit. Given the probability ϵ of having an
error on one of these qubits, that of having j qubits with errors is given by

p(j) = ϵj (1 − ϵ)k−j , (4.35)

and there are  


k k!
= , (4.36)
j (k − j)!j!
different possible combinations. Then, Pfail is given by the sum over these when the faulty qubits are at least
half of the total. This is
Xk  
k j
Pfail = ϵ (1 − ϵ)k−j . (4.37)
j
(k+1)
j= 2

Namely, for k = 3, one has


3
X  
3 j
Pfail = ϵ (1 − ϵ)3−j = 3ϵ2 (1 − ϵ) + ϵ3 . (4.38)
j
(3+1)
j= 2

The behaviour of Pfail for different values of k is shown in Fig. 4.3.


However, one can consider an alternative approach. Instead of encoding a logical qubit just once in a large
number of physical qubits, one can concatenate encodings. One encodes the logical qubit in different levels,
where each level employs a small numeber of qubits. To be more explict, the following is the encoding of a single
physical qubit in a 2 level encoding with three qubits each:
first encoding second encoding
|0⟩ −−−−−−−−→ |000⟩ −−−−−−−−−−→ |000⟩ |000⟩ |000⟩ , (4.39)

and similarly for |1⟩. Now, with this encoding, the actual physical qubit is that in the highest level of encoding,
and this is that directly suffering from the noise. Suppose there is a probability ϵ that an error occurs on this
physical qubit. Then, at the level 1, the probability of failing, for example for the bit-flip QEC code, is

Pfail,1 = 3ϵ2 − 2ϵ3 . (4.40)


42 4 Quantum Error Correction

1.0

0.8

0.6

Pfail
0.4 ϵ k=3
k=7
0.2 k=11
k=15
k=19
0.0
0.0 0.2 0.4 0.6 0.8 1.0
ϵ
Fig. 4.3: Probability of failing Pfail for the single bit channel (dashed red line) with respect to a redundant
encoding with k physical qubits (continuous lines).

This quantity is the probability that the noise corrupts a qubit at the level 1. Thus, when computing the
probability of failing for the qubit at level 0, the actual logical qubit, Pfail,1 needs to be interpreted as the
probability ϵ1 that an error occurs on the qubit at the level 1. Then, at level 0, one has that the failing
probability is
2 3
Pfail,0 = 3Pfail,1 − 2Pfail,1 ,
= 3[3ϵ2 − 2ϵ3 ]2 − 2[3ϵ2 − 2ϵ3 ]3 , (4.41)
4 5 6 7 8 9
= 27ϵ − 36ϵ − 42ϵ + 108ϵ − 72ϵ + 16ϵ .
The question is then which is the best encoding. Figure 4.4 compares the failing probabilities Pfail for a single
level encoding with 9 physical qubits (blue line), where Eq. (4.37) gives

Pfail = 126ϵ5 − 420ϵ6 + 540ϵ7 − 315ϵ8 + 70ϵ9 , (4.42)

and that for a 2 level encoding each with 3 qubits (red line). This is a fair comparison, as both the approaches
are employing the same number of physical qubits, i.e. n = 9.
To keep the discussion more general, suppose p is the probability of failing for a qubit with no encoding (this
is what we called ϵ until now). Then, the failing probability is
(0)
Pfail = p. (4.43)

Suppose that after one encoding the failing probability is


(1)
Pfail = cp2 , (4.44)

where c is some suitable constant. In the case of the 3-qubit encoding, one had

Pfail = 3p2 − 2p3 ∼ 3p2 , (4.45)

for small values of p. After 2 encodings, one has

(2) 1 2
Pfail = c(cp2 )2 = (cp)2 . (4.46)
c
After k encodings, one has
4.1 Quantum Error Correction 43

10-5

Pfail
10-8

0.00 0.02 0.04 0.06 0.08 0.10


ϵ
Fig. 4.4: Comparison of the failing probabilities Pfail for a single level encoding with 9 physical qubits (blue
line) and that for a 2 level encoding each with 3 qubits (red line).

 2k
(k) p
Pfail = pth , (4.47)
pth
where we defined the threshold probability as
1
pth =
. (4.48)
c
Such a probability depends on varius parameters, among which the QEC code used, the physical components,
the experimental implementation of the QEC protocol etc.
The threshold probability pth is fundamental due to the following theorem.

Theorem 4.1 (Threshold theorem). If a threshold probability pth exists, then it is always possible to correct
errors at a faster than they are created. It is sufficient to increase the level k of encoding.
Proof. The proof is trivial. As long as the the occurrence of an error on the physical qubit p = ϵ is smaller
than the threshold probability pth , then the ratio
p
< 1, (4.49)
pth
and thus the quantity
 2k
p
, (4.50)
pth
can be made suitably small by simply increasing k.

The beauty of the threshold theorem is its simplicity. However, it also highlights a non-trivial problem, which
is the necessity of employing a very large number of physical qubits. It naturally follows the question: How
many physical qubits are necessary to quantum error correcting a faulty circuit?
Suppose we have N components (this is the number of qubits times the number of gates). Suppose for each
of these components one needs R physical qubit accounting for QEC at the 1 level of encoding. Then, after k
levels of encoding there is a total of N Rk qubits. Suppose we want that the entire circuit works with a failing
probability Pfail, circuit < ϵ, where ϵ is a given probability. Then, per component, we have
 2k
p ϵ
Pfail = pth < . (4.51)
pth N
44 4 Quantum Error Correction

The question is then how many levels k of encoding are necessary? Or equivalently, how many physical qubits
Rk per components are required? From the previous expression we obtain
 
log2 N pϵ th
2k ∼   , (4.52)
log2 ppth

which implies
   log2 R
N pth
log2 ϵ
Rk ∼     . (4.53)
pth
log2 p

Thus, the size of the full circuit scales as


 
k N pth
N R ∼ poly log . (4.54)
ϵ

This is the quantitative result of the threshold theorem.

4.1.7 More layers of encoding or only more qubits

Until now, we worked under the assumption of having only noises that act independently on the physical qubits.
Let us suppose now a different kind of noise map, that correlates the noise on different qubits. Specifically, we
consider a Kraus map acting on N qubits, that reads

1 Xh N i
T [ρ̂] = (1 − p)ρ̂ + pσ̂x(i) σ̂x(j) ρ̂σ̂x(j) σ̂x(i) , (4.55)
N (N − 1)
i̸=j

where there is a probability p that the noise acts on the qubits and the prefactor is required to properly nor-
malise the state.

First of all, let us introduce a graphical notation. Suppose we have three physical qubits, and the noise has
acted on the first and second. Then, we denote this with the following scheme

X
Before the noise After the noise X (4.56)

Now, suppose we are performing the encoding with N = 3 qubits and k = 1 layer of encoding. If there are
no errors — this happens with probability (1 − p) — then physical qubits are

and correspond to a logical qubit (4.57)

which is untouched by the noise. If there is one error, which corresponds to two qubits being affected with a
probability p, then the physical qubits are in one of the following three states

X X
X X X
X X (4.58)

that correspond to a logical qubit that is affected to the noise. Here, we denote decodings with horizontal arrows.
Thus, the protocol fails. These states contribute to the failing probability:
4.1 Quantum Error Correction 45

Pfail ∼ 3p, (4.59)

where the factor 3 is given by the number of equivalent states at the physical level, namely those represented
graphically in the left side of Eq. (4.58).
If there are two errors, which is a process involving a probability p2 and four qubits, one has the following 9
states:
X X X X X X X X X X X X
X X X X X X X X X X X X
X X X X X X X X X X X X (4.60)
which correspond to

X X X X
X X X X
X X X X

X X X X X X (4.61)

as the application of an bit-flip error twice on the same qubit correspond to not having an error, i.e. σ̂x2 = 1̂.
In such a case, only some combination are faulty, while in others the errors have cancelled. Here, we denote
equivalence with vertical arrows. These states will contribute to Pfail with +6p2 . Thus, one gets

Pfail = 3p + 6p2 + · · · ∼ 3p, (4.62)

where the . . . indicate higher order errors. Nevertheless, is the lowest order term in p that is the most significant,
under the hypothesis of small error probabilities.

Consider now a double encoding k = 2 with a total of N = 32 = 9 qubits. In case of no errors, prob = (1 − p),
we have
layer 2 layer 1 layer 0

(4.63)
9

which do not contribute to Pfail . If there is one error, prob = p, we have 2 = 36 states. Some states display
two affected physical qubits in different layer-1 logical qubit,

layer 2 layer 1 layer 0


X

X
(4.64)

Some have two physical qubits in the same layer-1 logical qubit. Thus, the corresponding layer-1 logical qubit
fails, but the layer-0 logical qubit is still protected
46 4 Quantum Error Correction

layer 2 layer 1 layer 0


X
X
X

(4.65)

This is the worst-case scenario with one error. If there are two errors, prob = p2 , the states that are relevant are
those that have 2 layer-1 logical qubits affected. Namely, they reproduce the same graph as that in Eq. (4.58).
For example, of the form
layer 2 layer 1 layer 0
X
X
X
X

X X
X (4.66)
At the layer-1, this correspond to a probability being 3p. For each of the layer-1 affected logical qubits, one
needs 2 layer-2 affected physical qubits, with associated a probability 3p. Thus, one has

Pfail = (3p)2 + · · · ∼ 9p2 . (4.67)

With generic k layers of encoding, one has

Pfail = (3p)k + . . . , (4.68)

which is graphically represented in Fig. 4.5, where the lines are listed at increasing values of k and condense
towards the value of pth = 1/3.

1.0

0.8

0.6
Pfail

0.4
k
0.2
pth
0.0
0.0 0.2 0.4 0.6 0.8 1.0
p
Fig. 4.5: Comparison of the failing probabilities Pfail for different k layers of encoding with 3 qubits each. The
arrow indicates the direction of increasing values of k, while the vertical black line indicates the threshold
probability pth .
4.2 Stabiliser formalism 47

Let us now consider the alternative. Instead of taking a large number of layers of encoding with just a few
qubits per layer, we consider a large number of qubits on a single encoding layer.
For N = 3, a single error, i.e. having two physical qubits affected, is sufficient to make the encoding fail:

No error 1 error
X
X
X (4.69)

where there are three different combinations (see Eq. (4.58)) that count. Thus, we have

Pfail ∼ 3p (4.70)

For N = 5, one requires two errors, with four qubits affected, to make the encoding fail. Indeed,

No error 1 error 2 errors


X X
X X X
X
X (4.71)

In such a case, the failing probability is given by


  
1 5 3 2
Pfail = p + · · · ∼ 15p2 , (4.72)
2 2 2

where the first binomial chooses 2 qubits to affect among the available 5, the second binomial chooses 2 qubits
among the remaining 3. The factor one-half acconts for the simmetry between the first error and the second
one, i.e. between the first couple of affected qubits and the second one.
Also for N = 7, one requires 2 errors, i.e. four affected qubits. Indeed

No error 1 error 2 errors


X X
X X
X X
X
(4.73)

In such a case, we get   


1 7 5 2
Pfail = p + · · · ∼ 105p2 . (4.74)
2 2 2
Figure 4.6 compares failing probabilities of the encodings with different values of N . As one can see the knee of
the curves moves towards zero, meaning that the threshold does not exist.

Thus, for the error defined in Eq. (4.55), employing several layers of encoding can allow for a fault-tolerant
quantum computing, while employing only a single layer encoding with more qubits has strong limits.

4.2 Stabiliser formalism

The stabiliser formalism exploits the fact that there exist operations, namely stabilisers, that can be used to
detect errors without changing the state of the logical qubit. While the single stabiliser can only tell if there
48 4 Quantum Error Correction

1.0

0.8

0.6
Pfail pth
0.4

0.2
N
0.0
0.0 0.2 0.4 0.6 0.8 1.0
p
Fig. 4.6: Comparison of the failing probabilities Pfail for different values N of the qubits with a single layer
of encoding. The arrow indicates the direction of increasing values of N , while the vertical black dashed lines
indicate how the curves cannot define a threshold probability.

was an error, without establishing which error, a specific set of stabilisers can identify the specific errors that
occurred, and thus providing the information to correct it.

4.2.1 Inverting quantum channels

The following scheme summarises the QEC philosophy. Given a qubit, this is encoded in a logical qubit made
of a set of physical qubits. The interaction with the surrounding environment (or other faulty components of
the physical circuit) leads to errors in the state. The action of these errors can be described in terms of a CPTP
map. The QEC code applies a recovery CPTP map, which — up to a certain probability — gives back the same
initial state, as there were no errors, cf. Fig. 4.7.

Encoded Noises Faulty QEC Corrected


information CPTP map information Recovery information
CPTP map

Fig. 4.7: Schematic representation of the QEC scheme, where a recovery CPTP map is applied to recover the
information as there were no errors.

The question is: when is this possible?

Consider two CPTP maps E and R, which describe respectively the occurrence of environmental errors and
the recovery map. Their action is
E R
B(H) −→ B(H′ ) −→ B(H′′ ), (4.75)
where B(H) is the space of all the linear operators acting on H. We want to have no effects of the errors,
i.e. R ◦ E = id.
4.2 Stabiliser formalism 49

Now, we show that the following two statements are equivalent:


1) Given a CPTP map E, it exists another CPTP map R such that R ◦ E = id.
2) For any Kraus representation of E, which is defined through the set of Kraus operators Êi , then one has that

Êi† Êj = µij 1̂, (4.76)

where µij ∈ C are the coefficients of the density matrix of the environment imposing the map E. Namely,
X
µ̂ = µij |ei ⟩ ⟨ej | . (4.77)
ij

First, we prove that 1) implies 2). Consider |ψ⟩ ∈ H, to which we apply the map E. This gives
E
X
|ψ⟩ −
→ Êj |ψ⟩ |ej ⟩ , (4.78)
j

where |ej ⟩ is the state of the environment with which the system is entangling. Now, we apply the map R:
R
X
−→ R̂k Êj |ψ⟩ |ej ⟩ |ak ⟩ , (4.79)
jk

where |ak ⟩ is the state of an ancilla, whose interaction defines the map R. Since we want that the map R works
as a recovery map for the map E, we have to impose that
X
R̂k Êj |ψ⟩ |ej ⟩ |ak ⟩ = |ψ⟩ ⊗ (. . . ), (4.80)
jk

where (. . . ) is a suitable state of the environment and the ancilla. In this way, the entanglement between the
system and the environment is transferred to the environment and the ancilla, with no correlation to the state
of the system. This is possible only if
R̂k Êj = αkj 1̂. (4.81)
P
In such a case, one has that (. . . ) = jk αkj |ej ⟩ |ak ⟩ and
X
Êi† Êj = Êi† R̂k† R̂k Êj ,
k
X (4.82)

= αki αkj 1̂,
k

where we used that X


R̂k† R̂k = 1̂. (4.83)
k

Then, we can define X



µij = αki αkj . (4.84)
k

Notably, we have that µ∗ji = µij , indeed

µ∗ji 1̂ = (µij 1̂)† = (Êi† Êj )† = Êj† Êi = µij 1̂. (4.85)

Moreover, we have that X X


µii 1̂ = Êi† Êi = 1̂, (4.86)
i i
50 4 Quantum Error Correction

and that
µii 1̂ = Êi† Êi , (4.87)
is a positive operator, which implies that µii > 0. Thus, { µij }ij have all the properties to be the coefficients of
a density matrix, and this proves that 1) implies 2).
We now prove that 2) implies 1). We start from

Êi† Êj = µij 1̂, (4.88)

and we diagonalise µij . This implies a change the Kraus operators according to Êi → F̂i such that

F̂i† F̂j = δij pi 1̂, (4.89)

where pi > 0 by definition. We then introduce the isometries V̂i that are related to F̂i via

F̂i = pi V̂i . (4.90)

Then, as represented in Fig. 4.8, the map E is mapping H to different subspaces H′i of H′ . Each of these

𝑝!𝑉"!
ℍ ℍ’
ℍ!
𝑝"𝑉""
ℍ"

𝑝#𝑉"# ℍ#

𝑝$𝑉"$
ℍ$

Fig. 4.8: Graphical representation of the mapping between H and H′ .

mapping is performed with a probability pi by the operator V̂i ∝ F̂i . Notably, since we diagonalised µij , the
different operators V̂i are orthogonal, and thus are also the subspaces H′i . Now, given this set of isometries, we
can construct the recovery Kraus operators as
R̂i = V̂i† , (4.91)
which will act only on the corresponding subspace H′i , leaving the rest of Hilbert space H′ untouched: indeed,
for i ̸= j we have V̂j† Fj ∝ V̂j† Vj = 0. Finally, we compose the maps E and R:

E
X
ρ̂ −
→E(ρ̂) = pi V̂i ρ̂V̂i† ,
i
!
R
X X
−→ R(E(ρ̂)) = V̂j† pi V̂i ρ̂V̂i† V̂j ,
j i (4.92)
X
= pi V̂j† V̂i ρ̂V̂i† V̂j ,
ij
X
= pi ρ̂ = ρ̂,
i
4.2 Stabiliser formalism 51

where we used that V̂j† V̂i = δij 1̂.

4.2.2 Correctable errors

The generic scheme for QEC is the following. We are given k qubits in an unknown state |ψ⟩ ∈ H. We encode
|ψ⟩ in a larger number n > k of qubits. These n qubits are subject to errors, which are described in terms of
a Kraus map E with the Kraus operators being Êi or equivalently V̂i , see Eq. (4.90). The recovery protocol
employs some extra n′ ancillary qubits to apply the QEC, which inverts the error Kraus map under certain
conditions.
After the encoding, the relevant state will be |ψ ′ ⟩ ∈ HC , which is a subspace of H′ and it is called code space.
In particular, the entire Hilbert space H′ is the union of the code space HC with the ⊗i H′i . Here, the basis of
each H′i is obtained by applying the corresponding V̂i to the basis of HC . Under this perspective, one can say
that also the basis of HC is generated in the same way, where the corresponding error operator is V̂C = 1̂. Now,
since the subspace H′i so constructed is orthogonal to HC , then the error can be recovered. What is needed is
a error syndrome measurement that identifies the subspace H′i in which the state |ψ ′ ⟩ has been mapped. Given
such a measurement, one can apply the corresponding Kraus recovery operator. This is graphically represented
in Fig. 4.9

ℍ 𝑉!! ℍ’
Encoding ℍ! 𝑉!"
ℍ" ℍ#

ℍ$ ℍ% ℍ&

ℍ' ℍ( ℍ…
Fig. 4.9: Graphical representation of the division of the Hilbert space H′ in the code space H and error spaces
Hi , which are linked by the operators V̂i .

One can invert the error map if the corresponding operators Êi satisfy

P̂ Êi† Êj P̂ = µij P̂ , (4.93)

where P̂ is a projector on the code space HC .


Notably, P̂ acts as an identity operator if restricted on HC . This also implies that there exists a special set
of Kraus operators, which allow to rewrite the error map, and thus also the recovery map, as a mixture of
isometries. These are induced by a set of unitary operators Ûi on the code space:

V̂i = Ûi P̂ , (4.94)

such that
P̂ Ûi† Ûj P̂ = δij P̂ . (4.95)
52 4 Quantum Error Correction

Then, one can map the state V̂i |ψ ′ ⟩ back to HC by selecting the corresponding recovery Kraus operator R̂i = V̂i† .
An important note is the following. Let be R the recovery map for E. Then, one has
X
E(ρ̂) = Êi ρ̂Êi† ,
i
X (4.96)
R(ρ̂) = R̂k ρ̂R̂k† ,
k

such that R̂k Êi = αki 1̂. We define the map D as


X
D(ρ̂) = D̂i ρ̂D̂i† , (4.97)
i
P
with D̂i appertaining to the span of { Êi }i , i.e. D̂i = j cij Êj . Then, the map D can be recovered with the
same recovery map R.
Consider the case of n qubits . We want to construct the recovery map for errors due to the application of
⊗n
the Pauli operators. These are { 1̂, σ̂x , σ̂y , σ̂z } , and they form the basis of B(H⊗n ). The operator 1̂ is the
identity, so is not associated to any error. The operator σ̂y = iσ̂x σ̂z . So, one needs to construct the recovery
map R that corrects only errors due to σ̂x and σ̂z . Now, for every Pauli operator different from the identity, we
have two important properties: Tr [σ̂i ] = 0 and σ̂i2 = 1̂. They imply that their eigenvalues are ±1. Thus, one can
divide the full Hilbert space H′ = H, with dim(H) = 2n , in two subspaces (of the same dimension), which are
associated to the corresponding eigeinvalues, see Fig. 4.10. Namely, given σ̂i we have Hσi =1 and Hσi =−1 , with
dim(Hi ) = 2n−1 , whose union gives H′ . Suppose the code space HC is defined in terms of the operators Ê1 and
Ê2 as it follows: ∀ |ψ⟩ ∈ HC , one has

Ê1 |ψ⟩ = +1 |ψ⟩ , and Ê2 |ψ⟩ = +1 |ψ⟩ . (4.98)

Any other combination identifies an error subspace H′i .

𝐸!! ℍ’
+1 −1
(+1, +1) (−1, +1)

ℍ! ℍ" +1
(+1, −1) (−1, −1) −1
𝐸!"

ℍ# ℍ$

Fig. 4.10: Division of the Hilbert space H′ with respect to the subspaces defined by the eigeinvalues of Ê1 and
Ê2 .

More in general, given the operators in B(H), they are part of one of the following families:
- They specify the subspaces we are going to divide H′ .
4.2 Stabiliser formalism 53

- They are responsible for errors. So they describe how a state moves from HC to H′i .
- They are responsible for logical operations within the individual subspaces HC and Hi .

4.2.3 Stabilisers

For n qubits, one has 4 × 4n Pauli operators. The first factor 4 accounts for the four relevant phases
{ +1, −1, +i, −i }, while the rest count the operators being the basis of the operators acting on a 2n dimensional
space. We define as stabilisers the elements of an abelian subgroup which is responsible of the division of H′ in
subspaces. Namely, there will be one code space HC and the other are the error spaces.

Example 4.1
Consider the case of n = 3. The stabilisers are

(Stabilisers for n = 3) = { 1̂1̂1̂, σ̂z σ̂z 1̂, 1̂σ̂z σ̂z , σ̂z 1̂σ̂z } . (4.99)

Consider σ̂z σ̂z 1̂. It determines the parity of the first and the second qubit. Thus, it divides the Hilbert space
H′ in two parts, one associated to its +1 eigeinvalue and to its −1 eigeinvalue:

+1 −1
|000⟩ |100⟩
|111⟩ |011⟩ (4.100)
|001⟩ |010⟩
|110⟩ |101⟩

A similar division can be done considering the operator 1̂σ̂z σ̂z , for which we have

+1 −1
|000⟩ |001⟩
|111⟩ |110⟩ (4.101)
|100⟩ |010⟩
|011⟩ |101⟩

We notice that there are no other possible partitions of H′ . Indeed, the last non-trivial stabilisers is σ̂z 1̂σ̂z
can be expressed as the product of the other two:

σ̂z 1̂σ̂z = (σ̂z 1̂σ̂z )(σ̂z σ̂z 1̂). (4.102)

To be specific, the operators σ̂z 1̂σ̂z and σ̂z σ̂z 1̂ are the generators of the abelian subgroup of the stabilisers.
Now, we can define the code space HC as that associated to the +1 eigeinvalues for all the stabilisers.
Namely, this is the subspace of H′ which is spanned by the +1 eigeinstates of all the generators of the
abelian subgroup:
HC = span(|000⟩ , |111⟩). (4.103)
The partitioning of H′ is represented graphically in Fig. 4.11.

Now, consider Êi being one of the 4 × 4n Pauli operators not being one of the stabilisers Sk . Now, since it
is constructed as the product of single qubit Pauli operators, Êi can only commute or anticommute with the
stabilisers Sk .
h i
• Assume that it commutes: Êi , Ŝk = 0. Then, we have that for any |ψ⟩ ∈ HC , it holds
54 4 Quantum Error Correction

𝑍! 𝑍! 𝐼! ℍ’
+1 −1
000 100
|111⟩ |011⟩

ℍ! ℍ" +1
001 010
𝐼!𝑍! 𝑍!
−1
|110⟩ |101⟩

ℍ# ℍ$

Fig. 4.11: Division of the Hilbert space H′ with respect to the subspaces defined by the eigeinvalues of σ̂z σ̂z 1̂
and 1̂σ̂z σ̂z .

Ŝk Êi |ψ⟩ = Êi Ŝk |ψ⟩ = Êi |ψ⟩ , (4.104)

where the last equality follows from the fact that Sk is a stabiliser and thus acts as an identity on HC . Then, if
Êi commutes stabiliser Ŝk , it is associated to the eigeinvalue +1 of the latter. Indeed, the state |ϕi ⟩ = Êi |ψ⟩
is associated to the +1 eigeinvalue n of Ŝko.
• Conversely, if it anticommutes: Êi , Ŝk = 0, then

Ŝk Êi |ψ⟩ = −Êi Ŝk |ψ⟩ = −Êi |ψ⟩ . (4.105)

In such a case, one says that Êi is associated to the -1 eigeinvalue of Sk .

Example 4.2
In the case of n = 3 one has that the operators σ̂x 1̂1̂ and σ̂x σ̂x σ̂x are associated to the eigenvalues of σ̂z σ̂z 1̂
and 1̂σ̂z σ̂z as
σ̂z σ̂z 1̂ 1̂σ̂z σ̂z
σ̂x 1̂1̂ −1 +1 (4.106)
σ̂x σ̂x σ̂x +1 +1
Now, σ̂x σ̂x σ̂x commutes with both the (generators of the subgroup of ) stabilisers. Thus, it means that if

|ψ⟩ ∈ HC , then σ̂x σ̂x σ̂x |ψ⟩ ∈ HC . (4.107)

Namely, it is a normaliser (see below) and it acts as a logical σ̂x .


Conversely, σ̂x 1̂1̂ anticommutes with σ̂z σ̂z 1̂. This means that given a state

|ψ⟩ ∈ HC , then σ̂x 1̂1̂ |ψ⟩ ∈ H′1 ∪ H′3 , (4.108)

where H′1 and H′3 are respectively associated to the eigeinvalues (−1, +1) and (−1, −1) of (σ̂z σ̂z 1̂, 1̂σ̂z σ̂z ).
However, since σ̂x 1̂1̂ commutes with 1̂σ̂z σ̂z , then σ̂x 1̂1̂ |ψ⟩ ∈ H′1 .
Namely, the operator σ̂x 1̂1̂ is one of the V̂i errors that maps the states from the code space to the
corresponding H′i .
4.2 Stabiliser formalism 55

If we have k qubits that are encoded in n qubits, with n > k, then we need (n − k) generators from the
stabilisers to define the partitions. By starting with dim(H′ ) = 2n , since each generator divides the Hilbert space
in two parts, we have 2n−k different subspaces of dimension 2k .

4.2.4 Normalisers and Centralisers

There are Pauli operators that commute with all the elements of the stabilisers, but do not appartain to the
stabilisers subgroup. These are the normalisers N̂k . They respect the partition of H, meaning that they do not
map states from the code space HC to an error space H′i , and act non-trivially in the code space. They are
defined via
N̂k Ŝi N̂k† = Ŝj , (4.109)
where Ŝi are the stabilisers. If i = j they are called centralisers, while for i ̸= j they are normalisers. In the
particular case of the Pauli algebra, meaning that all the operators are generated by the product of Pauli
operators, one has that the normalisers are centralisers. Indeed,

N̂k Ŝi N̂k† = ±N̂k N̂k† Ŝi = ±Ŝi , (4.110)

since Pauli operators can only commute or anticommute. However, given the stabilisers Ŝi , the operator −Ŝi
does not stabilise the code space. Thus, the − sign cannot be accepted and one gets

N̂k Ŝi N̂k† = Ŝi = Ŝj . (4.111)

Thus, they are all centralisers.

Example 4.3
Consider the case of n = 3. The operator σ̂x σ̂x σ̂x acts as follows:

x σ̂
|000⟩ −→ |111⟩ ,
(4.112)
x σ̂
|111⟩ −→ |000⟩ .

Thus, it acts as a logical σ̂x . The same happens for σ̂x σ̂x σ̂x Ŝk for any stabiliser Ŝk . Indeed, for |ψ⟩ ∈ HC ,
we have that
σ̂x σ̂x σ̂x Ŝk |ψ⟩ = σ̂x σ̂x σ̂x |ψ⟩ , (4.113)
since Ŝk acts as a logical identity on HC . Suppose we take the stabiliser Ŝk = σ̂z σ̂z 1̂, then

(σ̂x σ̂x σ̂x )(σ̂z σ̂z 1̂) = −σ̂y σ̂y σ̂x , (4.114)

which also acts as a logical σ̂x .


The normalisers contain σ̂x σ̂x σ̂x , −σ̂y σ̂y σ̂y , σ̂z σ̂z σ̂z , and all the products of these with all the stabilisers
Ŝk , which act as a logical identity.
56 4 Quantum Error Correction

Physical operation Logical operation


1̂1̂1̂ 1̂
σ̂z σ̂z 1̂ 1̂
σ̂z 1̂σ̂z 1̂
1̂σ̂z σ̂z 1̂
σ̂x σ̂x σ̂x σ̂x (4.115)
σ̂x σ̂x σ̂x Ŝk σ̂x
−σ̂y σ̂y σ̂y σ̂y
−σ̂y σ̂y σ̂y Ŝk σ̂y
σ̂z σ̂z σ̂z σ̂z
σ̂z σ̂z σ̂z Ŝk σ̂z

4.2.5 Stabiliser code

Consider the three qubits encoding a single logical qubit. The stabilisers are:

1̂1̂1̂, σ̂z σ̂z 1̂, σ̂z 1̂σ̂z , 1̂σ̂z σ̂z . (4.116)

Among the possible errors, there are some that are more and less likely to occur. Under the assumption of errors
that act independently on the qubits, the error 1̂σ̂x 1̂ is more likely to occur than σ̂x σ̂x σ̂x . The first has weight
1 (only one operator different from the identity), while the second has weight 3.
Now, the question is which are the errors that can be corrected, and eventually how they can be corrected.
As we already saw, the errors where only one of the qubits is modified can be corrected (see bit-flip, phase-flip
and 9-qubit Shor QEC codes). These can be corrected via the application of the recovery operator R̂k = V̂k† , so
that
R̂k V̂k = V̂k† V̂k = 1̂. (4.117)
However, the operator R̂k can correct for a much wider class of operators. Indeed, given a state |ψ⟩ ∈ HC and
a stabiliser Ŝi , one has
R̂k (V̂k Ŝi ) |ψ⟩ = R̂k V̂k |ψ⟩ = |ψ⟩ . (4.118)
Thus, R̂k can correct also errors of the form of a correctable error multiplied by a stabiliser, i.e. V̂k Ŝi .
Conversely, an error in the class of normalisers which is not a stabiliser is a non-correctable error. Indeed, it
acts non-trivially on the code space.

4.3 Surface code

The surface code is a QEC code that is related to topology. The idea is that a logical qubit is encoded in L × L
physical qubits as in the layout presented in Fig. 4.12. The array they construct has to be considered with
periodic boundary conditions. The L2 qubits are divided in two classes:
• Half of the physical qubits are used as data qubits: they store quantum states |ψL ⟩ that will be used for
computation. They are represented with open circles .
• Half of the physical qubits are called measurement qubits and they are employed as error detecting qubits.
They are represented with full circles . There are two type of measurement qubits:
– Measure Z or Z-syndrome qubits, which are represented in green,
– Measure X or X-syndrome qubits, which are represented in yellow.
SciPost Phys. Lect. Notes 49 (2022)

4.3 Surface code 57

SciPost Phys. Lect. Notes 4


(a) Z Z Z Z Z Z Z Z
X X X X
SciPostZ Phys. Lect. Notes 49 (20
Z
Z Z Z Z X Z X
X X X X X X X X X X
X Z X Z X Z X Z X Z X
(a) ZZ Z Z
Z Z Z ZZ Z Z ZZ Z Z Z Z
ZZ Z
(a) X Z XZ Z ZX Z X Z Z XZ Z ZX ZX Z ZZ X ZX Z Z Z X XZ Z X
X X Z XX X X Z X X X XX
ZX
X XX X X X XX X X X
Z Z X X
X
X Z X ZX X X X ZX XX Z XZ X XX Z X
X Z XZ Z X XX Z X
X
X Z Z ZZ X ZZ Z Z X ZZ Z ZZ XZ Z ZZ Z X Z Z Z Z
Z X Z
X XZ X Z XZ Z X Z XZ Z X X Z
Z Z Z Z X Z Z X Z Z Z X Z Z Z X
X X
X X
X X
X X X X X X X X X X X X
XX Z X
X
Z
X
X X Z XX Z X Z X X
XZ Z Z
X Z ZX Z ZX X Z Z X X Z X
X X X X X X X X Z X Z X
Z Z Z Z Z Z Z Z
X Z Z X Z Z Z X Z Z Z X Z Z Z X Z Z Z X Z
Z X Z Z Z X 2 Z Z1 Z X Z Z Z X Z Z Z X Z Z
2 qubits
3 4(full
5 and
X
6 7open8 circles) in the array generating the
Fig. 4.12: Graphical representation
X of
X the L X physical X X X
(b)
surface code X theirZinteraction
through a X (greenZ andXyellow
I
X Z X
g Xconnections). - Z+ I X X Z X X X
X X
X X Z X X Z X X Z X X X Z X X X Z X
Z Z a
X Z X Z Z Z X Z Z Z X Z Z Z X Z Z Z X Z
Each data qubit is b Z toZtwocX-syndrome
coupled b and two Z-syndrome qubits. Each +1 : Z+ qubit is coupled
measurement
to four data qubits. TheseZcouplings are describe as the following. For the green block, i.e. Zthe Z-syndrome, we
Z Z Z Z Z Z Z Z Z
have
c 1 2 3 4 5 6 7 18: Z-
d d
(b) a g4 5 6 7 8-
1 2 I3repeat + I
(b) a Z Ia g -+ I
|ψgabcdH⟩ H -+
(c) bZa Z c a= Z b +1: Z+(4.119)
X a
bb ZX ZX Zcc bb
c +1:+1 :X 1: 
+ Z+ Z-
ZX d cc ⟩ d |0  1:X-Z-
dd repeat
dd initiallised in |0⟩. Similarly, for the yellow block one has
where |0 ⟩ indicates that the qubit has been
a repeat
g repeat H -+
(c) H
(c) a X ga H H -+
bX X X c a b +1: X+
gure 20: (a) The surface b X code. X
X cData
|ψ abcd
b
= qubits

c are open circles ( ),+1: X+ X-(4.120)
measurement qubits are
ed circles (•), with measure-Z qubits X d c
colored d green and measure-Xqubits X- colored orange.
d data qubit
repeat
way from the boundaries, each d contacts four measure qubits, and each measure
|0 ⟩ H repeat H
bit contacts four data qubits; the measure qubits perform four-terminal measurements. On
e boundaries, the measure qubits contact only three data qubits and perform three-terminal
In such a way, the measurement qubits are coupled to the data qubits. These circuits are run in cycles, between
Figure 20: (a)
easurements, To The
understand surface qubits
the logic code.
of the contact
surface Data let qubits
code, either on are
two
us focus open
orcase
the three circles
has only(four
one logical operation and the following one, so to keep track of the errors that occur in between.
and the data where measure
one ),physical
qubits.measurement
The qu
qubits:solid line
re 20:circles
filled
rrounding (a)the (•data
The
2 are
),surface
array
qubits and 2code.
with measure-Z
indicates theData
are measurement
array qubits
qubits
qubits are
colored
(one in
boundary. open
X and one in circles
green ( ),sequence
and measure-X
Z). The generators
(b) Geometric measurement
of
qubits
the stabilisers are qubits
colored
of operations
circles
Away
ft), from
and •),the
(quantum
with measure-Z
boundaries,
circuit (right) qubits
each fordata colored
one qubit
surface green
codeand
contacts measure-X
four
cycle measure
for a measure-Zqubits
qubits, colored
and which
qubit, ora
each
y fromcontacts
qubit
abilizes the
Za Z bboundaries,
Zc Zfour
d . (c)data each
qubits;
Geometry data thequbit
and measure
quantum contactsqubits
circuit four a measure
forperform
measure-X qubits,
four-terminal andmeasureme
qubit, which each mea
stabilizes
Xcontacts
he bX fourtwo
c X d . The
boundaries, data
the qubits;
measure
identity the measure
I operators
qubits contact
for the qubits
only perform
three data
measure-Z four-terminal
process,qubits
which andare measurements.
perform
performed three-
by
58 4 Quantum Error Correction

(i)
the operators X̂a X̂b and Ẑa Ẑb . Here, we employ the notation Ẑi to identify the σ̂
h z Pauli operator
i acting on
the i-th physical qubit. One can easily show that these operators commute, i.e. X̂a X̂b , Ẑa Ẑb = 0, although
h i
they do not at the level of single qubit, i.e. X̂i , Ẑi ̸= 0. Thus, they have common eigeinstates, which identify
the division of the Hilbert space H′ in the code and error subspaces (for the sake of simplicity, we will drop all
the normalisation constants):
|ψ⟩ X̂a X̂b Ẑa Ẑb
|00⟩ + |11⟩ +1 +1
|00⟩ − |11⟩ −1 +1 (4.121)
|01⟩ + |10⟩ +1 −1
|01⟩ − |10⟩ −1 −1
The circuit that applies these two stabilisers is 41
X |0 ⟩ H H
(a) X X a
X a
Z = |ψab ⟩ ′
|ψab ⟩ (4.122)

b Z Z b

Z |0 ⟩
1 2 3 4 5 6 7 8
where the first qubit is the X-syndrome and the last is the Z-syndrome. Considering the generic state |ψab ⟩ for
b) X the qubits a and b being
g H H -+
|ψab ⟩ = A |00⟩ + B |01⟩ + C |10⟩ + D |11⟩ , (4.123)
a one can input this state in the circuit in Eq. (4.122) and, before the measurements, obtains that the total state
reads
b |ΨXabZ ⟩ = (A + D) |0⟩ (|00⟩ + |11⟩) |0⟩
+ (A − D) |1⟩ (|00⟩ − |11⟩) |0⟩
Z g I I - +
+ (B + C) |0⟩ (|01⟩ + |10⟩) |1⟩
(4.124)

+ (B − C) |1⟩ (|01⟩ − |10⟩) |1⟩ .


X̂a X̂bafterẐ atheẐmeasurement
It follows that, b of the X and Z-syndrome qubits, one obtains — depending on the
outcomes { MX , MZ } — the following states with the corresponding probabilities P|ψab
′ ⟩:


{ MX , MZ } |ψab ⟩ P|ψab
′ ⟩

{ +1, +1 } |00⟩ + |11⟩ |A + D|2


(4.125)
or online) (a) Two data qubits a and b are { −1, +1 }
{ +1, −1 }
|00⟩ − |11⟩ |A − D|2
|01⟩ + |10⟩ |B + C|2
ne measure-Z and one measure-X qubit, con- { −1, −1 } |01⟩ − |10⟩ |B − C|2

n. (b) Quantum circuit


After the collapse for common
on one of these the two measure
eigenstates of X̂a X̂b and Ẑa Ẑb , subsequent applications of the circuit
g on the two data qubits. The CNOT order
in Eq. (4.122) will provide always — in the assumption of no noise — the same state.

t, the measure-X
Example 4.4 qubit acts as the control of
Consider the state in Eq. (4.124) and suppose the first cycle (which acts effectively as an encoding) provides
data qubitstheameasurements
followed { MXby = −1,that
MZ = −1on} andb;|ψabthe
′ two Now, |ψab′ ⟩ is equal to |ψab⟩ in Eq. (4.123)
⟩ = |01⟩−|10⟩.
eceded andbefore
followed
when setting A = by
D = 0aand Hadamard
B = −C = 1. TheĤ. The output state at the end of the second cycle
corresponding
the measurement will be |ΨXabZ ⟩ = |1⟩ (|01⟩ − |10⟩) |1⟩. This has two important implications: 1) the
it is then the target of a CNOT with a as the
d by that with b as a control. The two identity
the measure-Z process, which are performed
ing, ensure that the timing on the measure-Z
4.3 Surface code 59

′ ′
state |ψab ⟩ remains untouched by the circuit, which is the implementation of the stabilisers: Ŝ2 Ŝ1 |ψab ⟩=

|ψab ⟩; 2) also the output of the measurement { MX = −1, MZ = −1 } remains the same.

This example shows that, without measuring directly |ψab ⟩, one can use the output of the measurements to
infer the state of the data qubits. Turning the argument upside-down, an error occuring in the data qubits will
be identified by the change in the outcomes of the measurements.
We notice that, in the case of 2 data qubits and 2 measurement qubits, one has
• 4 degrees of freedom where to encode a logical state: there are 2 physical qubits having 2 dimensions. The
total Hilbert space H′ has 2 × 2 dimensions.
• 4 constrains from the stabilisers: we have 2 stabilisers and each divides H′ in 2 subspaces.
Then, there are no free degrees of freedom where one can perform logical operations. In order to do that, one
needs to impose the length of the array of physical qubits L being an odd number > 1. In such a way, one has
2 free degrees of freedom that can be employed. The minimal array is that having L = 3 with 5 data qubits
and 4 measurement qubits. Such an array in shown in Fig. 4.13. The circuit corresponding to the stabilisers

Fig. 4.13: Graphical representation of the surface code with 5 data qubits and 4 measurement qubits.

application is given by

c

e |ψacegi ⟩ |ψacegi ⟩

b,Z |0 ⟩

d,X |0 ⟩ H H

f,X |0 ⟩ H H

h,Z |0 ⟩
(4.126)
Suppose we input the state |ψacegi ⟩ = |00000⟩. Then, the action of this circuit before the measurement is given
by
60 4 Quantum Error Correction

(|00000⟩ + |10110⟩ + |01101⟩ + |11011⟩) |0000⟩


circuit in Eq. (4.126) +(|00000⟩ − |10110⟩ + |01101⟩ − |11011⟩) |0100⟩
|00000, 0000⟩ −−−−−−−−−−−−−→ (4.127)
+(|00000⟩ − |10110⟩ − |01101⟩ + |11011⟩) |0010⟩
+(|00000⟩ − |10110⟩ − |01101⟩ + |11011⟩) |0110⟩ ,
where we expressed the states in the form |ψacegi , ϕbdf h ⟩. Suppose the measurement results in { Mb , Md , Mf , Mh } =
{ +1, +1, −1, +1 }, which corresponds to the measurement state |ϕbdf h ⟩ = |0010⟩. Then, the data state is given
by

|data⟩ = |ψacegi ⟩ = |00000⟩ − |10110⟩ − |01101⟩ + |11011⟩ , (4.128)
which remains untouched by subsequent applications of the circuit in Eq. (4.126). This is an easy but lengthy
computation if performed in terms of states. However, it becomes trivial and immediate if considering that the
circuit corresponds to the application of the stabilisers Ŝ4 Ŝ3 Ŝ2 Ŝ1 on the state |data⟩, which has been already
stabilised by the same circuit. Thus, Ŝ4 Ŝ3 Ŝ2 Ŝ1 |data⟩ = |data⟩.

4.3.1 Detecting errors

There are several kinds of errors that can be detected with surface code. For the sake of simplicity, we consider
the case of the array with 5 data and 4 measurement qubits, and that the logical state is encoded in |data⟩
shown in Eq. (4.128). The latter corresponds to the measurement state |0010⟩, i.e. to the measurement outcomes
{ Mb , Md , Mf , Mh } = { +1, +1, −1, +1 }. We construct the table of outcomes with respect to the number of
cycles that are performed. In the case of no errors and no logical operations, such table reads

# cycles Mb Md Mf Mh
1 +1 +1 −1 +1
2 +1 +1 −1 +1
3 +1 +1 −1 +1 (4.129)
4 +1 +1 −1 +1
5 +1 +1 −1 +1
.. .. .. .. ..
. . . . .

We now introduce errors, that will appear exactly at the third cycle. There are also other relevant errors,
but we only focuses on the following two kinds.
1) Errors on the measurement or on the syndrome qubits;
These are the errors due to the erroneous output of a measurement Mi , or errors that are applied to the
syndrome qubit. The latter will appear as the former. Suppose we have an error on the measurement of the
f qubit. Then, the above table becomes

# cycles Mb Md Mf Mh
1 +1 +1 −1 +1
2 +1 +1 −1 +1
3 +1 +1 +1 +1 (4.130)
4 +1 +1 −1 +1
5 +1 +1 −1 +1
.. .. .. .. ..
. . . . .

where we highlighted the difference between the two tables. The error is only momentaneous. Later appli-
cations of the cycle will erase the action of these kind of errors. Indeed, if the error is due to the random
erroneous measurement outcome, then the following cycle will (most probably) provide the exact outcome.
4.3 Surface code 61

This will not be the case if there is a systematic error in the measurement process, which cannot be corrected.
Conversely, if the error is caused by the application of an external action on the measurement qubit (say the
surrounding environment acts with Ẑ on the f qubit), then the error vanishes in the next cycle since the
qubit’s state is initialised at the beginning of each cycle.

2) Errors on the data qubits. These are the errors on the data qubits that can be, for example, due to the
surrounding environment, and that can corrupt the information encoded in the data state. It becomes then
fundamental to being able to detect and account for such errors for the sake of computation.
Suppose we have a phase-flip error on the e qubit. The state is then transformed as

′ phase-flip error on qubit e



|ψacegi ⟩ −−−−−−−−−−−−−−−−→ Ẑe |ψacegi ⟩. (4.131)

Then, the Z-syndrome qubits will be unable to detect it. However, X-syndrome qubits d and f will detect
the error: their coupling to the data qubit e imposes the action of X̂e , which do not commute with Ẑe . Then,
what happens is that the state of the X-syndrome qubits will flip. By supposing that the error occurs at the
third cycle. Then, the table of outcomes becomes

# cycles Mb Md Mf Mh
1 +1 +1 −1 +1
2 +1 +1 −1 +1
3 +1 −1 +1 +1 (4.132)
4 +1 −1 +1 +1
5 +1 −1 +1 +1
.. .. .. .. ..
. . . . .

Importantly, the outcomes Md and Mf change sign for any subsequent cycle (if no other errors or logical
operations take place). This is how one can distinguish an error on the measurement and on the data qubits.
The best way to account for this error is to employ a classical control software that will changes the sign of
every subsequent measurement of that data qubit’s two adjacent X-syndrome qubits.

When one has an array of larger dimensions, then the situation is more complicated. For example, one might
have that several data errors that form paths on the array. If this happens, the errors will be highlighted only
by two syndrome qubits at the ends of the error path. An example is shown in Fig. 4.14, where the X-syndrome
qubits a and f indicate that an error occurred. However, there is no indication about which path between a
and f the Z-errors are covering.

a A b B c

C D E

d F e G f

Fig. 4.14: Graphical representation of Z noises detected by the measurement qubits a and f . Different paths
(blue, purple and orange) can produce this error syndrome.
62 4 Quantum Error Correction

This could be one among ABE (blue path), ADG (purpkle path) or CF G (orange path). When accounting
via classical control software for the errors, one needs to select one of these paths. The question is what happens
if one selects the wrong path? The beauty of the surface code kicks in: as long as the error path and the selected
one form a closed loop, the error is well accounted. This is shown with the following argument. Suppose the error
path is ABE, which is produced by ẐA ẐB ẐE , and we select the path CF G to be corrected, whose correction
is given by ẐC ẐF ẐG . This is however not a problem, indeed we have that

(ẐA ẐB ẐE ) = (ẐC ẐF ẐG )Ŝe Ŝd , (4.133)

where we defined the stabilisers

Ŝe = ẐB ẐE ẐD ẐG , and Ŝd = ẐA ẐC ẐD ẐF . (4.134)

Therefore, the two errors are related by two stabilisers. This means, that recovery operator R̂k that corrects
ẐA ẐB ẐE can correct also for ẐC ẐF ẐG . This has been discussed in Sec. 4.2.5. Thus, every time we can form
closed loops, the error can be accounted properly. These are harmless errors.
Conversely, consider now the case shown in Fig. 4.15. Here the error path (shown in orange) crosses the
boundary of the array, and due to the periodic boundary conditions only two syndrome qubits highlight the
error path. In such a case, one would still be tempted to connect directly the syndrome qubits with a path
fully in the array (shown in purple). However, such a correction is not the proper one. Indeed, the two paths
would form a logical operation. To visualise harmless and harmful paths, one maps the array on a torus. If the

Fig. 4.15: Graphical representation of an error path that crosses the boundary of the array (orange path). If
corrected with the purple path, it leads to a logical operation, thus not correcting for the error.

path can be closed, then it is harmless. If the path cannot be closed, then it is harmful. Figure 4.16 shows the
mapping between the array and the torus, and highlights the harmless and harmful paths.

4.4 Fault-tolerant computation

Let us suppose we want to implement the following logical circuit

|0⟩ H
(4.135)
|0⟩
4.4 Fault-tolerant computation 63

Fig. 4.16: Graphical representation of the mapping of the array on a torus surface. The red path corresponds to
a logical X, while the blue path to a logical Z operation. These are harmful error. The purple path is an error
that can be corrected.

so that if an error occurs it can be successfully corrected via a QEC code. The error can essentially occur in
any of the components of the circuit. Namely,
- in the state preparation,
- in the logic quantum gates,
- in the measurement,
- in the simple transition of the quantum information along the quantum wires.
To combat the effect of the noise, one encodes the logical qubits in blocks of physical ones, using QEC codes.
However, one needs also to replace the logical operations with encoded gates. Performing QEC periodically on
the encoded states prevents the accumulation of errors in the state. However, it is not sufficient to prevent the
build-up of errors, even if QEC is applied after each encoded gate.
There are two main reasons:
1) The encoded gates can cause the propagation of errors.
Let us consider a specific example, where two qubits are connected by a CNOT gate and a X error occurs on
the control qubit before the CNOT. Then, the error propagates also to the target qubit. This can be easily
computed by considering that the CNOT is implemented by the unitary operator ÛCNOT . Then, one has

ÛCNOT σ̂x(1) = ÛCNOT σ̂x(1) ÛCNOT ÛCNOT = σ̂x(1) σ̂x(2) ÛCNOT , (4.136)

which can be graphically represented with

X X
→ (4.137)
X

Then, one needs to design the encoded gates carefully, so that errors do not propagate on the entire block,
but are limited to some physical qubits. In such a case the QEC code can remove these errors.
Performing encoded gates in such a way is a fault-tollerant (FT) procedure.
2) Also QEC can introduce errors.
An example is that graphically represented in Fig. 4.15, where an error is not correctly recovered.
To showcase the FT procedure, we introduce the Steane code.
64 4 Quantum Error Correction

4.4.1 Stean code or 7-qubit code

The Steane code is a stabiliser code employing 7 data qubit and 6 syndrome qubits for each logical qubit. The
total Hilbert space H′ has 128 dimensions that are divided in 64 subspaces of two dimensions. The graphical
representation is given in Fig. 4.17. The generators of the stabilisers are

1
𝑆!!" = 𝑋$#𝑋$" 𝑋$$ 𝑋$%
𝑆!&" = 𝑍!#𝑍!" 𝑍!$ 𝑍!%

5 3
𝑆!!' = 𝑋$'𝑋$" 𝑋$( 𝑋$%
𝑆!!# = 𝑋$)𝑋$$ 𝑋$( 𝑋$%
7 𝑆!&' = 𝑍!'𝑍!" 𝑍!( 𝑍!%
𝑆!&# = 𝑍!)𝑍!$ 𝑍!( 𝑍!%

4 2
6
Fig. 4.17: Graphical representation of the Steane code with the data qubit represented as open circles and the
corresponding stabilisers.

   

 1̂ 1̂ 1̂ X̂ X̂ X̂ X̂, 
X̂4 X̂5 X̂6 X̂7 , 

   


 1̂ X̂ X̂ 1̂ 1̂ X̂ X̂,





X̂ 2 X̂3 X̂6 X̂ 7 ,



   
6 X̂ 1̂ X̂ 1̂ X̂ 1̂ X̂, X̂1 X̂3 X̂5 X̂7 ,
{ Ŝk }k=1 = = . (4.138)

 1̂ 1̂ 1̂ Ẑ Ẑ Ẑ Ẑ, 
 
 Ẑ4 Ẑ5 Ẑ6 Ẑ7 , 

 
 
 


 1̂ Ẑ Ẑ 1̂ 1̂ Ẑ Ẑ, 
  Ẑ2 Ẑ3 Ẑ6 Ẑ7 , 

  
 




Ẑ 1̂ Ẑ 1̂ Ẑ 1̂ Ẑ Ẑ1 Ẑ3 Ẑ5 Ẑ7 ,

With the Steane code, any single-qubit error can be correctly recovered as it send the code space HC in one of
the other subspaces Hi . Specifically, the code space HC is given by the span of two logical states { | 0L ⟩, | 1L ⟩ }.
These are encoded as
1
|0L ⟩ = √ [|0000000⟩ + |1010101⟩ + |0110011⟩ + |1100110⟩ + |0001111⟩ + |1011010⟩ + |0111100⟩ + |1101001⟩] ,
8
1
|1L ⟩ = √ [|1111111⟩ + |0101010⟩ + |1001100⟩ + |0011001⟩ + |1110000⟩ + |0100101⟩ + |1000011⟩ + |0010110⟩] .
8
(4.139)
The logical operations are given by the normalisers. In the Pauli group, we have the logical X-gate and the
logical Z-gate. These are constructed by applying the corresponding single qubit operators to each physical
qubit. Namely,
X̂L =X̂1 X̂2 X̂3 X̂4 X̂5 X̂6 X̂7 ,
(4.140)
ẐL =Ẑ1 Ẑ2 Ẑ3 Ẑ4 Ẑ5 Ẑ6 Ẑ7 .
These operations are allowed, as there are still two free degrees of freedom. There are also other logical operations
that one can construct. These are normalisers that do not appartain to the Pauli group. An example is the
Hadamard gate, which can be also implemented as the application of single qubit Hadamards:

ĤL = Ĥ1 Ĥ2 Ĥ3 Ĥ4 Ĥ5 Ĥ6 Ĥ7 . (4.141)


4.4 Fault-tolerant computation 65

At this point, one would naively extrapolate that any logical operation can be constructed via the application
of the corresponding gate on the single data qubits where the logical state is encoded. However, this is not the
case. An example is the phase gate Ŝ, whose representation in the computation basis reads
 
10
S= . (4.142)
0i

The corresponding logical gate is constructed as

ŜL = Ŝ1† Ŝ2† Ŝ3† Ŝ4† Ŝ5† Ŝ6† Ŝ7† . (4.143)

Indeed, when applied to the logical computational basis we find

ŜL |0L ⟩ = |0L ⟩ ,


(4.144)
ŜL |1L ⟩ = i |1L ⟩ .

Conversely, if one would have defined a ŜL′ as just simply applying the S-gate to each physical qubit, one would
have obtained
ŜL′ |0L ⟩ = |0L ⟩ ,
(4.145)
ŜL′ |1L ⟩ = −i |1L ⟩ .
Thus, the construction of logical gates needs to be done with care and it depends on the QEC code that one is
employing.

Let us consider the case of a CNOT gate. Here, we have two logical qubits, each corresponding to 7 data and
6 syndrome qubits. One can see that the logical CNOT gate can be implemented pairwise as described by the
following ciurcuit

(4.146)
66 4 Quantum Error Correction

It follows that one can implement the logical circuit

H
(4.147)

as
H

H (4.148)

This way of implementing logical gates is called transversal construction. This is a really easy and straightforward
construction, but most importantly allows to confine errors, as they are unable to propagate. Let us take as an
example the circuit in Eq. (4.148) and suppose we have initially a X error on the first qubit of the first block.
In such a case, the error propagates accordingly to
4.4 Fault-tolerant computation 67

X H H X

H H

H H

H H

H H

H H

H → H

(4.149)
Thus, the error has been copied to the first qubit of the second block, but all the other qubits are not affected.
The Steane code can correct for such an error. This holds true for any transverse construction.

Till now, we have covered the case for the normalisers { X̂L , ẐL , ĤL , ŜL , CNOTL }, which is the so-called
Clifford group. Notably, the Gottesman-Knill theorem indicates that operations performed using only elements
of this group can be simulated classically. Thus, one cannot have a real quantum advantage over a classical
computer. Moreover, the Clifford group is not universal, meaning that the composition of elements of this group
is not sufficient to implement any arbitrary gate. This is essentially the argument of the Solovay-Kitaev theorem.
One needs to extend the Clifford group with the addition of at least an extra gate not appartaining to the group.
This can be the T-gate or the Toffoli gate.
Unfortunately, one does not know how to implement through unitary operations the T-gate in a transversal
way using the Steane code. This is a code-related problem. One could consider a different QEC code and im-
plement the T-gate, but they will have problems with another gate, e.g. the Hadarmard gate. The Eastin-Knill
theorem indicates that it is not possible to construct a fault-tolerant universal set with unitary operations.

Notably, the latter theorem applies only to unitary operations. One can still have the entire universal set
by substituting the problematic gate with an effective implementation. Below, we focus on the derivation of an
effective T-gate for the Steane code.
68 4 Quantum Error Correction

Consider the following circuit

y
|ψ⟩ H
(4.150)
|0⟩ H |φ⟩

where one obtains that the state |φ⟩ is given by

|φ⟩ = X̂ y Ĥ |ψ⟩ , (4.151)

with y = 0, 1. Notably, the three operations performed here, the two Hadamards and the control-Z gates, are
all fault-tolerant.
Suppose we slightly modify the circuit by adding a T-gate on the second qubit as follows

y
|ψ⟩ H
(4.152)

|0⟩ H T |φ ⟩

where the representation of the T-gate on the computational basis reads


!
1 0
T = π (4.153)
0 e−i 4

and the final state of the second qubit now is

|φ′ ⟩ = T̂ X̂ y Ĥ |ψ⟩ . (4.154)

Since, a part from a total phase, the T-gate can be written as


π
T̂ = ei 8 Ẑ , (4.155)

one obtains
|φ′ ⟩ = X̂ y T̂ (1−2y) Ĥ |ψ⟩ . (4.156)
But, T̂ (1−2y) can be expressed as
πy πy
T̂ (1−2y) = T̂ e−i 4 Ẑ = e−i 4 Ŝ y T̂ , (4.157)
where we can safely omit the phase in the last expression. Thus, we get

|φ′ ⟩ = X̂ y Ŝ y T̂ Ĥ |ψ⟩ = (X̂ Ŝ)y T̂ Ĥ |ψ⟩ . (4.158)

Here, the last equality holds since the value of y can be only 0 or 1. Moreover, we also find that the T-gate
commutes with the control-Z, since it commutes with Ẑ. Thus, by adding an extra Hadamard gate on the first
qubit, we obtain
y
|ψ⟩ H H
(4.159)
′′
|0⟩ H T |φ ⟩

where
4.4 Fault-tolerant computation 69

|φ′′ ⟩ = (X̂ Ŝ)y T̂ |ψ⟩ . (4.160)


Specifically, the latter implies the following one

y
|ψ⟩ H H
(4.161)
|ϕ⟩ (Ŝ † X̂)y |χ⟩

where
|χ⟩ = T̂ |ψ⟩ ,
(4.162)
|ϕ⟩ = T̂ Ĥ |0⟩ .
This means that, if one is able to prepare the second qubit in the state |ϕ⟩, then they also can apply the T-gate
to an arbitrary state |ψ⟩ that was initially embedded in the first qubit. This is an effective application of the
T-gate. Clearly, it requires the preparation of |ϕ⟩. Specifically, this is given by
π
|ϕ⟩ = T̂ Ĥ |0⟩ = e−i 8 Ẑ |+⟩ . (4.163)

Now, the state |+⟩ is eigeinstate of X̂ with eigeinvalue (+1), and in the same way |ϕ⟩ is eigeinstate of the
operator
π π π
e−i 8 Ẑ X̂ei 8 Ẑ = e−i 4 Ẑ X̂ = Ŝ X̂, (4.164)
with the eigeinvalue (+1). Here, the last two equalities follow from the commutaion of T̂ and X̂ and the
definition of the S-gate. Thus, |ϕ⟩ is eigeinstate of Ŝ X̂ with eigeinvalue (+1). Similarly, the ortogonal state
|ϕ⊥ ⟩ is associated to the eigenvalue (−1). Now, this implies that given an arbitrary state |ν⟩ by measuring the
operator Ŝ X̂, the state will collapse in |ϕ⟩ or |ϕ⊥ ⟩ with corresponding outcomes respectively given by (+1) and
(−1).
The complete circuit thus becomes

y
|ψ⟩ H H
Ŝ X̂
|ν⟩ +1 |ϕ⟩ (Ŝ † X̂)y |χ⟩ (4.165)

−1 discarded

and effectively applies the T-gate to an arbitrary state |ψ⟩. If the measurement is also FT (this can be proven,
but it will not be tackled here), then one has that the entire circuit is FT.
Chapter 5
Dynamical Decoupling and Quantum Error Mitigation

The greatest problem in the development of quantum computers are the presence of errors and noises. QEC
works in theory: the threshold theorem guarantees it. However, it requires a number of physical qubits (∼ 103
to ∼ 106 ) that is often beyond what possible with the current technology. In this chapter, we introduce two
possible routes to tackle the problem. These are the Dynamical Decoupling and the Quantum Error Mitigation.

5.1 Dynamical Decoupling

The dynamical decoupling (DD) approach leverage on averaging out the unwanted effects of the surrounding
environment by applying a control on the system.

Two introduce the idea, we focus on the specific model of a qubit coupled to a thermal bath of harmonic
oscillators, with b̂k being the annihilation operator of the k oscillator. The total Hamiltonian reads
X X
Ĥ0 = ĤS + ĤB + ĤSB = 21 ℏω0 σ̂z + ℏωk b̂†k b̂k + ℏσ̂z (gk b̂†k + gk∗ b̂k ), (5.1)
k k

where the first and second contributions are the free Hamiltonian of the qubit system and thermal bath re-
spectively, while the last term describes their interaction being weighted by the constants gk . Eventually, one
focuses on the dynamics of the qubit alone. Thus, the state of interest is the reduced density matrix, which is
obtained via h i
ρ̂S (t) = Tr(B) e−iĤ0 t/ℏ ρ̂T (0)eiĤ0 t/ℏ , (5.2)

where ρ̂T (0) is the total state at time t = 0. The latter can be decomposed on the computational basis
{ | 0⟩, | 1⟩ } as X
ρ̂S (t) = ρij (t) |i⟩ ⟨j| . (5.3)
i,j=0,1
h i
Now, given the total Hamiltonian Ĥ0 , one finds that the populations ρii are conserved. Indeed, σ̂z , Ĥ0 = 0
and thus the model describes a purely decohering mechanism, where no energy exchange between the system
and the bath is present. Specifically, one can focus on the dynamics of the coherences ρ01 (t) alone, and we do
it in the interaction picture. Thus, we have that the total state is given by

ρ̂(I)
T (t) = e
i(ĤS +ĤB )t/ℏ
ρ̂T (t)e−i(ĤS +ĤB )t/ℏ , (5.4)

with the effective Hamiltonian reading

70
5.1 Dynamical Decoupling 71
X 
Ĥ0(I) (t) = ℏσ̂z gk b̂†k eiωk t + gk∗ b̂k e−iωk t . (5.5)
k

Correspondingly, the unitary operator determining the time evolution in the interaction picture from time t0 to
t is  Z 
i t
Û (I) (t0 , t) = T exp − ds Ĥ0(I) (s) , (5.6)
ℏ t0
where T indicates the time-ordering operator. The corresponding Dyson expansion, which is effectively a Taylor
expansion accounting also for the time-ordering, reads
Z Z t Z t2
i t 1
Û (I) (t0 , t) = 1̂ − dt1 Ĥ0(I) (t1 ) − 2 dt2 dt1 Ĥ0(I) (t2 )Ĥ0(I) (t1 ) + . . . (5.7)
ℏ t0 ℏ t0 t0

Let us focus on the second order term, which can be rewritten in term of the integral from t0 to t for both
variables as
Z t Z t2 Z t Z t Z t Z t
(I) (I) (I) (I)
dt2 dt1 Ĥ0 (t2 )Ĥ0 (t1 ) = dt2 dt1 Ĥ0 (t2 )Ĥ0 (t1 ) − dt2 dt1 Ĥ0(I) (t2 )Ĥ0(I) (t1 ). (5.8)
t0 t0 t0 t0 t0 t2

The last term corresponds to the integral over the area highlighted by the blue lines in Fig. 5.1: for each value
of t2 ∈ [t0 , t], the t1 integral runs from t2 to t. Equivalently, this area can be described by the red lines: for each
value of t1 ∈ [t0 , t], one performs the t2 integral from t0 to t1 .

𝑡" 𝑡"
𝑡"

𝑡"
=

=
𝑡!

𝑡!

𝑡! 𝑡!

Fig. 5.1: Representation of different but equivalent ways of how to perform the integral in Eq. (5.9).

Mathematically, this implies that the following equality holds


Z t Z t Z t Z t1
dt2 dt1 Ĥ0(I) (t2 )Ĥ0(I) (t1 ) = dt1 dt2 Ĥ0(I) (t2 )Ĥ0(I) (t1 ). (5.9)
t0 t2 t0 t0

Moreover, we can recast the right-hand-side of the latter equation as


Z t Z t1 Z t Z t1 h i Z t Z t1
dt1 dt2 Ĥ0(I) (t2 )Ĥ0(I) (t1 ) = dt1 dt2 Ĥ0(I) (t2 ), Ĥ0(I) (t1 ) + dt1 dt2 Ĥ0(I) (t1 )Ĥ0(I) (t2 ),
t0 t0 t0 t0 t0 t0
Z t Z t1 h i Z t Z t2 (5.10)
= dt1 dt2 Ĥ0(I) (t2 ), Ĥ0(I) (t1 ) + dt2 dt1 Ĥ0(I) (t2 )Ĥ0(I) (t1 ),
t0 t0 t0 t0

where we swapped the variables t1 ↔ t2 in the second term. Namely, such second term is identical to that in
the left-hand-side of Eq. (5.8). Here, the non-equal time Hamiltonians do not commute, but give
72 5 Dynamical Decoupling and Quantum Error Mitigation
h i X h i h i
Ĥ0(I) (t2 ), Ĥ0(I) (t1 ) = ℏ2 σ̂z2 gk gk∗′ eiωk t2 −iωk′ t1 b̂†k , b̂k′ + gk∗ gk′ e−iωk t2 +iωk′ t1 b̂k , b̂†k′ ,
kk′
X (5.11)
2
= −2iℏ |gk |2 sin[ωk (t2 − t1 )],
k

which is an imaginary number. Now, by merging the last four equations, we find
Z t Z t2 Z Z t Z Z t1 h i
1 t 1 t
dt2 dt1 Ĥ0(I) (t2 )Ĥ0(I) (t1 ) = dt2 dt1 Ĥ0(I) (t2 )Ĥ0(I) (t1 ) − dt1 dt2 Ĥ0(I) (t2 ), Ĥ0(I) (t1 ) ,
t0 t0 2 t0 t0 2 t0 t0
Z t 2 Z t Z t1 X
1
= dt1 Ĥ0(I) (t1 ) + iℏ2 dt1 dt2 |gk |2 sin[ωk (t2 − t1 )].
2 t0 t0 t0 k
(5.12)
This allows to recast the Dyson expansion as
Z t  Z t 2
i (I) 1 i (I)
Û (t0 , t) = 1̂ −
(I)
dt1 Ĥ0 (t1 ) + − dt1 Ĥ0 (t1 ) − iϕ(t0 , t) + . . . , (5.13)
ℏ t0 2 ℏ t0

where Z Z
1 t t1 X
ϕ(t0 , t) = dt1 dt2 |gk |2 sin[ωk (t2 − t1 )]. (5.14)
2 t0 t0 k

By summing all the terms, one gets


 Z t 
−iφ(t0 ,t) i (I)
(I)
Û (t0 , t) = e exp − ds Ĥ0 (s) , (5.15)
ℏ t0

where one has an extra global phase, which is hiowever unimportant since
h i†  Z   Z t 
i t (I) i (I)
Û (t0 , t)ρ̂ Û (t0 , t) = exp −
(I) (I)
ds Ĥ0 (s) ρ̂ exp ds Ĥ0 (s) , (5.16)
ℏ t0 ℏ t0

and there is not time-ordering operator.


Specifically, one can perform explicitly the time integral in the exponential of Û (I) (t0 , t), which reads
Z
i t
1 X  † iωk t0 
− ds Ĥ0(I) (s) = σ̂z b̂k e ξk (t − t0 ) − b̂k e−iωk t0 ξk∗ (t − t0 ) , (5.17)
ℏ t0 2
k

where
2gk
ξk (t − t0 ) = (1 − eiωk (t−t0 ) ). (5.18)
ωk
Now, the quantity of interest is the coherence, which in the interaction picture is given by
  † 
(I) (I) (B)
ρ01 (t) = ⟨0|ρ̂S (t)|1⟩ = ⟨0| Tr (I) (I)
Û (t0 , t)ρ̂T (t0 ) Û (t0 , t) |1⟩ , (5.19)

and it can be computed analytically under the following assumptions:


1) The total initial state is separable, namely

ρ̂T (t0 ) = ρ̂S (t0 ) ⊗ ρ̂B (t0 ); (5.20)

2) The initial state of the bath is a thermal state of the form


5.1 Dynamical Decoupling 73
Y  
ρ̂B (t0 ) = (1 − e−βℏωk ) exp −βℏωk b̂†k b̂k , (5.21)
k

with β = (kB T )−1 being the inverse temperature.


By going back to the Schrödinger picture, Eq. (5.19) reads

ρ01 (t) = e−iω0 (t−t0 ) ρ(I)


01 (t),
" " #
−iω0 (t−t0 ) 1 X  † iωk t0
(B) −iωk t0 ∗

=e ⟨0| Tr exp σ̂z b̂k e ξk (t − t0 ) − b̂k e ξk (t − t0 ) ρ̂T (t0 )
2 (5.22)
k
" ##
1 X  † iωk t0 −iωk t0 ∗

× exp − σ̂z b̂k e ξk (t − t0 ) − b̂k e ξk (t − t0 ) |1⟩ .
2
k

By applying with σ̂z on the ⟨0| and |1⟩ states, we get


" " # #
X † 
−iω0 (t−t0 ) (B) ∗
ρ01 (t) = e Tr exp ck b̂k − ck b̂k ρ̂B (t0 ) ρ01 (t0 ), (5.23)
k

where we exploited the cyclicity of the partial trace with respect to the bath operators, the assumption of
separability of the initial state, the definition of the initial coherence ρ01 (t0 ) = ⟨0|ρ̂S (t0 )|1⟩, and defined

ck = ck (t0 , t) = eiωk t0 ξk (t − t0 ). (5.24)

In Eq. (5.23), one can recognise the displacement operator. Namely, the latter equation can be recasted as
" #
Y
−iω0 (t−t0 ) (B)
ρ01 (t) = e Tr D̂k (ck )ρ̂B (t0 ) ρ01 (t0 ), (5.25)
k

where
D̂(β) = exp(β b̂†k − β ∗ b̂) (5.26)
is the displacement operator.

Recall 5.1 (Coherent states)


Given the ground state |0⟩, one can construct a coherent state via the application of a displacement operator
to |0⟩. Namely,
D̂(β) |0⟩ = |β⟩ , (5.27)
where β ∈ C. The coherent states form an overcomplete basis of the Hilbert space H, for which one has
Z 2
d z
1̂ = |z⟩ ⟨z| , (5.28)
π

where d2 z = d(ℜz)d(ℑz). The combination of two displacement operators is governed by


1 ∗
−βα∗ )
D̂(α)D̂(β) = e 2 (αβ D̂(α + β). (5.29)

Finally, one can express the coherent states in terms of the Fock basis { | n⟩ }, where

zn 2
⟨n|z⟩ = √ e−|z| /2 , (5.30)
n!
74 5 Dynamical Decoupling and Quantum Error Mitigation

determines the weights between the two basis.

Let us then consider the partial trace over the k-th mode of the displacement operator and the thermal state,
which explicitly reads
h i h †
i
Tr(B) D̂k (ck )ρ̂Bk (t0 ) = (1 − e−βℏωk ) Tr(B) D̂k (ck )e−βℏωk b̂k b̂k ,
Z 2 (5.31)
d z †
= (1 − e−βℏωk ) ⟨z|e−βℏωk b̂k b̂k D̂k (ck )|z⟩ ,
π
where we exploited the coherent basis to compute the partial trace and exploit its cyclicity. By applying the
composition of displacement opertors (namely, Eq. (5.29) merged with Eq. (5.27)), and introducing an identity
P+∞
in the Fock basis, i.e. 1̂ = n=0 |n⟩ ⟨n|, we get
h i Z 2 X
d z 1 ∗ ∗
Tr(B) D̂k (ck )ρ̂Bk (t0 ) = (1 − e−βℏωk ) ⟨z|n⟩ e−βℏωk n e 2 (ck z −zck ) ⟨n|z + ck ⟩ ,
π n
Z 2 X (5.32)
−βℏωk d z 1
−βℏωk n 2 (ck z ∗ −zc∗
k) √
(z ∗ )n −|z|2 /2 (z + ck )n −|z+ck |2 /2
= (1 − e ) e e e √ e ,
π n n! n!

where we applied Eq. (5.30). By putting together the exponentials, we obtain


h i Z 2
(B) −βℏωk d z −|z|2 −|ck |2 /2 −zc∗k
Tr D̂k (ck )ρ̂Bk (t0 ) = (1 − e ) e e e S(z, ck ) (5.33)
π
where
X (z ∗ )n (z + ck )n
S(z, ck ) = e−βℏωk n √ √ ,
n n! n!
X 1  n (5.34)
= e−βℏωk (|z|2 + ck z ∗ ) ,
n
n!
 
= exp e−βℏωk (|z|2 + ck z ∗ ) .
Thus, Z 2
h i d z −|z|2 αk −|ck |2 /2 −zc∗k
−βℏωk
Tr(B)
D̂k (ck )ρ̂Bk (t0 ) = (1 − e ) e e e exp[ck z ∗ e−βℏωk ], (5.35)
π
where
αk = 1 − e−βℏωk , (5.36)
is a positive quantity. Then, the Gaussian integral in Eq. (5.35) can be safely implemented and gives
h i  
(B) −βℏωk 1 |ck |2 −βℏωk −|ck |2 /2
Tr D̂k (ck )ρ̂Bk (t0 ) = (1 − e ) exp − e e ,
αk αk
  
1 e−βℏωk
= exp −|ck |2 + , (5.37)
2 (1 − e−βℏωk )
  
|ck |2 βℏωk
= exp − coth .
2 2

Finally, by merging together the latter equation with Eq. (5.25), we obtain

ρ01 (t) = e−iω0 (t−t0 ) e−Γ (t0 ,t) ρ01 (t0 ), (5.38)

where we defined
5.1 Dynamical Decoupling 75

X |c2 |  
k βℏωk
Γ (t0 , t) = coth ,
2 2
k
X |eiωk t0 ξk (t − t0 )|2  
βℏωk
= coth
,
2 2
k
  (5.39)
X | 2g
ωk (1 − e
k iωk (t−t0 ) 2
)| βℏωk
= coth ,
2 2
k
X 4|gk |2  
βℏωk
= (1 − cos[ωk (t − t0 )]) coth
ωk2 2
k

where we simply substituted the definitions of ck and ξk (t − t0 ). Now, by introducing the spectral density I(ω)
as X
I(ω) = δ(ω − ωk )|gk |2 , (5.40)
k

which determines the strength of the coupling between the system and each bath’s modes, we can rewrite Γ (t0 , t)
as Z +∞  
βℏω (1 − cos[ω(t − t0 )])
Γ (t0 , t) = 4 dω I(ω) coth ,
0 2 ω2
Z +∞ (5.41)
(1 − cos[ω(t − t0 )])
=4 dω I(ω) (2n̄(ω, T ) + 1) ,
0 ω2
where n̄(ω, T ) is the mean number of excitations of the mode ω at the temperature T = (kB β)−1 . Notably,
Γ (t0 , t) is positive. This can be seen explicitly from the first line of Eq. (5.39). This means, that — as expected
— the interaction with the environment reduces the coherences [cf. Eq. (5.38)].
Suppose now that we want to perturb the system so the induce a spin-flip transition. Physically, since the
interaction Hamiltonian ĤSB is proportional to σ̂z , then opposite contributions arise when the system is in |0⟩
and |1⟩. Thus, by making the system change fast between |0⟩ and |1⟩, one can average out the contributions
from ĤSB , effectively decoupling the system from the environment.
Specifically, we will consider a modified Hamiltonian reading

Ĥ0 → Ĥ(t) = Ĥ0 + ĤP (t), (5.42)

where the Hamiltonian perturbation ĤP (t) can be implemented via a monocromatic alternating magnetic field
applied at the resonance. Its explicit form we consider is
nP
X n o
(n) (n)
ĤP (t) = V (n) (t) σ̂x cos[ω0 (t − tP )] + σ̂y sin[ω0 (t − tP )] ,
n=1
(5.43)
XnP  (n) (n)

(n) iω0 (t−tP ) −iω0 (t−tP )
= V (t) σ̂+ e + σ̂− e ,
n=1

(n)
with nP being the number of pulses, tP is the time at which the pulse is switched on every ∆t, namely
(n)
tP = t0 + n∆t, with n ∈ { 1, . . . , nP } . (5.44)

Finally, the switch of the impulse is determined by V (n) (t), which is defined as
(
(n) (n)
(n) V, for t ∈ [tP , tP + τP ],
V (t) = (5.45)
0, otherwise,
76 5 Dynamical Decoupling and Quantum Error Mitigation

where τP is the duration time of the pulses.

The exact dynamics with respect to the modified Hamiltonian Ĥ(t) cannot be solved. However, we can
assume that during the pulses the contribution of ĤSB is negligible and we completely neglect it. Then, the
dynamics becomes piecewise, alternating ĤSB to ĤP .
As for the unperturbed case, we tackle the problem in the interaction picture. Namely, the effective Hamil-
tonian becomes
Ĥ (I) (t) = Ĥ0(I) (t) + ĤP(I) (t), (5.46)
where Ĥ0(I) (t) is shown in (5.5) and
    
(I) i i
ĤP (t) = exp ĤS + ĤB ĤP (t) exp − ĤS + ĤB ,
ℏ ℏ
XnP   (5.47)
(n) (n)
= eiω0 σ̂z t/2 V (n) (t) σ̂+ eiω0 (t−tP ) + σ̂− e−iω0 (t−tP ) e−iω0 σ̂z t/2 .
n=1

However, one has that


eiω0 σ̂z t/2 σ̂− e−iω0 σ̂z t/2 = eiω0 σ̂z t/2 |0⟩ ⟨1| e−iω0 σ̂z t/2 ,
= eiω0 t |0⟩ ⟨1| , (5.48)
iω0 t
=e σ̂− ,
and similarly
eiω0 σ̂z t/2 σ̂+ e−iω0 σ̂z t/2 = e−iω0 t σ̂+ . (5.49)
Then, we obtain
nP
X  (n) (n)

ĤP(I) (t) = V (n) (t) σ̂+ e−iω0 tP + σ̂− eiω0 tP ,
n=1
nP
(5.50)
X (n) (n)
(n) iω0 σ̂z tP /2 −iω0 σ̂z tP /2
= V (t)e σ̂x e ,
n=1

where we exploited that σ̂+ + σ̂− = σ̂x . Notably, the only time dependence is in V (n) (t), but it is only formal
as one can see from Eq. (5.45). Then, when considering the corresponding unitary, we have
Z (n) !
i tP +τP (I)
V̂n (τP ) = exp −
(I)
ds ĤP (s) ,
ℏ tP(n)
  (5.51)
i iω0 σ̂z t(n) /2
(n)
−iω0 σ̂z tP /2
= exp − V e P σ̂x e τP .

By Taylor expanding
X 1  i (n) (n)
k
iω0 σ̂z tP /2 −iω0 σ̂z tP /2
V̂n (τP ) =
(I)
− Ve σ̂x e τP ,
k! ℏ
k

(n) X 1  i k
(n) (5.52)
= eiω0 σ̂z tP /2 − V σ̂x τP e−iω0 σ̂z tP /2 ,
k! ℏ
k
(n) i (n)
=e iω0 σ̂z tP /2
e− ℏ V σ̂x τP e−iω0 σ̂z tP /2
.
We finally fix V and τP so to have an actual bit-flip. This is provided by setting
V τP π
= , (5.53)
ℏ 2
5.1 Dynamical Decoupling 77

which gives
i π
e− ℏ V σ̂x τP = e−i 2 σ̂x = −iσ̂x . (5.54)
Notably, we can consider the limit of the time pulses that go to zero, i.e. τP → 0, as long as V → ∞ and
Eq. (5.53) holds. Since from here V does not appear explicitly, this will only simplify the calculations.
Then, we have that
(n) (n)
V̂n(I) (τP ) = V̂n(I) = −ieiω0 σ̂z tP /2 σ̂x e−iω0 σ̂z tP /2 . (5.55)
By considering that the following relation holds

e−iω0 σ̂z t/2 = cos(ω0 t/2)1̂ − i sin(ω0 t/2)σ̂z , (5.56)

and the anticommutation relation {σ̂x , σ̂z } = 0, we have that

σ̂x e−iω0 σ̂z t/2 = eiω0 σ̂z t/2 σ̂x . (5.57)

It follows that one can write the operator V̂n(I) in two equivalent ways:
(n) (n)
V̂n(I) = −ieiω0 σ̂z tP σ̂x = −iσ̂x e−iω0 σ̂z tP . (5.58)

Let us now consider the time evolution of the first entire cycle of spin-flips: this is from time t0 through
(1) (2)
time tP when the spin flips the first time, to time tP when the spin flips back to the original spin state. In
particular, we define this latter time as t1 = t0 + 2∆t. The unitary dynamics from t0 to t1 is given by
(1) (2) (1)
ÛP(I) (t0 , t1 ) = V̂2(I) Û (I) (tP , tP )V̂1(I) Û (I) (t0 , tP ),
h i  −1 
(5.59)
(I) (I) (I) (1) (2) (I) (1)
= V̂2 V̂1 V̂1 Û (tP , tP )V̂1 Û (I) (t0 , tP ),
(I)

where " #
1 X  † iωk tα −iωk tα ∗

(I)
Û (tα , tβ ) = exp σ̂z b̂k e ξk (tβ − tα ) − b̂k e ξk (tβ − tα ) . (5.60)
2
k

The first square parenthesis in the last line of Eq. (5.59) is given by
 (2)
 (1)

V̂2(I) V̂1(I) = −ieiω0 σ̂z tP σ̂x −iσ̂x e−iω0 σ̂z tP ,
(2) (1)
(5.61)
−tP )
= −eiω0 σ̂z (tP .

Similarly, the second square parenthesis in the last line of Eq. (5.59) can be rewritten as
 −1  
(1) (2) (1) 1 (1) (2) (1)
V̂1(I) Û (I) (tP , tP )V̂1(I) = eiω0 σ̂z tP σ̂x exp σ̂z B̂(tP , tP ) σ̂x e−iω0 σ̂z tP (5.62)
2
P  (1) (1)

where B(tP , tP ) = k b̂†k eiωk tP ξk (∆t) − b̂k e−iωk tP ξk∗ (∆t) . Here, we Taylor expand the central exponential,
(1) (2)

which gives
  X  l
1 (1) (2) 1 1 (1) (2)
exp σ̂z B̂(tP , tP ) = σ̂z B̂(tP , tP ) . (5.63)
2 l! 2
l

We divide the contributions to the sum in those with even and odd values of l. For even values, we have σ̂zl = σ̂z2l ,

where l = 2l′ ; then σ̂zl = 1̂ = (−σ̂z )l . For odd values of l, we have σ̂zl = σ̂z2l +1 , where l = 2l′ + 1; then σ̂zl = σ̂z .
But more specifically, we also have that σ̂x σ̂zl σ̂x = σ̂x σ̂z σ̂x = −σ̂z = −σ̂zl . Thus, it follows that
78 5 Dynamical Decoupling and Quantum Error Mitigation
 −1  
(1) (2) 1 (1) (2)
V̂1(I) Û (I) (tP , tP )V̂1(I) = exp − σ̂z B̂(tP , tP ) . (5.64)
2

Thus, we have that Eq. (5.59) reads


   
(2) (1)
−tP ) 1 (1) (2) 1 (1)
ÛP(I) (t0 , t1 ) = −eiω0 σ̂z (tP exp − σ̂z B̂(tP , tP ) exp σ̂z B̂(t0 , tP ) , (5.65)
2 2

and can be recasted as


" #
(I) (2) (1) 1 X  † iωk t0 −iωk t0 ∗

ÛP (t0 , t1 ) = exp iω0 σ̂z (tP − tP ) + σ̂z b̂k e ηk (∆t) − b̂k e ηk (∆t) , (5.66)
2
k

where we neglected the overall unimportant phase and we defined



ηk (∆t) = ξ(∆t) 1 − eiωk ∆t . (5.67)

Now, the full evolution from time t0 to time tN after N entire cycles of spin-flip is simply given by
N
" !#
Y 1 X † X iωk t0 X
(I) −iωk t0 ∗
ÛP (tn−1 , tn ) = exp iω0 σ̂z (tN − t0 ) + σ̂z b̂k e ηk (N, ∆t) − b̂k e ηk (N, ∆t) ,
n=1
2 n n
k
(5.68)
where we introduced X
ηk (N, ∆t) = e−iωk t0 eiωk tn−1 ηk (∆t),
n
N
X (5.69)
= ηk (∆t) e2iωk ∆t(n−1) .
n=1

Such an evolution is to be compared to that with no pulses on the same time period. This is given by Eq. (5.60)
where one substitutes tα → t0 and tβ → tN . Then, since tN − t0 = 2N ∆t, we have
" #
1 X  † iωk t0 −iωk t0 ∗

(I)
Û (t0 , tN ) = exp σ̂z b̂k e ξk (2N ∆t) − b̂k e ξk (2N ∆t) . (5.70)
2
k

Notably, the expressions in Eq. (5.68) and Eq. (5.70) have a similar structure, with the important difference
being the factor ηk (N, ∆t) substituted with ξk (2N ∆t). Thus, the decohering factor Γ (t0 , tN ) will take a suitably
modified expression as that in Eq. (5.39), namely
X |eiωk t0 ηk (N, ∆t)|2  
βℏωk
Γ (t0 , tN ) = coth . (5.71)
2 2
k

We now compare the difference between these two factors:


N
X N
X
ηk (N, ∆t) − ξk (2N ∆t) = ηk (∆t) e2iωk ∆t(n−1) − ξk (2∆t) e2iωk ∆t(n−1) , (5.72)
n=1 n=1

where we exploited the composition of the ξk terms. Then, by considering that


5.2 Quantum Error Mitigation 79

2gk
ξk (∆t)(1 + eiωk ∆t ) = (1 − eiωk ∆t )(1 + eiωk ∆t ),
ωk
2gk (5.73)
= (1 − e2iωk ∆t ),
ωk
= ξk (2∆t),

and the definition of ηk (∆t) in Eq. (5.67), we obtain


X
ηk (N, ∆t) − ξk (2N ∆t) = −2ξk (∆t)eiωk ∆t e2iωk ∆t(n−1) . (5.74)
n=1

Equivalently, we have
ηk (N, ∆t) = ξk (2N ∆t) (1 − fk (N, ∆t)) , (5.75)
where
ξk (∆t) iωk ∆t X 2iωk ∆t(n−1)
fk (N, ∆t) = 2 e e . (5.76)
ξk (2N ∆t) n=1

By exploiting the geometric series and the definition of ξk , we get

(1 − eiωk ∆t ) iωk ∆t (1 − e2iωk N ∆t )


fk (N, ∆t) = 2 e ,
(1 − e2iωk N ∆t ) (1 − e2iωk ∆t )
(5.77)
(1 − eiωk ∆t ) iωk ∆t
=2 e .
(1 − e2iωk ∆t )

Finally, by taking the limit of dense pulses, i.e. ∆t → 0, we obtain

lim fk (N, ∆t) = 1, (5.78)


∆t→0

which means that under the same limit we have

lim ηk (N, ∆t) = 0. (5.79)


∆t→0

As a consequence, the decoherence factor vanishes: Γ (t0 , tN ) → 0. Namely, the decohering effect of the en-
vironment on the system is cancelled. Effectively, one has a (dynamical) decoupling of the system from its
environment.

5.2 Quantum Error Mitigation

Quantum Error Mitigation (QEM) wants to translate the improvements of quantum hardware in those of
quantum information and computation. Namely, it is an algorithmic scheme that reduces noise-induced bias in
the expectation value of an observable of interest by post-processing outputs from an ensemble of circuit runs.
To do this, it employs circuits at the same depth as the original unmitigated circuit or above. QEM applies
post-processing directly from the hardware outputs. Thus, if the circuit size, being the product of the circuit
depth times the number of qubits, becomes too large then QEM loses its usefulness.
A good QEM approach should employ a limited number of qubits, while still providing a guaranteed accu-
racy. This converts in a formal error bound, which indicates how well the QEM code works. Moreover, it should
employ only a few (or better none) assumptions about the final state. For example, assuming that the final state
is factorised is not a good assumption. Indeed, it would strongly limit the applicability of the corresponding
QEM algorithm.
80 5 Dynamical Decoupling and Quantum Error Mitigation

Before dwelling in two, among various, algorithms in the QEM context, we provide the general idea of the
QEM approach. We defined the primary circuit as that process that would ideally produce the perfect output
state ρ̂0 . Due to the presence of noises, the primary circuit produces the noisy state ρ̂. To account how a circuit
works, we consider an observable of interests Ô whose expectation value is the output information we seek.
To compute this, we will run the circuit Nsample times, which is the number of circuit executions. Also in the
noiseless case, a finite value of Nsample implies a finite inaccuracy of the estimated average. This is the so-called
shot noise. However, in such a case, there will be no systematic shift, i.e. bias, in the expectation value of Ô
due to the noise. QEM aims to reduce such a bias. Often, this implies that the corresponding variace increases.
Then, one needs to increase the number of circuit runs N > Nsample to compensate. The sampling overhead is
the cost, in terms of number of repetitions, of the QEM method when compared to the noiseless circuit.
We underline that, conversely to QEC, in QEM there is no monitoring of the errors occurring during the run
of the circuit.

5.2.1 Zero noise extrapolation

The Zero noise extrapolation (ZNE) method extracts the zero-noise expectations from a fitting of the circuit
ran at different values of the noise. We define a time dependent Hamiltonian Ĥ(t) that embeds action of the
noiseless circuit. It can be written as X
Ĥ(t) = Jα (t)P̂α , (5.80)
α

where Jα (t) are some time dependent couplings that switch on and off the gates of the circuit, which are
implemented by the corresponding N -qubit Pauli operators P̂α . The full dynamics, including the action of the
noise, is given by the following master equation

dρ̂λ (t) ih i
= − Ĥ(t), ρ̂λ (t) + λL[ρ̂λ (t)], (5.81)
dt ℏ
where t ∈ [0, T ], with T being the time at which the circuit ends. We assume here that the noise coupling λ is
small. Moreover, we assume that the noise dissipator L is invariant under time rescaling and it is independent
from Jˆα (t).
Now, givenhthe observable
i of interest Â, we compute the corresponding expectation value on the noisy circuit
as E(λ) = Tr Âρ̂λ (T ) , where ρ̂λ (T ) is the solution of Eq. (5.81). What we want to do is to estimate E(λ) for
λ → 0. Since one cannot reduce the value of λ, to construct a series of measurement from where extrapolate the
estimate E(0), we increase the value of λ. This can be done by considering the following rescaling. We dilate
the time T at which the circuit is ran and, due to the time invariance of L, this is equivalent to let the noise
act more on the circuit. Then, one applies this idea with different values of λ and can perform a fit and deduce
the value of E for λ → 0. Practically, we perform the circuit Ncir times, at different values of the noise rate
λj = cj λ, j = 0, . . . , Ncir − 1 with c0 = 1 < c1 < · · · < cNcir −1 . For each value of λj , we run the circuit with the
following rescaled Hamiltonian
X
Ĥ (j) (t) = Jα(j) (t)P̂α , where Jα(j) (t) = c−1 −1
j Jα (cj t), (5.82)
α

for a time Tj = cj T . The rescaled dynamics gives

ih i
(j)
dρ̂λ (t) (j) (j)
= − Ĥ (j) (t), ρ̂λ (t) + λL[ρ̂λ (t)]. (5.83)
dt ℏ
By merging the latter with Eq. (5.82), we obtain
5.2 Quantum Error Mitigation 81

(j)
dρ̂λ (t) i X −1 h i
(j) (j)
=− cj Jα (c−1
j t) P̂α , ρ̂λ (t) + λL[ρ̂λ (t)]. (5.84)
dt ℏ α

By defining s = c−1
j t, which runs in the interval s ∈ [0, T ] since t ∈ [0, Tj ], we rewrite the above master equation
as
(j)
dρ̂λ (t)
(j)
dρ̂ (cj s) i X −1 h i
(j) (j)
= λ =− cj Jα (s) P̂α , ρ̂λ (cj s) + λL[ρ̂λ (cj s)]. (5.85)
dt cj ds ℏ α
By multiplying the left and right hand side by cj we obtain

ih i
(j)
dρ̂λ (cj s) (j) (j)
= − Ĥ(s), ρ̂λ (cj s) + cj λL[ρ̂λ (cj s)], (5.86)
ds ℏ
(j)
which is Eq. (5.81) with λ substituted with cj λ. Its solution ath time s =i T is given
h by ρ̂cij λ (T ) = ρ̂λ (Tj ).
(j)
Correspondingly, we compute the expectation value E(λj ) = Tr Âρ̂λ (Tj ) = Tr Âρ̂cj λ (T ) . Experimentally,
for each cj , one performs Nsample runs of the circuit and obtains an estimator Ẽ(λj ), which converges to the
true value E(λj ) only in the asymptotic limit Nsample → ∞. Specifically, one has

Ẽ(λj ) = E(λj ) + δ̃, (5.87)

where δ̃ is a random variable with zero mean and variance E[δ̃ 2 ] = σ02 /Nsample , with σ02 corresponding to the
single-shot variance. Here, E is to the mean over the sampling.
hNow, thei ZNE problem is to construct a good estimator Ẽ(0) for the expectation value E(λ = 0) =
Tr Âρ̂0 (T ) from the set of estimators Ẽ(λj ). Figure 5.2 represents the problem. To be a good estimator,

!
𝐸(0)

!
𝐸(𝜆)

!
𝐸(1.5𝜆)
!
𝐸(2𝜆)
!
𝐸(2.5𝜆) !
𝐸(3𝜆)
!
𝐸(3.5𝜆)

𝜆
1 1.5 2 2.5 3 3.5

Fig. 5.2: Graphical representation of the Zero Error Extrapolation. Given the set of estimators Ẽ(λ) at different
values of the noise (black and blue dots and error bars), one performs a fit assuming a specific model (gray
dashed line) with corresponding confidence region (light blue region). In such a way, one extrapolates the value
of Ẽ(0) with its corresponding error bar (red point and error bar).

we want that its bias


Bias(Ẽ(0)) = E[Ẽ(0) − E(0)], (5.88)
82 5 Dynamical Decoupling and Quantum Error Mitigation

and its variance


Var(Ẽ(0)) = E[Ẽ(0)2 ] − E[Ẽ(0)]2 , (5.89)
are both small. We employ the mean squared error (MSE) are a figure of merit with respect to the true unknown
parameter
MSE(Ẽ(0)) = E[(Ẽ(0) − E(0))2 ],
(5.90)
= Var(Ẽ(0)) + (Bias(Ẽ(0)))2 .
If the expectation value E(λ) can be an arbitrary function of λ without any regularity assumption, then ZNE
is impossible. However, from physical considerations, it is reasonable to have a model for it, for example we can
assume a linear, a polynomial or an exponential dependence with respect to λ.
1 If we assume a linear dependence on λ, the corresponding linear model is given by

Elinear (λ) = a0 + a1 λ. (5.91)

In such a case, a simple analytic solution exists, which is that of the ordinary least squared estimator of the
intercept parameter. Namely, we have
SλE
Ẽlinear (0) = Ē(λ) − λ̄, (5.92)
Sλλ
where
Ncir −1
1 X
λ̄ = λj ,
Ncir j=0
Ncir −1
1 X
Ē(λ) = Ẽ(λj ),
Ncir j=0
(5.93)
cir −1
NX
SλE = (λj − λ̄)(Ẽ(λj ) − Ē(λ)),
j=0
cir −1
NX
Sλλ = (λj − λ̄)2 .
j=0

With respect to the zero noise value Elinear (0), the estimator Ẽlinear (0) is unbiased. Its variance, under the
assumption that the statistical uncertainty is the same for each λj , reads
 
σ02 1 λ̄2
Var(Ẽlinear (0)) = + . (5.94)
Nsample Ncir Sλλ

2 The Richardson’s extrapolation is a special case of the polynomial extrapolation, which is limited at order
Ncir − 1. The corresponding model is given by

ERich (λ) = a0 + a1 λ + · · · + cNcir −1 λNcir −1 . (5.95)

This is the only case in which the fitted polynomial perfectly interpolates the Ncir data points such that, in
the ideal limit of an infinite number of samples Nsample → ∞, the error with respect to the true expectation
value is by construction O(Ncir ). Using the Lagrange polynomial, the estimator can be expressed explicitly
as
cir −1
NX
ẼRich (0) = Ẽ(λj )γj , (5.96)
j=0

where
5.2 Quantum Error Mitigation 83
Y cm
γj = . (5.97)
cj − cm
m̸=j

The error of the estimator is O(Ncir ) only in the asymptotic limit Nsample → ∞. In other words, O(Ncir )
corresponds to the bias term in Eq. (5.88). In a real scenario, Nsample is finite, and the variance term in
Eq. (5.88) grows exponentially as we increase Ncir .

5.2.2 Probabilistic error cancellation

The Probabilistic error cancellation (PEC) method cancels the effects of the noise employing a map that acts
as the inverse of the noise map under suitable average.
Suppose the ideal circuit is performed by a unitary CPTP map U being the consecutive application of unitary
gates: Ûcircuit = Ûd . . . Û1 , where d id the depth of the circuit. One can represent the corresponding noisy circuit
by substituting each unitary operation with its noisy counterpart, namely Ûi ρ̂Ûi† → Ûi Λi [ρ̂]Ûi† , where Λi is a
CPTP noisy map and ρ̂ is the N -qubit state. If we focus on a single gate Ûi , the two corresponding circuits are
represented as

Ui → Λi Ui (5.98)

Now, the point is if we can invert the CPTP map Λi via the application of its inverse Λ−1 i . In general, this is
not possible. Indeed, typically, Λ−1
i is not a CPTP map and thus such an inverse operation of the noise cannot
be implemented. Nevertheless, such an operation can be implemented on average.
Consider the toy model of a single qubit, where the unitary noiseless operation is the identity: Û = 1̂, and
the noise channel is the bit-flip with a probability p. Thus, the corresponding map is

Λ(ρ̂) = (1 − p)1̂ρ̂1̂ + pσ̂x ρ̂σ̂x . (5.99)

This map corresponds to the unravelling with two components: with a probability p one applies an extra gate X,
and with probability (1 − p) one does nothing, i.e. applies the gate 1. Notably, both these gates have an inverse.
Indeed, 1̂−1 = 1̂ and σ̂x−1 = σ̂x . Then, we construct the inverse noise map Λ−1 as having two components: with
a probability q we apply an X gate, and with a probability (1 − q) we apply an 1 gate. The corresponding total
circuit can be then decomposed in the four components:




 1 1 1 a), with prob = (1 − p)(1 − q),







 X 1 1 b), with prob = (1 − p)q,
Λ −1 Λ 1 = (5.100)



 1 X 1 c), with prob = p(1 − q),







 X X 1 d), with prob = pq.

Now, we want to fix q such that, under the ensemble average, the circuit b) occurs with a probability being the
opposite value of that of circuit c) occuring, and that the sum of the probabilities of having the circuit a) and
d) gives 1. This implies the following system of equations
84 5 Dynamical Decoupling and Quantum Error Mitigation

Pa Pd = (1 − p)(1 − q) + pq = 1, and Pb Pc = (1 − p)q + p(1 − q) = 0. (5.101)

The solution is given by


−p
q= , (5.102)
1 − 2p
which is a quasi-probability, since it can take negative values, and it is shown in the left panel of Fig. 5.3. Now,

4
12

2 10

8
0
q

γ
6

-2 4

2
-4
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
p p

Fig. 5.3: Quasi-probability q (left panel) and renormalisation constant γ (right panel) as a function of the
probability p of having an error.

the inverse noise map Λ−1 is given by

Λ−1 (ρ̂) = (1 − q)1̂ρ̂1̂ + qσ̂x ρ̂σ̂x ,


= sgn(1 − q)|1 − q|1̂ρ̂1̂ + sgn(q)|q|σ̂x ρ̂σ̂x , (5.103)
 
= γ S1 P1 1̂ρ̂1̂ + SX PX σ̂x ρ̂σ̂x ,

where in the first line we used x = sgn(x)|x|, with sgn indicating the sign function, and in the second line we
introduced
γ = |1 − q| + |q|, (5.104)
which is represented in the right panel of Fig. 5.3. Finally, we defined

|1 − q|
S1 = sgn(1 − q), P1 = ,
γ
(5.105)
|q|
SX = sgn(q), PX = .
γ
Thus, independently from the unravelling of the noise map, i.e. without knowing if the bit-flip noise is applied
or not, we apply the map Λ−1 in the last line of Eq. (5.103). This can be implemented with the following circuit:


 M1
⟨M ⟩ 


 1 Λ 1 S1 a), with prob = P1 ,
Λ−1 Λ 1 CPP =

 MX



 SX b), with prob = PX .
X Λ 1
(5.106)
5.2 Quantum Error Mitigation 85

A classical post-processing (CPP) is applied to multiplicate the outcome of the result by the proper sign factor.
Eventually, the mitigated result is given by

⟨M ⟩ = γ (S1 P1 M1 + SX PX MX ) . (5.107)

This is an unbiased estimator. The cost of the mitigation procedure goes in the variance, which grows by a
factor γ 2 compared to the unmitigated one.

Consider a more general case of the noise map Λ acting on a single qubit, which reads

Λ(ρ̂) = λ0 ρ̂ + λ1 σ̂x ρ̂σ̂x + λ2 σ̂y ρ̂σ̂y + λ3 σ̂z ρ̂σ̂z , (5.108)

where
3
X
λα ≥ 0, and λα = 1. (5.109)
α=0

Such a map is a CPTP map. Similarly as done above, we construct the inverse map Λ−1 as

Λ−1 (ρ̂) = q0 ρ̂ + q1 σ̂x ρ̂σ̂x + q2 σ̂y ρ̂σ̂y + q3 σ̂z ρ̂σ̂z , (5.110)

where we require that


3
X
qα = 1, (5.111)
α=0

but we do not add any restriction on the sign of qα . Then, in terms of unravellings, we have 4 possible evolutions
provided by Λ and 4 by Λ−1 for a total of 16 possible mappings. Explicitly they give

Λ Λ−1 ρ̂ → ρ̂′ probability Pαβ


1̂ 1̂ ρ̂ λ0 q0
1̂ σ̂x σ̂x ρ̂σ̂x λ0 q1
1̂ σ̂y σ̂y ρ̂σ̂y λ0 q2
1̂ σ̂z σ̂z ρ̂σ̂z λ0 q3
σ̂x 1̂ σ̂x ρ̂σ̂x λ1 q0
σ̂x σ̂x σ̂x2 ρ̂σ̂x2 λ1 q1
σ̂x σ̂y σ̂x σ̂y ρ̂σ̂y σ̂x λ1 q2
σ̂x σ̂z σ̂x σ̂z ρ̂σ̂z σ̂x λ1 q3 (5.112)
σ̂y 1̂ σ̂y ρ̂σ̂y λ2 q0
σ̂y σ̂x σ̂y σ̂x ρ̂σ̂x σ̂y λ2 q1
σ̂y σ̂y σ̂y2 ρ̂σ̂y2 λ2 q2
σ̂y σ̂z σ̂y σ̂z ρ̂σ̂z σ̂y λ2 q3
σ̂z 1̂ σ̂z ρ̂σ̂z λ3 q0
σ̂z σ̂x σ̂z σ̂x ρ̂σ̂x σ̂z λ3 q1
σ̂z σ̂y σ̂z σ̂y ρ̂σ̂y σ̂z λ3 q2
σ̂z σ̂z σ̂z2 ρ̂σ̂z2 λ3 q3

However, we can exploit that σ̂α2 = 1̂ and that σ̂i σ̂j = iϵijk σ̂k . Thus, the above table becomes
86 5 Dynamical Decoupling and Quantum Error Mitigation

Λ Λ−1 ρ̂ → ρ̂′ probability Pαβ


1̂ 1̂ ρ̂ λ0 q0
1̂ σ̂x σ̂x ρ̂σ̂x λ0 q1
1̂ σ̂y σ̂y ρ̂σ̂y λ0 q2
1̂ σ̂z σ̂z ρ̂σ̂z λ0 q3
σ̂x 1̂ σ̂x ρ̂σ̂x λ1 q0
σ̂x σ̂x ρ̂ λ1 q1
σ̂x σ̂y σ̂z ρ̂σ̂z λ1 q2
σ̂x σ̂z σ̂y ρ̂σ̂y λ1 q3 (5.113)
σ̂y 1̂ σ̂y ρ̂σ̂y λ2 q0
σ̂y σ̂x σ̂z ρ̂σ̂z λ2 q1
σ̂y σ̂y ρ̂ λ2 q2
σ̂y σ̂z σ̂x ρ̂σ̂x λ2 q3
σ̂z 1̂ σ̂z ρ̂σ̂z λ3 q0
σ̂z σ̂x σ̂y ρ̂σ̂y λ3 q1
σ̂z σ̂y σ̂x ρ̂σ̂x λ3 q2
σ̂z σ̂z ρ̂ λ3 q3

Finally, we impose that the sum of the probabilities of getting ρ̂′ = ρ̂ should be 1, and those such ρ̂′ ̸= ρ̂ should
be 0. Namely
P00 + P11 + P22 + P33 = λ0 q0 + λ1 q1 + λ2 q2 + λ3 q3 = 1,
P01 + P10 + P23 + P32 = λ0 q1 + λ1 q0 + λ2 q3 + λ3 q2 = 0,
(5.114)
P02 + P20 + P13 + P31 = λ0 q2 + λ2 q0 + λ1 q3 + λ3 q1 = 0,
P03 + P30 + P12 + P21 = λ0 q3 + λ3 q0 + λ1 q2 + λ2 q1 = 0.
The solution to this system of linear equations gives
 
1 1 1 1
q0 = 1+ + + ,
4 1 − 2λ1 − 2λ2 1 − 2λ1 − 2λ3 1 − 2λ2 − 2λ2
 
1 1 1 1
q1 = 1− − + ,
4 1 − 2λ1 − 2λ2 1 − 2λ1 − 2λ3 1 − 2λ2 − 2λ2
  (5.115)
1 1 1 1
q2 = 1− + − ,
4 1 − 2λ1 − 2λ2 1 − 2λ1 − 2λ3 1 − 2λ2 − 2λ2
 
1 1 1 1
q3 = 1+ − − .
4 1 − 2λ1 − 2λ2 1 − 2λ1 − 2λ3 1 − 2λ2 − 2λ2

The inverse map can be rewritten as


3
X
Λ−1 (ρ̂) = qα σ̂α ρ̂σ̂α ,
α=0
3
X
= sgn(qα )|qα |σ̂α ρ̂σ̂α , (5.116)
α=0
3
X
=γ Sα Pα σ̂α ρ̂σ̂α ,
α=0

where
3
X |qα |
γ= |qα |, Sα = sgn(qα ), and Pα = . (5.117)
α=0
γ
5.2 Quantum Error Mitigation 87

Then, the mitigated result is given by


3
X
⟨M ⟩ = γ Sα Pα Mα , (5.118)
α=0

where Mα is the outcome obtained from the measurement at the end of the circuit at whose beginning we
applied σ̂α .

The application of PEC mitigation works if one has an almost perfect knowledge of the noise. However, for
such a characterisation for N qubits, one needs to quantify 4N − 1 parameters, where 4 is the dimensions of the
single-qubit algebra and 1 degree of freedom is fixed as it corresponds to the map given by 1̂⊗N whose associated
probability is given by the unity minus the sum of all the other probabilities. To be quantitative, for 2 qubits
one needs 15 parameters, for 10 qubits these become ∼ 106 , and for 50 qubits we have ∼ 1030 parameters.
Therefore, it is an approach that requires too many classical processing to be used for a large number of qubits.
Appendix A
Solutions of the exercises

A.1 Solution to Exercise 1.1

To express the Hadamard gate H as a rotation, we proceed as follows. We consider the general rotation

R̂n (θ) = cos(θ/2)1̂ − i sin (θ/2)n · σ̂, (A.1)

of an angle θ around n, where the Pauli matrices are


     
01 0 −i 1 0
X= , Y = , Z= . (A.2)
10 i 0 0 −1

From such a rotation, we want to obtain  


1 1 1
H=√ . (A.3)
2 1 −1
First thing, we highlight that the sum X + Z gives
 
1 1
X +Z = , (A.4)
1 −1

then it follows that


X +Z
H= √ = { √12 , 0, √12 } · σ̂. (A.5)
2
Such an expression recalls the last term in Eq. (A.1). Finally, we need to set the angle θ so that the first term
in Eq. (A.1) vanishes. This is θ = π. Then

H = iR̂n (π), where n = { √12 , 0, √12 }, (A.6)

gives the solution.

A.2 Solution to Exercise 1.2

To prove that, given two fixed non-parallel normalised vectors n and m, any unitary Û can be expressed as

Û = eiα R̂n (β)R̂m (γ)R̂n (δ), (A.7)

with α, β, γ, δ ∈ R, then one needs to recast Û in the form

88
A.3 Solution to Exercise 1.3 89

Û = eiα R̂t (ω), (A.8)

with α ∈ R and t ∈ R3 suitably chosen.


The first step of the proof is to write (m · σ̂)(n · σ̂) in terms of a single Pauli matrix vector σ̂. We have

(m · σ̂)(n · σ̂) = (m1 σ̂x + m2 σ̂y + m3 σ̂z )(n1 σ̂x + n2 σ̂y + n3 σ̂z ),
(A.9)
= m · n + m1 n2 σ̂x σ̂y + m1 n3 σ̂x σ̂z + m2 n1 σ̂y σ̂x + m2 n3 σ̂y σ̂z + m3 n1 σ̂z σ̂x + m3 n2 σ̂z σ̂y .

By applying
σ̂i σ̂j = δij 1̂ + iϵijk σ̂k , (A.10)
we have that Eq. (A.9) becomes

(m · σ̂)(n · σ̂) = (m · n)1̂ + i(m × n) · σ̂. (A.11)

The second step is to consider the composition of two rotations:


 
R̂m (γ)R̂n (δ) = cos(γ/2)1̂ − i sin (γ/2)m · σ̂ cos(δ/2)1̂ − i sin (δ/2)n · σ̂ ,
= cos(γ/2) cos(δ/2)1̂ − i cos(γ/2) sin (δ/2)n · σ̂ − i cos(δ/2) sin (γ/2)m · σ̂ (A.12)
− sin (γ/2) sin (δ/2)(m · σ̂)(n · σ̂).

Substituting Eq. (A.11) in the last expression, we find that

R̂m (γ)R̂n (δ) = R̂h (ϵ) = cos(ϵ/2)1̂ − i sin (ϵ/2)h · σ̂, (A.13)

where ϵ and h are taken such that


cos(ϵ/2) = cos(γ/2) cos(δ/2) − sin (γ/2) sin (δ/2)m · n,
(A.14)
sin(ϵ/2)h = cos(γ/2) sin (δ/2)n + cos(δ/2) sin (γ/2)m + sin (γ/2) sin (δ/2)(m × n).

Then, we have
R̂n (β)R̂m (γ)R̂n (δ) = R̂n (β)R̂h (ϵ) = R̂t (ω), (A.15)
where we applied again the composition of two rotations, which ends the proof.

A.3 Solution to Exercise 1.3

Consider two qubits, where the first is prepared in the superposition

|0⟩ + |1⟩
|ψ1 ⟩ = √ , (A.16)
2
while the second is initialised in the ground state |ψ2 ⟩ = |0⟩. The total state is

|0⟩ + |1⟩ |00⟩ + |10⟩


|ψ12 ⟩ = √ |0⟩ = √ . (A.17)
2 2
From the first expression, one clearly sees that the state is separable. By appling the CNOT gate, we find that
the state becomes
|00⟩ + |11⟩
|ψ12 ⟩ = √ , (A.18)
2
which is a fully entangled state.
90 A Solutions of the exercises

A.4 Solution to Exercise 1.4

Consider the circuit


|0⟩ H S† H
(A.19)
|ψ⟩ U

Its action is the following


Ĥ⊗1̂
|0⟩ |ψ⟩ −−−→ √1 (|0⟩ + |1⟩) |ψ⟩
2

Ŝ ⊗1̂
−−−→ √1 (|0⟩ − i |1⟩) |ψ⟩
2
C(U )
−−−→ √1 (|0⟩ |ψ⟩ − i |1⟩ Û |ψ⟩) (A.20)
2
h i
Ĥ⊗1̂
−−−→ 12 (|0⟩ + |1⟩) |ψ⟩ − i(|0⟩ − |1⟩)Û |ψ⟩
h i
= 12 |0⟩ (1̂ − iÛ ) |ψ⟩ + |1⟩ (1̂ + iÛ ) |ψ⟩ .

Finally, one measures qubit 0, and the probability of finding the qubit in |0⟩ is
    
P (|0⟩) = 41 ⟨ψ| 1̂ + iÛ † 1̂ − iÛ |ψ⟩ = 12 1 + ℑ ⟨ψ|Û |ψ⟩ , (A.21)

which ends the exercise.

You might also like