Docsity
Docsity

Prepare-se para as provas
Prepare-se para as provas

Estude fácil! Tem muito documento disponível na Docsity


Ganhe pontos para baixar
Ganhe pontos para baixar

Ganhe pontos ajudando outros esrudantes ou compre um plano Premium


Guias e Dicas
Guias e Dicas


A Short Introduction to Quantum Computing for Physicists, Notas de aula de Computação Quântica

Introdução sobre computação quântica para estudantes de física. O documento aborda as partes básicas da computação quântica, desde portas lógicas até algoritmos.

Tipologia: Notas de aula

2026

Compartilhado em 19/06/2026

erberson-pinheiro
erberson-pinheiro 🇧🇷

1 documento

1 / 66

Toggle sidebar

Esta página não é visível na pré-visualização

Não perca as partes importantes!

bg1
arXiv:2306.09388v2 [quant-ph] 22 Aug 2024
A Short Introduction to
Quantum Computing for Physicists
Oswaldo Zapata
Abstract
These notes provide an introduction to standard topics on quantum compu-
tation and communication for those who already have a basic knowledge of
quantum mechanics. The main target audience are professional physicists
as well as advanced students of physics; however, engineers and computer
scientists may also benefit from them.
1 Introduction 2
2 Quantum Bits 3
2.1 Classical Bits ............................... 4
2.2 Single Qubits ............................... 4
2.3 Multiple Qubits .............................. 6
3 Quantum Circuits 9
3.1 Classical Circuit Gates .......................... 9
3.2 Single-Qubit Gates ............................ 11
3.3 Multiple Single-Qubit Gates ....................... 15
3.4 Multi-Qubit Gates ............................ 18
3.5 Measurement ............................... 28
4 Quantum Algorithms 33
4.1 Deutsch’s Algorithms ........................... 34
4.2 Shor’s Factoring Algorithm ........................ 41
4.3 Superdense Coding and Teleportation .................. 46
4.4 Quantum Simulation ........................... 49
5 Quantum Error Correction 53
5.1 Entanglement with the Environment .................. 54
5.2 Classical Error Correction ........................ 57
5.3 Generalities on QEC Codes ....................... 59
5.4 Single Qubit Error Correction ...................... 60
6 Bibliography 63
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42

Pré-visualização parcial do texto

Baixe A Short Introduction to Quantum Computing for Physicists e outras Notas de aula em PDF para Computação Quântica, somente na Docsity!

arXiv:2306.09388v2 [quant-ph] 22 Aug 2024

A Short Introduction to

Quantum Computing for Physicists

Oswaldo Zapata

Abstract These notes provide an introduction to standard topics on quantum compu- tation and communication for those who already have a basic knowledge of quantum mechanics. The main target audience are professional physicists as well as advanced students of physics; however, engineers and computer scientists may also benefit from them.

1 Introduction 2

2 Quantum Bits 3 2.1 Classical Bits............................... 4 2.2 Single Qubits............................... 4 2.3 Multiple Qubits.............................. 6

3 Quantum Circuits 9 3.1 Classical Circuit Gates.......................... 9 3.2 Single-Qubit Gates............................ 11 3.3 Multiple Single-Qubit Gates....................... 15 3.4 Multi-Qubit Gates............................ 18 3.5 Measurement............................... 28

4 Quantum Algorithms 33 4.1 Deutsch’s Algorithms........................... 34 4.2 Shor’s Factoring Algorithm........................ 41 4.3 Superdense Coding and Teleportation.................. 46 4.4 Quantum Simulation........................... 49

5 Quantum Error Correction 53 5.1 Entanglement with the Environment.................. 54 5.2 Classical Error Correction........................ 57 5.3 Generalities on QEC Codes....................... 59 5.4 Single Qubit Error Correction...................... 60

6 Bibliography 63

1 Introduction

The goal of the present notes is to introduce the theoretical framework a trained physicist needs to get into quantum computing. Thus, if you are a physicist and you want to learn the basics of quantum computing, these notes are for you. In a matter of hours (maybe dedicating an entire weekend), you will be able to learn all the basics of quantum computer science. If, as I suppose, you are a physicist, then at some point in your career you took a proper course on quantum mechanics. Of course, I do not assume that you remember everything you studied then, however, I do assume that you already went through all the standard topics as found in the books by Sakurai or Cohen Tannoudji et al. This will allow me to focus on aspects of quantum computing that I think are new to you as a physicist. That said, if you think that you forgot most of what you learned about quantum mechanics, you should not worry. Sincerely speaking, the use of quantum mechanics in quantum computing is relatively simple. Moreover, to help you, in general I recall the main physical and mathematical concepts and I provide explicit calculations so you can easily follow what I am explaining. Quantum computing is usually described as lying at the intersection of quantum mechanics, mathematics and computer science. As I said, I assume that you studied quantum mechanics. Now, concerning mathematics, I am afraid that most physi- cists are not familiar with the way computer scientists learn the subject. Here I am not referring, of course, to the mathematics used in quantum mechanics, such as linear algebra, but to subjects like formal logic, models of computation or com- plexity theory. Since I am not an expert in the field, I will simply sketch the main ideas without entering too many details. The interested reader may look at the appropriate literature. Concerning the most basic notions of computer science, such as Boolean algebra and circuits, I assume that you are barely familiar with them (maybe at the level of the first few lines of a Wikipedia article). The notes are organized as follows: In Section 2, I introduce the quantum systems relevant to quantum computing and review the mathematical formalism necessary to understand them. In Section 3, I describe how these quantum systems can be manipulated and measured. In Section 4, I review some clever ways physicists and computer scientists have found, at least theoretically, to modify the quantum sys- tems in order to compute certain tasks more efficiently than classical computational methods. In Section 5, I explain how the destructive effect of the environment can be reduced so it does not destroy the quantum nature of the system. A short comment on the organization of these notes. While Sections 2 and 3 must be read one after the other, Sections 4 and 5 are rather independent of each other. So, after reading Sections 2 and 3, read Sections 4 and 5 in the order that suits you. The Boxes you find within the main text contain additional material that I con- sider supplementary. Some of them review topics that I assume you already know and some others expand the main text. My recommendation is that while reading these notes, you give a quick glimpse at the Boxes to see what they are about and, depending on your knowledge, read or skip them. If you decide to skip them, you can always come back to them at a later time. Concerning the Exercises, I have added them to help you understand and become familiar with the subject, not to make you smarter. So, try to do them; they are relatively easy.

2.1 Classical Bits

As you certainly already know, the language spoken by ordinary computers is the bi- nary system. The latter assumes that every piece of information, for example, a num- ber, a letter or a color, has a unique expression as a finite sequence of zeros and ones. In the binary system, the number 39 is written 100111. Sometimes, by convention, the sequence 01000001 is assigned to the letter A and 11111111 00000000 00000000 to the color red. These sequences of zeros and ones are called bit strings and are somehow equivalent to the words used by humans. Each individual digit of a binary string is called a bit (from binary digit) and is the most basic piece of classical information. This is the analog of the letters used in alphabetic languages. The number of bits in a bit string is known as the size of the string. Here we will only be interested in the binary system applied to numbers. If you are given a positive integer number N in the usual decimal system, the corresponding binary string will be given by the following formula,

N = 2n−^1 b 1 + 2n−^2 b 2 +... + 2^0 bn ←→ b 1 b 2... bn. (2.1)

For example,

39 = 2^5 b 1 + 2^4 b 2 + 2^3 b 3 + 2^2 b 4 + 2^1 b 5 + 2^0 b 6 = 2^5 1 + 2^4 0 + 2^3 0 + 2^2 1 + 2^1 1 + 2^01 ,

thus, 39 ←→ 100111.

Exercise 2.1. Write the bit string equivalent to every natural number from 1 to

Exercise 2.2. Express 56 and 83 in binary notation.

2.2 Single Qubits

The words a quantum computer understands, that is, the carriers of information, are called quantum bits or qubits, for short. The simplest piece of quantum information is the single qubit or 1 qubit. It is a two-level quantum system described by a complex two-dimensional unit state vector

|ψ〉 = a|ϕ 1 〉 + b|ϕ 2 〉 , (2.2)

where a and b are complex numbers, a, b ∈ C^2 , and the vectors |ϕ 1 〉 and |ϕ 2 〉 are two arbitrary orthonormal vectors spanning the Hilbert space H ∼= C^2 where the qubit |ψ〉 lives. The real number |a|^2 is the probability of measuring the system in the state |ϕ 1 〉 and |b|^2 the probability of measuring it in |ϕ 2 〉. Of course, since the only possible outcomes of a measurement are |ϕ 1 〉 and |ϕ 2 〉, it follows that |a|^2 + |b|^2 = 1. I remind you that the basis vectors |ϕ 1 〉 and |ϕ 2 〉 are chosen to be orthonormal, that is, 〈ϕr|ϕs〉 = δrs, where r, s = 1, 2, because we want the two states to be perfectly distinguishable. The symbol 〈 | 〉, of course, indicates the inner product on the Hilbert space H.

Exercise 2.3. How is the inner product on a Hilbert space usually defined?

If you are the sort of person that prefers to have a physical picture in mind, you may think of a qubit as an electron with two possible spins, a spin up | ↑ 〉 and a spin down | ↓ 〉, a photon with a vertical | ↑ 〉 and a horizontal | → 〉 polarization, or an atom with two energy level states |E 0 〉 and |E 1 〉. We will not use explicitly any of these physical representations; however, at times it can be handy to have these pictures in mind. This is somehow analogous to the correspondence made in classical circuit theory between the binary values 0 and 1 and a zero or non-zero voltage, respectively, along a piece of wire. In both cases, classical and quantum, a purely theoretical discussion can be carried out without paying attention to any of these real implementations. This is the approach we will take in these notes. Even though you already studied most of the quantum mechanics used in quantum computing, there are various conventions and original points of view that are worth following. To begin, we will express the state vector of a single qubit as follows,

|q〉 = α 0 | 0 〉 + α 1 | 1 〉. (2.3)

The notation |q〉 is unconventional. In fact, as usual in quantum mechanics, most authors use |ψ〉. However, we follow the standard convention employed in quantum computing and denote the orthonormal basis vectors by | 0 〉 and | 1 〉 to emphasize the similitude with the classical binary system. The set {| 0 〉, | 1 〉} is known as the computational basis. If a state vector, say |i〉, can only take the values | 0 〉 or | 1 〉, it is usual to simplify the notation by writing i ∈ { 0 , 1 } or i = 0, 1 instead of |i〉 ∈ {| 0 〉, | 1 〉}. Notice that in our notation, if i, j = 0, 1, then 〈i|j〉 = δij. We will use Hq ∼= C^2 to refer to the Hilbert space of a single qubit. Another useful set of orthonormal vectors in the Hilbert space of a single qubit Hq is the so called Hadamard basis {|+〉, |−〉}. The latter is given in terms of the computational basis vectors by

|+〉 =

The converse relations are

| 0 〉 =

The state vector |q〉 of a single qubit can then be rewritten as |q〉H = α+|+〉+α−|−〉, where

α+ =

α 0 + α 1 √ 2

, α− =

α 0 − α 1 √ 2

According to definition (2.3), the state vector of a single qubit is a function of the two complex numbers α 0 and α 1. That is, we can write more explicitly

|q(α 0 , α 1 )〉 = α 0 | 0 〉 + α 1 | 1 〉. (2.7)

Now, since two complex numbers are equivalent to four real numbers and the nor- malization condition imposes that |α 0 |^2 + |α 1 |^2 = 1, these four numbers reduce to three. Additionally, since two state vectors that differ by a global phase, in fact represent the same physical system, the three real numbers finally reduce to two. The new variables, that we denote θ and φ, with θ ∈ [0, π] and φ ∈ [0, 2 π), can be chosen so that |α 0 | = cos(θ/2) , |α 1 | = sin(θ/2). (2.8)

Note that |α 0 |^2 + |α 1 |^2 is still equal to 1.

Following the same notation, the state vector of a 2 qubit is simply

|q 2 〉 = α 00 |0 0〉 + α 01 |0 1〉 + α 10 |1 0〉 + α 11 |1 1〉 =

i,j

αij |ij〉 , (2.14)

where i, j = 0, 1. From now on, to avoid cluttering the formulas, we will assume that — unless otherwise indicated — the indices i, j, k under the summation symbol take the values 0 and 1. By convention, the first element in the ket |i j〉 represents a computational basis vector of Hq 1 and the second element a basis vector of Hq 1 ′. Thus, 〈i j|k l〉 = 〈i|k〉〈j|l〉 = δikδjl. The mutually orthonormal states | 00 〉, | 01 〉, | 10 〉 and | 11 〉 form the computational basis of Hq 2.

Exercise 2.7. Do you remember how the inner product on Hq 2 is given in terms of the inner products on the individual Hilbert spaces Hq 1 and Hq 1 ′?

Note: If you had problems understanding the beginning of this section, I recom- mend you to read the following Box. It summarizes the main mathematical concepts and conventions we will use to describe multiple qubits. If you understood every- thing, then you can confidently skip it.

Box 2.1. Tensor product spaces. A 2 qubit, simply put, is the composite system of two single qubits. Here we must remember that, since the single qubits can interact between them, the complete description of the whole 2 qubit system may contain information that is not available at the level of the individual qubits. The Hilbert space Hq 2 of the composite system is given by the tensor product of the two individual Hilbert spaces,

Hq 2 = Hq ⊗ Hq′^. (2.15) This means the following: given the single qubits |q〉, |q˜〉 ∈ Hq and |q′〉, |q˜′〉 ∈ Hq′ , the tensor product of two vectors is a map

⊗ : Hq ⊗ Hq′^ → Hq ⊗ Hq′^ , (2.16) which satisfies

c(|q〉 ⊗ |q′〉) = (c|q〉) ⊗ |q′〉 = |q〉 ⊗ (c|q′〉) , (2.17) for every complex constant c, and

|q〉 ⊗ (|q′〉 + |q˜′〉) = |q〉 ⊗ |q′〉 + |q〉 ⊗ |q˜′〉 , (2.18) (|q〉 + |q˜〉) ⊗ (|q′〉) = |q〉 ⊗ |q′〉 + |q˜〉 ⊗ |q′〉. (2.19) We can use this definition of the tensor product between vectors to define the tensor product between entire Hilbert spaces. If {| 0 〉, | 1 〉} is a basis for Hq and {| 0 ′〉, | 1 ′〉}, is a basis for Hq′ , the tensor product of these basis vectors, that is, | 0 〉 ⊗ | 0 ′〉, | 0 〉 ⊗ | 1 ′〉, | 1 〉 ⊗ | 0 ′〉 and | 1 〉 ⊗ | 1 ′〉 are basis vectors for Hq 2 = Hq ⊗ Hq′. In other words, every element |q 2 〉 in Hq 2 has a unique expression of the form

|q 2 〉 =

i,j′

αij′^ |i〉 ⊗ |j′〉 , (2.20)

where the coefficients αij′ are complex numbers. Often, to lighten the notation, one drops the symbol ⊗ between the vectors. Additionally, one simply writes |j〉 instead of |j′〉 because it is clear that the second basis vector is in Hq′. Thus, Hq 2 ∋ |q 2 〉 =

i,j

αij |i〉|j〉 ∈ Hq ⊗ Hq′. (2.21)

A further simplification is to write |i j〉 instead of |i〉|j〉:

|q 2 〉 =

i,j

αij |i j〉. (2.22)

The inner product on the Hilbert space Hq 2 is related to the inner products on Hq and Hq′ by the following formula,

〈q 2 |q′ 2 〉 =

i,j

αij |i j〉,

k,l

α′ kl|k l〉

i,j,k,l

α∗ ij α′ kl〈i j|k l〉

i,j,k,l

α∗ ij α′ kl〈i|k〉〈j|l〉 =

i,j

α∗ ij α′ ij. (2.23)

Exercise 2.8. How would you define the tensor product between n single- qubit Hilbert spaces?

Remember that composite quantum systems, such as 2 qubits, can be entangled, namely, can be in a physical state whose corresponding vector cannot be written as the tensor product of single qubits. In other words, an entangled state is not a product state. What we mean by this is the following: if we multiply two single qubits,

|q〉|q′〉 =

α 0 | 0 〉 + α 1 | 1 〉

α 0 ′ | 0 ′〉 + α 1 ′ | 1 ′〉

= α 0 α 0 ′|0 0〉 + α 0 α′ 1 |0 1〉 + α 1 α′ 0 |1 0〉 + α 1 α′ 1 |1 1〉

=

i,j

αiα′ j |i j〉 , (2.24)

the entangled states in Hq 2 are those for which αij 6 = αiα′ j. Entangled states are a purely quantum phenomenon. They generally result from the interaction of two or more quantum systems.

Exercise 2.9. Convince yourself that 1/

2(|0 0〉 + |1 1〉) is an entangled state. For 3 qubits, the definition is similar: |q 3 〉 ∈ Hq 3 = Hq′ 1 ⊗ Hq′′ 1 ⊗ Hq′′′ 1 ∼= C^2 3

. In the computational basis {|i j k〉} of Hq 3 ,

|q 3 〉 =

i,j,k

αijk|i j k〉. (2.25)

Exercise 2.10. What condition is satisfied by the entangled states in Hq 3?

Exercise 2.11. Does the 3-qubit state vector 1/

2(|0 0 0〉 + |1 1 1〉), known as the GHZ state, represents an entangled system?

processes them and at the end it delivers a new string of zeros and ones (the output). This process, which can be mechanical, electric, or of any other physical nature, is in general expressed mathematically by a function f from the space of bit strings of size l to the space of bit strings of size m, f : { 0 , 1 }l^ → { 0 , 1 }m. These functions are called(vector-valued) Boolean functions. Here we are interested in these functions, that is, in the way the device processes information. Computer science is a subject that, at least as we approach it here, is at its core in part theoretical and in part practical. Let us say we have a Boolean function f : { 0 , 1 }l^ → { 0 , 1 }m^ and we want to build a device that performs the same operation as f. How should we proceed? Theoretical computer scientists have arrived at the conclusion that any binary function f , no matter how difficult it is, can always be reconstructed by using a combination of functions that are actually easier to materialize in the real world. These more elementary functions are called elementary or basic logic gates. This is the essence of the classical circuit model of computation. The NOT gate is one of these classical basic functions,

NOT : { 0 , 1 } → { 0 , 1 } , b 7 → NOT(b) = ¯b. (3.1)

The bar over the letter b denotes the logic negation of the bit b. In simple words, if the input is 0, then the output is 1, and vice versa. We can also represent the action of the NOT gate on a bit as follows,

0 NOT 7 −−−−→ 1 , 1 NOT 7 −−−−→ 0. (3.2)

The next basic gate is the OR gate,

OR : { 0 , 1 }^2 → { 0 , 1 } , b 1 b 2 7 → OR(b 1 b 2 ) , (3.3)

given explicitly by,

0 0 7 −−OR−→ 0 , 0 1 7 −−OR−→ 1 , 1 0 7 −−OR−→ 1 , 1 1 7 −−OR−→ 1. (3.4)

Note that, in contrast to the NOT gate, the input of an OR gate is a string of size

  1. So, we call it a 2-bit gate. The last basic gate on our list is the AND gate,

AND : { 0 , 1 }^2 → { 0 , 1 } , b 1 b 2 7 → AND(b 1 b 2 ) , (3.5)

which transforms

0 0 7 −−AND−−→ 0 , 0 1 7 −−AND−−→ 0 , 1 0 7 −−AND−−→ 0 , 1 1 7 −−AND−−→ 1. (3.6)

The result we referred above establishes that any Boolean function f : { 0 , 1 }l^ → { 0 , 1 }m^ can be expressed as a composition of these elementary gates. It is then said that the gates NOT, OR and AND form a universal set of (classical) (logic) gates. Just as every component of an electric circuit has a visual representation, the three electronic gates just mentioned have also a corresponding circuit diagram,

NOT OR AND

Fig. 2. Three classical basic electronic gates.

By convention, the inputs enter from the left of the gate and the outputs exist from the right. The double lines represent the wires through which the data, namely, the bit strings, flow to go from one gate to the next. A classical circuit, which, as we said, can always be made using only the NOT, OR and AND gates, will consequently have an associated visual representation, in general a convoluted circuit diagram, showing every single element necessary to build it and the relative position between them.

3.2 Single-Qubit Gates

As well as every Boolean function can be thought of as a concatenation of elementary logic gates, we will see that any unitary transformation on a qubit can be decomposed into a sequence of elementary quantum gates. As you know, according to quantum mechanics, the evolution of a quantum system is given by the action of a unitary operator on the state vector that describes the system at some moment in time. That is, if our quantum system is an n qubit,

it will evolve from its initial state |Q 0 〉 to its final state |Qf 〉 according to |Q 0 〉 7 −→U |Qf 〉 = U|Q 0 〉. In quantum computing, unitary transformations acting on qubit state vectors, especially when the number of qubits is small, are also called (quantum logic) gates or unitaries. In this subsection we will only deal with unitaries on single qubits.

|q〉 U U |q〉

Fig. 3. Circuit diagram of a single-qubit gate.

As for classical circuits, the qubits move from left to right. However, notice that we use single lines to represent the quantum communication channels (to distinguish them from the double lines we used above for classical wires).

Exercise 3.1. Why quantum transformations must be unitary, U−^1 = U†?

Because the Hilbert space of a single qubit is a 2-dimensional vector space, it is usual to express the computational basis vectors in column vector notation,

[

]

[

]

Exercise 3.2. Show that the matrices assigned to the computational basis vectors are indeed consistent with the orthonormality condition we imposed on them.

With this choice, the state vector of the single qubit (2.3) has the column vector form

|q〉 = α 0

[

]

  • α 1

[

]

[

α 0 α 1

]

Correspondingly, its evolution will be determined by a single-qubit gate represented by a 2 × 2 matrix

U =

[

U 00 U 01

U 10 U 11

]

Exercise 3.5. Show that every Pauli matrix σa is its own inverse, that is, (σa)^2 = I, where I is the identity matrix. Verify that, however, the product of two different Pauli matrices satisfy σaσb = −σbσa.

Exercise 3.6. Prove that any complex 2 × 2 matrix can be uniquely written as a linear combination of the Pauli matrices and the identity.

If we apply the Pauli matrices on the computational basis vectors, we get

X| 0 〉 =

[

] [

]

[

]

= | 1 〉 , X| 1 〉 =

[

] [

]

[

]

Y | 0 〉 =

[

0 −i i 0

] [

]

[

i

]

= i| 1 〉 , Y | 1 〉 =

[

0 −i i 0

] [

]

[

−i 0

]

= −i| 0 〉 ,

Z| 0 〉 =

[

] [

]

[

]

= | 0 〉 , Z| 1 〉 =

[

] [

]

[

]

This set of relations established by the Pauli matrices between the computational basis vectors, allow us to define the abstract opetators

X| 0 〉 = | 1 〉 , X| 1 〉 = | 0 〉 , (3.18)

Y | 0 〉 = i| 1 〉 , Y | 1 〉 = −i| 0 〉 , (3.19)

Z| 0 〉 = | 0 〉 , Z| 1 〉 = −| 1 〉. (3.20)

Exercise 3.7. Use the formula (3.14) to check that these operators indeed have the Pauli matrices as representations.

Note that the Pauli operator X flips the computational basis vectors, X|i〉 = |¯i〉 = | 1 − i〉. So, its action is similar to the classical NOT gate, NOT(b) = ¯b = 1 − b. This explains why in quantum computing the X operator is called the bit flit gate and is usually denoted NOT.

Exercise 3.8. Compute X, Y, Z on |+〉 and |−〉. Interpret your results.

Exercise 3.9. What is the geometric interpretation of the action of the Pauli ma- trices on vectors in the Bloch sphere 1?

In ket-bra notation the Pauli operator X takes the following form,

X = | 1 〉〈 0 | + | 0 〉〈 1 |. (3.21)

Or, in terms of the Hadamard basis vectors,

X = |+〉〈+| + |−〉〈−|. (3.22)

Exercise 3.10. Find the ket-bra expressions for Y and Z.

Exercise 3.11. Using the column vector representation of the computational basis vectors | 0 〉 and | 1 〉, show that, in fact, the ket-bra expressions above reproduce the Pauli matrices.

Being Hermitian, the Pauli matrices can be used to define the following unitary operators,

Rx(α) = e−iXα/^2 , Ry(β) = e−iY β/^2 , Rz (γ) = e−iZγ/^2. (3.23)

where α, β, γ ∈ [0, 2 π). They can be written more compactly as

Ra(θa) = e−iσaθa/^2. (3.24)

The operator Ra(θa) on a single qubit (2.9) acts as a rotation of θa radians about the a axis. We can rewrite them using trigonometric functions,

Ra(θa) = cos(θa/2)I − i sin(θa/2)σa , (3.25)

Exercise 3.12. Prove the previous identity.

Exercise 3.13. Suppose that ˆn = nxˆı + nyˆ + nz kˆ is a unit normal vector on the

Bloch sphere and σ = σxˆı + σyˆ + σz ˆk. Show that a rotation of an angle θˆn about the axis defined by ˆn is given by

Rˆn(θˆn) = e−iˆn·σθˆn/^2 = cos(θˆn/2)I − i sin(θˆn/2)ˆn · σ. (3.26)

Another single-qubit gate which is extensively used in quantum computing is the Hadamard gate, defined by its action on the computational basis vectors as follows

H| 0 〉 =

| 1 〉 , H| 1 〉 =

that is, H| 0 〉 = |+〉 , H| 1 〉 = |−〉. (3.28)

Thus, if a single qubit enters a Hadamard gate, the outgoing state will be

H|q〉 = H(α 0 | 0 〉 + α 1 | 1 〉) = α 0 H| 0 〉 + α 1 H| 1 〉 = α 0 |+〉 + α 1 |−〉. (3.29)

The Hadamard gate, then, takes a state vector in the computational basis and shift it to the Hadamard basis. The converse is also true because

H|+〉 =

H| 0 〉 +

H| 1 〉 =

H|−〉 =

H| 0 〉 −

H| 1 〉 =

so,

H|q〉H = H(α+|+〉 + α−|−〉) = α+H|+〉 + α−H|−〉 = α+| 0 〉 + α−| 1 〉. (3.32)

Exercise 3.14. What is the ket-bra expression of the Hadamard gate?

Above we have chosen to introduce the Hadamard gate in terms of its abstract action on the computational basis vectors, however, we could as well have chosen the matrix viewpoint. As you can easily check (do it!), in the computational basis the Hadamard gate has the following matrix representation,

H =

[

]

As you see, these special transformations do not produce any entanglement between the single qubits of the incoming product state.

|q′〉 U 1 |q′〉 |q′′〉 U 2 |q′′〉 .. .

|q′n〉 Un |q′n〉

U

Fig. 5. A non-entangling n-qubit gate.

To be more precise, consider the action of n independent Hadamard gates on the individual qubits of an n-product state,

H ⊗... ⊗ H

|q′〉... |q′n〉

= H|q′〉... H|q′n〉. (3.39)

Let us start considering the easier cases. For a computational basis vector |i〉 ∈ Hq, a single Hadamard gate acts as follows,

|i〉 H |(−1)i^ 〉

Fig. 6. The Hadamard gate.

Another useful way to write it is

H|i〉 =

(−1)i| 1 〉 =

j

(−1)ij^ |j〉. (3.40)

Since eiπ^ = −1, a third common notation is

H|k〉 =

eiπk| 1 〉 =

j

eiπkj^ |j〉. (3.41)

Note that in the last equation we used the letter k instead of the usual i to denote the computational basis vectors. We did this simply to avoid confusion with the imaginary i. Thus, for a single qubit,

H|q〉 = H

i

αi|i〉 =

i

αiH|i〉

i

αi|(−1)i〉 =

i,j

(−1)ij^ αi|j〉 =

k,j

eiπkj^ αk|j〉. (3.42)

Exercise 3.22. Use the index expressions above to prove that, as we already know from Exercise 3.15, H(H|i〉) = |i〉.

Suppose now we have a product state |i 1 〉|i 2 〉 ∈ Hq 2 and we apply a Hadamard gate to each of the qubits,

|i 1 〉 (^) H H |i 1 〉

|i 2 〉 (^) H H |i 2 〉

Fig. 7. Two Hadamard gates in parallel.

H|i 1 〉H|i 2 〉 =

(−1)i^1 | 1 〉

(−1)i^2 | 1 〉

| 00 〉 + (−1)i^2 | 01 〉 + (−1)i^1 | 10 〉 + (−1)i^1 +i^2 | 11 〉

j 1 ,j 2

(−1)i^1 j^1 +i^2 j^2 |j 1 〉|j 2 〉. (3.43)

We can rewrite the left hand side of this equation as follows,

H|i 1 〉H|i 2 〉 = (H ⊗ 1)(1 ⊗ H)|i 1 〉|i 2 〉 = H ⊗ H|i 1 〉|i 2 〉 = H⊗^2 |i 1 i 2 〉. (3.44)

The right hand side can also be written in a more compact and general form by using the notation |x〉 = |i 1 i 2 〉. Similarly, |y〉 = |j 1 j 2 〉. Putting these contributions together, we obtain

H⊗^2 |x〉 =

y

(−1)x·y|y〉. (3.45)

Be aware that here x denotes a binary string and not a decimal number as in equation (2.27). Moreover, x · y is a sort of dot product, x · y = i 1 j 1 + i 2 j 2 , and not the multiplication of two decimal numbers. Finally, the sum over y simply means

y

j 1

j 2

j 1 ,j 2

You can easily generalize (3.45) to n Hadamard gates acting independently on n single qubits,

H⊗n|x〉 =

2 n

y

(−1)x·y|y〉 , (3.47)

where x = i 1... in, y = j 1... jn and x · y = i 1 j 1 +... + injn.

|x〉 /

n H⊗n^ /

n H⊗n^ |x〉

Fig. 8. n Hadamard gates in parallel acting on a computational basis vector of HQ.

Exercise 3.23. Explain how the general formula (3.47) is obtained by considering three qubits, four qubits, etc.

Exercise 3.24. Show that H⊗n(H⊗n|x〉) = |x〉.

and every unitary transformation on |q 2 〉 will have the general 4 × 4 matrix form

U =

U 11 U 12 U 13 U 14

U 21 U 22 U 23 U 24

U 31 U 32 U 33 U 34

U 41 U 42 U 43 U 44

 ,^ (3.54)

with Urs = U sr∗.

Exercise 3.25. Can you find a way to rename the subscripts of the matrix elements Urs of (3.54) so that the product U|q 2 〉 has a tidy form in index notation?

Box 3.1. Tensor product of operators.

In Box 2.1, we recalled the definition of the tensor product of vectors as well as of entire Hilbert spaces. Now, we want to review how operators act on the individual Hilbert spaces of composite systems. Suppose two single qubits with Hilbert spaces Hq and Hq′ and two operators acting on them,

A : Hq → Hq , |q〉 7 → A|q〉 , B : Hq′^ → Hq′^ , |q′〉 7 → B|q′〉.

Let us say we form the 2-qubit system with Hilbert space Hq 2 = Hq ⊗ Hq′. We can associate to A the operator A ⊗ 1 : Hq 2 → Hq 2 , such that

A ⊗ 1 |q 2 〉 = A ⊗ 1

i,j

αij |i j〉

i,j

αij

A|i〉

⊗ 1 |j〉 =

i,j

αij

A|i〉

|j〉.

A similar definition applies to the operator B. In general,

A ⊗ B

i,j

αij |i j〉

i,j

αij

A|i〉

B|j〉

Exercise 3.26. Show that a unitary transformation that entangles two single qubits cannot be expressed as the tensor product of two single-qubit gates.

Exercise 3.27. Generalize everything said above for a Hilbert space that is the tensor product of n single qubit spaces.

Given two operators A and B and their respective matrix representations, to the tensor product A ⊗ B we associate the matrix

A ⊗ B =

[

a 11 a 12 a 21 a 22

]

[

b 11 b 12 b 21 b 22

]

[

a 11 B a 12 B a 21 B a 22 B

]

The generalization to more than two operators and to higher order matrices is straightforward. When there is no risk of confusion, we will drop the tensor product symbol ⊗ and simply write AB for A ⊗ B.

Exercise 3.28. Explain the choice (3.52) for the basis vectors of Hq 2.

One of the simplest 2n^ × 2 n^ unitary matrix transformations (3.51) is the one formed by the tensor product of n 2 × 2 unitary matrices,

U = U 1 ⊗... ⊗ Un. (3.57)

This unitary acts on a product state |Q〉 = |q′〉 ⊗... ⊗ |q′n〉 as follows,

U|Q〉 = U 1 ⊗... ⊗ Un

|q′〉 ⊗... ⊗ |q′n〉

= U 1

|q′〉... Un|q′n〉. (3.58)

Thus, the unitary (3.57) keeps the quantum state |Q〉 unentangled. For instance, in the previous subsection we considered U 1 =... = Un = H. The advantage of a quantum computer over a classical one, though, is its ability to create and efficiently keep track of the superposition of all the possible states available to a quantum system. This includes, of course, entangled states. Thus, if we want to take full advantage of all the power of quantum mechanics, we need to introduce quantum gates that create entanglement. It can be proved that — something we will not do here — a single gate that produces entanglement, in addition to a complete set of single-qubit gates, is all we need to build any multi- qubit gate we want. The gate usually chosen is the so-called CNOT gate. We will first introduce it and then see how it enters into the production of other useful unitaries. A quantum controlled gate is a gate that operates on two qubits, one register by convention called the control qubit and the other the target qubit. While the control qubit is a single qubit and it remains unchanged when passing through the gate, the target qubit is in general an n qubit and it gets modified depending on the value of the control qubit. By definition, for c ∈ { 0 , 1 }, a controlled gate transforms

|c〉|Qt〉 7 −→ |c〉U(c)|Qt〉 , (3.59)

where U(c) is a unitary on |Qt〉 which action depends on the value of c. The controlled-U gate is defined as follows,

CU| 0 〉|Qt〉 = | 0 〉|Qt〉 , CU| 1 〉|Qt〉 = | 1 〉U|Qt〉. (3.60)

In ket-bra notation, CU = | 0 〉〈 0 | ⊗ 1 + | 1 〉〈 1 | ⊗ U. (3.61)

Its circuit diagram is:

|c〉

|Qt〉 (^) U

|ω〉

Fig. 10. The controlled-U gate.

Since there is nothing particular about the basis vector | 1 〉, we could as well have used the vector | 0 〉 to define a controlled gate. The latter is a controlled - V gate,

CV | 0 〉|Qt〉 = | 0 〉V |Qt〉 , CV | 1 〉|Qt〉 = | 1 〉|Qt〉. (3.62)

As you can show, CV = | 0 〉〈 0 | ⊗ V + | 1 〉〈 1 | ⊗ 1. (3.63)