Quantum computing for dummies Carlos Cotrini ETH Z urich - - PowerPoint PPT Presentation

quantum computing for dummies
SMART_READER_LITE
LIVE PREVIEW

Quantum computing for dummies Carlos Cotrini ETH Z urich - - PowerPoint PPT Presentation

Quantum computing for dummies Carlos Cotrini ETH Z urich ccarlos@inf.ethz.ch September 14, 2019 Carlos Cotrini (ETH Z urich) QC for dummies September 14, 2019 1 / 48 What is quantum computing? From Wikipedia: Quantum computing is


slide-1
SLIDE 1

Quantum computing for dummies

Carlos Cotrini

ETH Z¨ urich ccarlos@inf.ethz.ch

September 14, 2019

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 1 / 48

slide-2
SLIDE 2

What is quantum computing?

From Wikipedia: “Quantum computing is the use of quantum-mechanical phenomena such as superposition and entanglement to perform computation.” It can, in some cases, be much more faster than classical computing.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 2 / 48

slide-3
SLIDE 3

A toy problem

A bit array of length 2n is balanced if exactly half of its entries are zero. A bit array is constant if all its entries are zero.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 3 / 48

slide-4
SLIDE 4

A toy problem

A bit array of length 2n is balanced if exactly half of its entries are zero. A bit array is constant if all its entries are zero.

The problem

Given a bit array f of length 2n, known to be balanced or constant, decide if it is balanced.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 3 / 48

slide-5
SLIDE 5

A toy problem

A bit array of length 2n is balanced if exactly half of its entries are zero. A bit array is constant if all its entries are zero.

The problem

Given a bit array f of length 2n, known to be balanced or constant, decide if it is balanced. A classical computer takes time linear in the length of the bit array to solve this problem.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 3 / 48

slide-6
SLIDE 6

A toy problem

A bit array of length 2n is balanced if exactly half of its entries are zero. A bit array is constant if all its entries are zero.

The problem

Given a bit array f of length 2n, known to be balanced or constant, decide if it is balanced. A classical computer takes time linear in the length of the bit array to solve this problem. A quantum computer takes logarithmic time (by the Deutsch-Jozsa algorithm).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 3 / 48

slide-7
SLIDE 7

A more practical example

A quantum computer can find an element in an array of length N in O( √ N)-time (by Grover’s algorithm).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 4 / 48

slide-8
SLIDE 8

Overview

1

Background Qubits and qubit arrays Quantum gates

2

The Deutsch-Jozsa algorithm

3

Grover’s algorithm Background in linear algebra Grover’s algorithm

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 5 / 48

slide-9
SLIDE 9

Qubits

Assume I have a closed box with a cat inside.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 6 / 48

slide-10
SLIDE 10

Qubits

Assume I have a closed box with a cat inside. If it is a classical cat, then it is either dead or alive.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 6 / 48

slide-11
SLIDE 11

Qubits

Assume I have a closed box with a cat inside. If it is a classical cat, then it is either dead or alive. If it is a quantum cat, then it is both dead and alive. A quantum phenomenon called superposition.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 6 / 48

slide-12
SLIDE 12

Qubits

Assume I have a closed box with a cat inside. If it is a classical cat, then it is either dead or alive. If it is a quantum cat, then it is both dead and alive. A quantum phenomenon called superposition. A bit is a value that is either 0 or 1.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 6 / 48

slide-13
SLIDE 13

Qubits

Assume I have a closed box with a cat inside. If it is a classical cat, then it is either dead or alive. If it is a quantum cat, then it is both dead and alive. A quantum phenomenon called superposition. A bit is a value that is either 0 or 1. A quantum bit is a value that is both 0 and 1 (superposition).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 6 / 48

slide-14
SLIDE 14

Qubits

What is a qubit?

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-15
SLIDE 15

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-16
SLIDE 16

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-17
SLIDE 17

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit. |a1|2 = probability that we get a 1, when we measure the qubit.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-18
SLIDE 18

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit. |a1|2 = probability that we get a 1, when we measure the qubit. Examples: Qubits P(0) P(1) ( 1

√ 2, 1 √ 2) 1 2 1 2

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-19
SLIDE 19

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit. |a1|2 = probability that we get a 1, when we measure the qubit. Examples: Qubits P(0) P(1) ( 1

√ 2, 1 √ 2) 1 2 1 2

( 1

√ 2, − 1 √ 2)

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-20
SLIDE 20

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit. |a1|2 = probability that we get a 1, when we measure the qubit. Examples: Qubits P(0) P(1) ( 1

√ 2, 1 √ 2) 1 2 1 2

( 1

√ 2, − 1 √ 2) 1 2 1 2

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-21
SLIDE 21

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit. |a1|2 = probability that we get a 1, when we measure the qubit. Examples: Qubits P(0) P(1) ( 1

√ 2, 1 √ 2) 1 2 1 2

( 1

√ 2, − 1 √ 2) 1 2 1 2

(0, 1)

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-22
SLIDE 22

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit. |a1|2 = probability that we get a 1, when we measure the qubit. Examples: Qubits P(0) P(1) ( 1

√ 2, 1 √ 2) 1 2 1 2

( 1

√ 2, − 1 √ 2) 1 2 1 2

(0, 1) 1

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-23
SLIDE 23

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit. |a1|2 = probability that we get a 1, when we measure the qubit. Examples: Qubits P(0) P(1) ( 1

√ 2, 1 √ 2) 1 2 1 2

( 1

√ 2, − 1 √ 2) 1 2 1 2

(0, 1) 1 (−1, 0)

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-24
SLIDE 24

Qubits

What is a qubit? (a0, a1) ∈ C2 with |a0|2 + |a1|2 = 1. |a0|2 = probability that we get a 0, when we measure the qubit. |a1|2 = probability that we get a 1, when we measure the qubit. Examples: Qubits P(0) P(1) ( 1

√ 2, 1 √ 2) 1 2 1 2

( 1

√ 2, − 1 √ 2) 1 2 1 2

(0, 1) 1 (−1, 0) 1

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 7 / 48

slide-25
SLIDE 25

Qubits

Value State Probability → a0 → |a0|2 1 → a1 → |a1|2

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 8 / 48

slide-26
SLIDE 26

A qubit represents a single storage unit where both a 0 and a 1 are stored at the same time (in superposition). It is not that a qubit is storing two values in “physically” different spaces. The 0 and the 1 are in the same “physical” space.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 9 / 48

slide-27
SLIDE 27

Qubit arrays

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 10 / 48

slide-28
SLIDE 28

Qubit arrays

Fix n ∈ N.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 10 / 48

slide-29
SLIDE 29

Qubit arrays

Fix n ∈ N. A bit array is one sequence of n bits.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 10 / 48

slide-30
SLIDE 30

Qubit arrays

Fix n ∈ N. A bit array is one sequence of n bits. A qubit array is all sequences of n bits (superposition).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 10 / 48

slide-31
SLIDE 31

Qubit arrays

Fix n ∈ N. A bit array is one sequence of n bits. A qubit array is all sequences of n bits (superposition). When you observe the array, you see a bit array x of n bits with probability |ax|2.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 10 / 48

slide-32
SLIDE 32

Qubit arrays

Fix n ∈ N. A bit array is one sequence of n bits. A qubit array is all sequences of n bits (superposition). When you observe the array, you see a bit array x of n bits with probability |ax|2. So a qubit array is defined by one complex number ax for each possible bit array in {0, 1}n.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 10 / 48

slide-33
SLIDE 33

Qubit arrays

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-34
SLIDE 34

Qubit arrays

What is a qubit array of length n?

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-35
SLIDE 35

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-36
SLIDE 36

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1. |ax|2 is the probability, that after observing the qubit array, we get x.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-37
SLIDE 37

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1. |ax|2 is the probability, that after observing the qubit array, we get x. Examples: Qubit array P(00) P(01) P(10) P(11)

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-38
SLIDE 38

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1. |ax|2 is the probability, that after observing the qubit array, we get x. Examples: Qubit array P(00) P(01) P(10) P(11) (0,

1 √ 2, 0, 1 √ 2)

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-39
SLIDE 39

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1. |ax|2 is the probability, that after observing the qubit array, we get x. Examples: Qubit array P(00) P(01) P(10) P(11) (0,

1 √ 2, 0, 1 √ 2) 1 2 1 2

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-40
SLIDE 40

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1. |ax|2 is the probability, that after observing the qubit array, we get x. Examples: Qubit array P(00) P(01) P(10) P(11) (0,

1 √ 2, 0, 1 √ 2) 1 2 1 2

(0,

1 √ 2, 1 2, 1 2)

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-41
SLIDE 41

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1. |ax|2 is the probability, that after observing the qubit array, we get x. Examples: Qubit array P(00) P(01) P(10) P(11) (0,

1 √ 2, 0, 1 √ 2) 1 2 1 2

(0,

1 √ 2, 1 2, 1 2) 1 2 1 4 1 4

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-42
SLIDE 42

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1. |ax|2 is the probability, that after observing the qubit array, we get x. Examples: Qubit array P(00) P(01) P(10) P(11) (0,

1 √ 2, 0, 1 √ 2) 1 2 1 2

(0,

1 √ 2, 1 2, 1 2) 1 2 1 4 1 4

(1, 0, 0, 0)

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-43
SLIDE 43

Qubit arrays

What is a qubit array of length n? (a0, a1, . . . , aN−1) ∈ CN, with N = 2n and such that

  • x

|ax|2 = 1. |ax|2 is the probability, that after observing the qubit array, we get x. Examples: Qubit array P(00) P(01) P(10) P(11) (0,

1 √ 2, 0, 1 √ 2) 1 2 1 2

(0,

1 √ 2, 1 2, 1 2) 1 2 1 4 1 4

(1, 0, 0, 0) 1

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 11 / 48

slide-44
SLIDE 44

Qubit arrays

More examples: (1/2, 0, 0, 1/2, 0, 0, 0, 1/ √ 2) is a qubit array that, when observed, yields 000 with prob 1/4, 011 with prob 1/4, and 111 with probability 1/2.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 12 / 48

slide-45
SLIDE 45

Qubit arrays

More examples: (1/2, 0, 0, 1/2, 0, 0, 0, 1/ √ 2) is a qubit array that, when observed, yields 000 with prob 1/4, 011 with prob 1/4, and 111 with probability 1/2. (1/ √ 8, 1/ √ 8, 1/ √ 8, 1/ √ 8, 1/ √ 8, 1/ √ 8, 1/ √ 8, 1/ √ 8) is a qubit array that, when observed, yields any bit array of length 3 with equal probability.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 12 / 48

slide-46
SLIDE 46

Qubit arrays

000 → a000 → a0 → |a0|2 001 → a001 → a1 → |a1|2 010 → a010 → a2 → |a2|2 011 → a011 → a3 → |a3|2 100 → a100 → a4 → |a4|2 101 → a101 → a5 → |a5|2 110 → a110 → a6 → |a6|2 111 → a111 → a7 → |a7|2

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 13 / 48

slide-47
SLIDE 47

A qubit array of length n is a storage unit with n bits of capacity. A qubit array is not a data structure containing all bit arrays in 2n “physically” different locations. All 2n bit arrays are in the “physical” storage unit with n bits of capacity, coexisting in superposition.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 14 / 48

slide-48
SLIDE 48

Qubit arrays are vectors in CN

For x ∈ {0, 1}n, let |x be the qubit array with all entries equal zero except the x-th, which is 1.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 15 / 48

slide-49
SLIDE 49

Qubit arrays are vectors in CN

For x ∈ {0, 1}n, let |x be the qubit array with all entries equal zero except the x-th, which is 1. Examples:

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 15 / 48

slide-50
SLIDE 50

Qubit arrays are vectors in CN

For x ∈ {0, 1}n, let |x be the qubit array with all entries equal zero except the x-th, which is 1. Examples: |10 = (0, 0, 1, 0).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 15 / 48

slide-51
SLIDE 51

Qubit arrays are vectors in CN

For x ∈ {0, 1}n, let |x be the qubit array with all entries equal zero except the x-th, which is 1. Examples: |10 = (0, 0, 1, 0). |011 = (0, 0, 0, 1, 0, 0, 0, 0).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 15 / 48

slide-52
SLIDE 52

Qubit arrays are vectors in CN

For x ∈ {0, 1}n, let |x be the qubit array with all entries equal zero except the x-th, which is 1. Examples: |10 = (0, 0, 1, 0). |011 = (0, 0, 0, 1, 0, 0, 0, 0). |0000 = (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 15 / 48

slide-53
SLIDE 53

Qubit arrays are vectors in CN

For x ∈ {0, 1}n, let |x be the qubit array with all entries equal zero except the x-th, which is 1. Examples: |10 = (0, 0, 1, 0). |011 = (0, 0, 0, 1, 0, 0, 0, 0). |0000 = (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).

Definition

Bn := {|x | x ∈ {0, 1}n} .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 15 / 48

slide-54
SLIDE 54

Qubit arrays are vectors in CN

For x ∈ {0, 1}n, let |x be the qubit array with all entries equal zero except the x-th, which is 1. Examples: |10 = (0, 0, 1, 0). |011 = (0, 0, 0, 1, 0, 0, 0, 0). |0000 = (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).

Definition

Bn := {|x | x ∈ {0, 1}n} . Example: B2 = {|00 , |01 , |10 , |11}.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 15 / 48

slide-55
SLIDE 55

Bn is a basis

Let |ψ = (a0, a1, . . . , aN−1), then |ψ =

  • x∈{0,1}n

ax |x .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 16 / 48

slide-56
SLIDE 56

Bn is a basis

Let |ψ = (a0, a1, . . . , aN−1), then |ψ =

  • x∈{0,1}n

ax |x .

  • x∈{0,1}n ax |x is |ψ’s algebraic representation.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 16 / 48

slide-57
SLIDE 57

Bn is a basis

Let |ψ = (a0, a1, . . . , aN−1), then |ψ =

  • x∈{0,1}n

ax |x .

  • x∈{0,1}n ax |x is |ψ’s algebraic representation.

(a0, a1, . . . , aN) is |ψ’s vector representation.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 16 / 48

slide-58
SLIDE 58

Bn is a basis

Let |ψ = (a0, a1, . . . , aN−1), then |ψ =

  • x∈{0,1}n

ax |x .

  • x∈{0,1}n ax |x is |ψ’s algebraic representation.

(a0, a1, . . . , aN) is |ψ’s vector representation. Examples:

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 16 / 48

slide-59
SLIDE 59

Bn is a basis

Let |ψ = (a0, a1, . . . , aN−1), then |ψ =

  • x∈{0,1}n

ax |x .

  • x∈{0,1}n ax |x is |ψ’s algebraic representation.

(a0, a1, . . . , aN) is |ψ’s vector representation. Examples:

  • 1

√ 2, − 1 √ 2

  • =

1 √ 2(1, 0) − 1 √ 2(0, 1) = 1 √ 2 |0 − 1 √ 2 |1 .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 16 / 48

slide-60
SLIDE 60

Bn is a basis

Let |ψ = (a0, a1, . . . , aN−1), then |ψ =

  • x∈{0,1}n

ax |x .

  • x∈{0,1}n ax |x is |ψ’s algebraic representation.

(a0, a1, . . . , aN) is |ψ’s vector representation. Examples:

  • 1

√ 2, − 1 √ 2

  • =

1 √ 2(1, 0) − 1 √ 2(0, 1) = 1 √ 2 |0 − 1 √ 2 |1 .

  • 0,

1 √ 2, − 1 √ 2, 0

  • =

1 √ 2(0, 1, 0, 0) − 1 √ 2(0, 0, 1, 0) = 1 √ 2 |01 − 1 √ 2 |10 .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 16 / 48

slide-61
SLIDE 61

Bn is a basis

Let |ψ = (a0, a1, . . . , aN−1), then |ψ =

  • x∈{0,1}n

ax |x .

  • x∈{0,1}n ax |x is |ψ’s algebraic representation.

(a0, a1, . . . , aN) is |ψ’s vector representation. Examples:

  • 1

√ 2, − 1 √ 2

  • =

1 √ 2(1, 0) − 1 √ 2(0, 1) = 1 √ 2 |0 − 1 √ 2 |1 .

  • 0,

1 √ 2, − 1 √ 2, 0

  • =

1 √ 2(0, 1, 0, 0) − 1 √ 2(0, 0, 1, 0) = 1 √ 2 |01 − 1 √ 2 |10 .

(0, 0, 0, 0, 0, 0, 0, −1) = −(0, 0, 0, 0, 0, 0, 0, 1) = − |111 .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 16 / 48

slide-62
SLIDE 62

Measurements

A measurement operator receives as input a qubit array

x ax |x and

  • utputs x with probability |ax|2.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 17 / 48

slide-63
SLIDE 63

Measurements

A measurement operator receives as input a qubit array

x ax |x and

  • utputs x with probability |ax|2.

Examples: Measuring − 1

2 |0 − √ 3 2 |1 yields 1 with probability 3 4.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 17 / 48

slide-64
SLIDE 64

Measurements

A measurement operator receives as input a qubit array

x ax |x and

  • utputs x with probability |ax|2.

Examples: Measuring − 1

2 |0 − √ 3 2 |1 yields 1 with probability 3 4.

Measuring |1 yields 1 with probability 1.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 17 / 48

slide-65
SLIDE 65

Measurements

A measurement operator receives as input a qubit array

x ax |x and

  • utputs x with probability |ax|2.

Examples: Measuring − 1

2 |0 − √ 3 2 |1 yields 1 with probability 3 4.

Measuring |1 yields 1 with probability 1.

Observation

After measuring a qubit array, all its uncertainty is lost. Measuring again gives the same result.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 17 / 48

slide-66
SLIDE 66

Quantum gates

A quantum gate is a unitary transformation G : CN → CN.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 18 / 48

slide-67
SLIDE 67

Quantum gates

A quantum gate is a unitary transformation G : CN → CN. For now, the most important thing to know about unitary transformations is that they are linear: G

  • x

ax |x

  • =
  • x

axG |x .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 18 / 48

slide-68
SLIDE 68

Quantum gates

A quantum gate is a unitary transformation G : CN → CN. For now, the most important thing to know about unitary transformations is that they are linear: G

  • x

ax |x

  • =
  • x

axG |x . Example: G 1 2 |00 − 1 2 |10 − 1 √ 2 |11

  • = 1

2G |00 − 1 2G |10 − 1 √ 2 G |11 .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 18 / 48

slide-69
SLIDE 69

Quantum gates

A quantum gate is a unitary transformation G : CN → CN. For now, the most important thing to know about unitary transformations is that they are linear: G

  • x

ax |x

  • =
  • x

axG |x . Example: G 1 2 |00 − 1 2 |10 − 1 √ 2 |11

  • = 1

2G |00 − 1 2G |10 − 1 √ 2 G |11 . To compute G |ψ, you only need to know how G works on Bn.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 18 / 48

slide-70
SLIDE 70

Popular quantum gates

Hadamard gate. Emulation gate. Reflection gate.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 19 / 48

slide-71
SLIDE 71

Quantum gate example: Hadamard gate

For |x ∈ Bn, H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , where x⊤y :=

i≤n x[i]y[i] is the classical inner product.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 20 / 48

slide-72
SLIDE 72

Quantum gate example: Hadamard gate

For |x ∈ Bn, H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , where x⊤y :=

i≤n x[i]y[i] is the classical inner product.

Example: H |0 =

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 20 / 48

slide-73
SLIDE 73

Quantum gate example: Hadamard gate

For |x ∈ Bn, H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , where x⊤y :=

i≤n x[i]y[i] is the classical inner product.

Example: H |0 = 1 √ 2 |0 + 1 √ 2 |1 .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 20 / 48

slide-74
SLIDE 74

Quantum gate example: Hadamard gate

For |x ∈ Bn, H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , where x⊤y :=

i≤n x[i]y[i] is the classical inner product.

Example: H |0 = 1 √ 2 |0 + 1 √ 2 |1 . H |01 =

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 20 / 48

slide-75
SLIDE 75

Quantum gate example: Hadamard gate

For |x ∈ Bn, H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , where x⊤y :=

i≤n x[i]y[i] is the classical inner product.

Example: H |0 = 1 √ 2 |0 + 1 √ 2 |1 . H |01 = 1 2 |00

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 20 / 48

slide-76
SLIDE 76

Quantum gate example: Hadamard gate

For |x ∈ Bn, H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , where x⊤y :=

i≤n x[i]y[i] is the classical inner product.

Example: H |0 = 1 √ 2 |0 + 1 √ 2 |1 . H |01 = 1 2 |00 − 1 2 |01

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 20 / 48

slide-77
SLIDE 77

Quantum gate example: Hadamard gate

For |x ∈ Bn, H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , where x⊤y :=

i≤n x[i]y[i] is the classical inner product.

Example: H |0 = 1 √ 2 |0 + 1 √ 2 |1 . H |01 = 1 2 |00 − 1 2 |01 + 1 2 |10

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 20 / 48

slide-78
SLIDE 78

Quantum gate example: Hadamard gate

For |x ∈ Bn, H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , where x⊤y :=

i≤n x[i]y[i] is the classical inner product.

Example: H |0 = 1 √ 2 |0 + 1 √ 2 |1 . H |01 = 1 2 |00 − 1 2 |01 + 1 2 |10 − 1 2 |11 .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 20 / 48

slide-79
SLIDE 79

Quantum gate example: Hadamard gate

H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , In particular, H |00 . . . 0 =

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 21 / 48

slide-80
SLIDE 80

Quantum gate example: Hadamard gate

H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y , In particular, H |00 . . . 0 =

  • y∈{0,1}n

1 √ 2n |y =: |? .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 21 / 48

slide-81
SLIDE 81

Quantum gate example: Hadamard gate

In general, for any qubit array |ψ =

x ax |x,

H |ψ = H

  • x

ax |x

  • Carlos Cotrini (ETH Z¨

urich) QC for dummies September 14, 2019 22 / 48

slide-82
SLIDE 82

Quantum gate example: Hadamard gate

In general, for any qubit array |ψ =

x ax |x,

H |ψ = H

  • x

ax |x

  • =
  • x

axH |x =

  • x,y

ax (−1)x⊤y √ 2n |y =

  • y
  • x

ax (−1)x⊤y √ 2n

  • |y .

Applying the Hadamard gate takes constant time! It is not that the gate computes H |x, for each x! Remember that all bit arrays x are in superposition!

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 22 / 48

slide-83
SLIDE 83

Quantum gate example: Emulation gate

If f : {0, 1}n → {0, 1} is a Boolean circuit, then Uf |x := (−1)f (x) |x .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 23 / 48

slide-84
SLIDE 84

Quantum gate example: Emulation gate

If f : {0, 1}n → {0, 1} is a Boolean circuit, then Uf |x := (−1)f (x) |x . In general, for any qubit array |ψ, Uf |ψ = Uf

  • x

ax |x

  • =
  • x

ax (−1)f (x) |x .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 23 / 48

slide-85
SLIDE 85

Quantum gate example: Emulation gate

If f : {0, 1}n → {0, 1} is a Boolean circuit, then Uf |x := (−1)f (x) |x . In general, for any qubit array |ψ, Uf |ψ = Uf

  • x

ax |x

  • =
  • x

ax (−1)f (x) |x . If computing f (x) takes O(K)-time, then computing Uf |ψ also takes O(K)-time.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 23 / 48

slide-86
SLIDE 86

Quantum gate example: Reflection gate

F |x

  • |00 . . . 0

if x = 00 . . . 0 and − |x

  • therwise.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 24 / 48

slide-87
SLIDE 87

Classical vs parallel vs quantum computation

f : {0, 1}n → {0, 1}. Suppose that computing f (x) takes O(K(n))-time.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 25 / 48

slide-88
SLIDE 88

Classical vs parallel vs quantum computation

f : {0, 1}n → {0, 1}. Suppose that computing f (x) takes O(K(n))-time. How much you need to compute f ’s table?

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 25 / 48

slide-89
SLIDE 89

Classical vs parallel vs quantum computation

f : {0, 1}n → {0, 1}. Suppose that computing f (x) takes O(K(n))-time. How much you need to compute f ’s table? Memory Time Energy Classical O(2n) O(2nK(n)) O(2nK(n))

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 25 / 48

slide-90
SLIDE 90

Classical vs parallel vs quantum computation

f : {0, 1}n → {0, 1}. Suppose that computing f (x) takes O(K(n))-time. How much you need to compute f ’s table? Memory Time Energy Classical O(2n) O(2nK(n)) O(2nK(n)) Parallel (2n cores) O(2n) O(K(n)) O(2nK(n))

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 25 / 48

slide-91
SLIDE 91

Classical vs parallel vs quantum computation

f : {0, 1}n → {0, 1}. Suppose that computing f (x) takes O(K(n))-time. How much you need to compute f ’s table? Memory Time Energy Classical O(2n) O(2nK(n)) O(2nK(n)) Parallel (2n cores) O(2n) O(K(n)) O(2nK(n)) Quantum O(n) O(K(n)) O(K(n))

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 25 / 48

slide-92
SLIDE 92

Classical vs parallel vs quantum computation

f : {0, 1}n → {0, 1}. Suppose that computing f (x) takes O(K(n))-time. How much you need to compute f ’s table? Memory Time Energy Classical O(2n) O(2nK(n)) O(2nK(n)) Parallel (2n cores) O(2n) O(K(n)) O(2nK(n)) Quantum O(n) O(K(n)) O(K(n)) * Constants may vary substantially.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 25 / 48

slide-93
SLIDE 93

Quantum computing for dummies

Carlos Cotrini

ETH Z¨ urich ccarlos@inf.ethz.ch

September 14, 2019

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 26 / 48

slide-94
SLIDE 94

The Deutsch-Jozsa algorithm

And now... a problem that can be solved in linear time by a classical computer, but in constant time by a quantum computer! A bit array of length 2n is balanced if exactly half of its entries are zero. A bit array is constant if all its entries are zero.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 27 / 48

slide-95
SLIDE 95

The Deutsch-Jozsa algorithm

And now... a problem that can be solved in linear time by a classical computer, but in constant time by a quantum computer! A bit array of length 2n is balanced if exactly half of its entries are zero. A bit array is constant if all its entries are zero.

The problem

Given a bit array f of length 2n, known to be balanced or constant, decide if it is balanced.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 27 / 48

slide-96
SLIDE 96

The Deutsch-Jozsa algorithm

And now... a problem that can be solved in linear time by a classical computer, but in constant time by a quantum computer! A bit array of length 2n is balanced if exactly half of its entries are zero. A bit array is constant if all its entries are zero.

The problem

Given a bit array f of length 2n, known to be balanced or constant, decide if it is balanced.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 27 / 48

slide-97
SLIDE 97

The Deutsch-Jozsa algorithm

And now... a problem that can be solved in linear time by a classical computer, but in constant time by a quantum computer! A bit array of length 2n is balanced if exactly half of its entries are zero. A bit array is constant if all its entries are zero.

The problem

Given a bit array f of length 2n, known to be balanced or constant, decide if it is balanced. Executing this circuit requires only just one call to Uf .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 27 / 48

slide-98
SLIDE 98

Exercises

Observe that |0 = |00...0. Recall that H |x :=

  • y∈{0,1}n

(−1)x⊤y √ 2n |y . Uf |x := (−1)f (x) |x . We now show why this circuit decides if f is balanced or constant. Show that

  • ψ′

= HUf H |00 . . . 0 =

  • z∈{0,1}n

 

  • y∈{0,1}n

(−1)z⊤y+f (y) √ 2n   |z . After we measure |ψ′, what is the probability that we get 00 . . . 0 if f is balanced? What is the probability of getting 00 . . . 0 if f is constant?

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 28 / 48

slide-99
SLIDE 99

Agenda

1 Background in linear algebra.

Linear transformations. Matrix representations. Unitary transformations.

2 Grover’s algorithm. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 29 / 48

slide-100
SLIDE 100

Searching with a quantum computer

The problem

Given a function f : {0, 1}n → {0, 1}, find an element x ∈ {0, 1}n such that f (x) = 1. We call such an element a solution of f .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 30 / 48

slide-101
SLIDE 101

Searching with a quantum computer

The problem

Given a function f : {0, 1}n → {0, 1}, find an element x ∈ {0, 1}n such that f (x) = 1. We call such an element a solution of f . A classical computer solves this in O(2n)-time.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 30 / 48

slide-102
SLIDE 102

Searching with a quantum computer

The problem

Given a function f : {0, 1}n → {0, 1}, find an element x ∈ {0, 1}n such that f (x) = 1. We call such an element a solution of f . A classical computer solves this in O(2n)-time. A quantum computer can solve this in O( √ 2n)-time!

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 30 / 48

slide-103
SLIDE 103

Searching with a quantum computer

The problem

Given a function f : {0, 1}n → {0, 1}, find an element x ∈ {0, 1}n such that f (x) = 1. We call such an element a solution of f . A classical computer solves this in O(2n)-time. A quantum computer can solve this in O( √ 2n)-time! We assume that there are M ≪ N = 2n solutions of f .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 30 / 48

slide-104
SLIDE 104

Linear transformations

A linear transformation is a function T : CN → CN such that T (a1 |ψ1 + a2 |ψ2) = a1T |ψ1 + a2T |ψ2 .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 31 / 48

slide-105
SLIDE 105

Linear transformations

A linear transformation is a function T : CN → CN such that T (a1 |ψ1 + a2 |ψ2) = a1T |ψ1 + a2T |ψ2 . Every linear transformation T is identified with a unique matrix T ∈ CN×N such that T |ψ = T |ψ. We identify T with T.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 31 / 48

slide-106
SLIDE 106

How to compute the matrix representation of a linear transformation T?

1 List all basic qubit arrays: |00 . . . 0 , |00 . . . 1 , . . . , |11 . . . 1. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 32 / 48

slide-107
SLIDE 107

How to compute the matrix representation of a linear transformation T?

1 List all basic qubit arrays: |00 . . . 0 , |00 . . . 1 , . . . , |11 . . . 1. 2 Apply T to each of them: T |00 . . . 0 , T |00 . . . 1 , . . . , T |11 . . . 1. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 32 / 48

slide-108
SLIDE 108

How to compute the matrix representation of a linear transformation T?

1 List all basic qubit arrays: |00 . . . 0 , |00 . . . 1 , . . . , |11 . . . 1. 2 Apply T to each of them: T |00 . . . 0 , T |00 . . . 1 , . . . , T |11 . . . 1. 3 Write these qubit arrays as column vectors. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 32 / 48

slide-109
SLIDE 109

How to compute the matrix representation of a linear transformation T?

1 List all basic qubit arrays: |00 . . . 0 , |00 . . . 1 , . . . , |11 . . . 1. 2 Apply T to each of them: T |00 . . . 0 , T |00 . . . 1 , . . . , T |11 . . . 1. 3 Write these qubit arrays as column vectors. 4 T is the matrix whose columns are the vectors above. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 32 / 48

slide-110
SLIDE 110

Examples

Let T be such that T |0 = − |1 and T |1 = |0. If we apply the steps above we get:

1 List all basic qubit arrays: |0, |1. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 33 / 48

slide-111
SLIDE 111

Examples

Let T be such that T |0 = − |1 and T |1 = |0. If we apply the steps above we get:

1 List all basic qubit arrays: |0, |1. 2 If we apply T to these arrays we get: − |1, |0. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 33 / 48

slide-112
SLIDE 112

Examples

Let T be such that T |0 = − |1 and T |1 = |0. If we apply the steps above we get:

1 List all basic qubit arrays: |0, |1. 2 If we apply T to these arrays we get: − |1, |0. 3 Writing them as column vectors yields:

  • −1
  • 1
  • 4 Hence,

T =

  • 1

−1

  • .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 33 / 48

slide-113
SLIDE 113

Multiplication of a matrix and a vector

Recall that T |0 = − |1 and T |1 = |0.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 34 / 48

slide-114
SLIDE 114

Multiplication of a matrix and a vector

Recall that T |0 = − |1 and T |1 = |0. Let |ψ = a0 |0 + a1 |1 = (a0, a1). Let’s verify that T |ψ = T |ψ .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 34 / 48

slide-115
SLIDE 115

Multiplication of a matrix and a vector

Recall that T |0 = − |1 and T |1 = |0. Let |ψ = a0 |0 + a1 |1 = (a0, a1). Let’s verify that T |ψ = T |ψ . T |ψ = a0T |0 + a1T |1 = −a0 |1 + a1 |0 = (a1, −a0).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 34 / 48

slide-116
SLIDE 116

Multiplication of a matrix and a vector

Recall that T |0 = − |1 and T |1 = |0. Let |ψ = a0 |0 + a1 |1 = (a0, a1). Let’s verify that T |ψ = T |ψ . T |ψ = a0T |0 + a1T |1 = −a0 |1 + a1 |0 = (a1, −a0). T |ψ can be visualized as follows: a0 a1

  • 1

−1

  • Carlos Cotrini (ETH Z¨

urich) QC for dummies September 14, 2019 34 / 48

slide-117
SLIDE 117

Multiplication of a matrix and a vector

Recall that T |0 = − |1 and T |1 = |0. Let |ψ = a0 |0 + a1 |1 = (a0, a1). Let’s verify that T |ψ = T |ψ . T |ψ = a0T |0 + a1T |1 = −a0 |1 + a1 |0 = (a1, −a0). T |ψ can be visualized as follows: a0 a1

  • 1

−1

  • a1

−a0

  • Carlos Cotrini (ETH Z¨

urich) QC for dummies September 14, 2019 34 / 48

slide-118
SLIDE 118

Multiplication of a matrix and a vector

Recall that T |0 = − |1 and T |1 = |0. Let |ψ = a0 |0 + a1 |1 = (a0, a1). Let’s verify that T |ψ = T |ψ . T |ψ = a0T |0 + a1T |1 = −a0 |1 + a1 |0 = (a1, −a0). T |ψ can be visualized as follows: a0 a1

  • 1

−1

  • a1

−a0

  • Hence, T |ψ = (a1, −a0).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 34 / 48

slide-119
SLIDE 119

Multiplication of a matrix and a vector

Recall that F : C4 → C4 is the quantum gate such that F |x

  • |00

if |x = |00 − |x

  • therwise.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 35 / 48

slide-120
SLIDE 120

Multiplication of a matrix and a vector

Recall that F : C4 → C4 is the quantum gate such that F |x

  • |00

if |x = |00 − |x

  • therwise.

F’s matrix representation is

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 35 / 48

slide-121
SLIDE 121

Multiplication of a matrix and a vector

Recall that F : C4 → C4 is the quantum gate such that F |x

  • |00

if |x = |00 − |x

  • therwise.

F’s matrix representation is

1 |00, |01, |10, |11. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 35 / 48

slide-122
SLIDE 122

Multiplication of a matrix and a vector

Recall that F : C4 → C4 is the quantum gate such that F |x

  • |00

if |x = |00 − |x

  • therwise.

F’s matrix representation is

1 |00, |01, |10, |11. 2 |00, − |01, − |10, − |11. Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 35 / 48

slide-123
SLIDE 123

Multiplication of a matrix and a vector

Recall that F : C4 → C4 is the quantum gate such that F |x

  • |00

if |x = |00 − |x

  • therwise.

F’s matrix representation is

1 |00, |01, |10, |11. 2 |00, − |01, − |10, − |11. 3

    1    ,     −1    ,     −1    ,     −1    .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 35 / 48

slide-124
SLIDE 124

Multiplication of a matrix and a vector

Recall that F : C4 → C4 is the quantum gate such that F |x

  • |00

if |x = |00 − |x

  • therwise.

F’s matrix representation is

1 |00, |01, |10, |11. 2 |00, − |01, − |10, − |11. 3

    1    ,     −1    ,     −1    ,     −1    .

4 F’s matrix representation is then

    1 −1 −1 −1     .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 35 / 48

slide-125
SLIDE 125

Multiplication of a matrix and a vector

In consequence, F |ψ for any qubit array (a00, a01, a10, a11) is

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 36 / 48

slide-126
SLIDE 126

Multiplication of a matrix and a vector

In consequence, F |ψ for any qubit array (a00, a01, a10, a11) is     a00 a01 a10 a11         1 −1 −1 −1    

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 36 / 48

slide-127
SLIDE 127

Multiplication of a matrix and a vector

In consequence, F |ψ for any qubit array (a00, a01, a10, a11) is     a00 a01 a10 a11         1 −1 −1 −1         a00 −a01 −a10 −a11    

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 36 / 48

slide-128
SLIDE 128

Multiplication of a matrix and a vector

In consequence, F |ψ for any qubit array (a00, a01, a10, a11) is     a00 a01 a10 a11         1 −1 −1 −1         a00 −a01 −a10 −a11     That is, F |ψ = (a00, −a01, −a10, −a11).

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 36 / 48

slide-129
SLIDE 129

Composing linear transformations

If T1 and T2 are linear transformations, then T1 (T2 |x) = T1T2 |x .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 37 / 48

slide-130
SLIDE 130

Example

Let H be the Hadamard gate for C2. Recall that H |0 =

1 √ 2 |0 + 1 √ 2 |1

and that H |1 =

1 √ 2 |0 − 1 √ 2 |1.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 38 / 48

slide-131
SLIDE 131

Example

Let H be the Hadamard gate for C2. Recall that H |0 =

1 √ 2 |0 + 1 √ 2 |1

and that H |1 =

1 √ 2 |0 − 1 √ 2 |1.

Hence, H =

  • 1

√ 2 1 √ 2 1 √ 2

− 1

√ 2

  • .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 38 / 48

slide-132
SLIDE 132

What happens if we apply the Hadamard gate twice?

HH is equal to

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 39 / 48

slide-133
SLIDE 133

What happens if we apply the Hadamard gate twice?

HH is equal to

  • 1

√ 2 1 √ 2 1 √ 2

− 1

√ 2

  • 1

√ 2 1 √ 2 1 √ 2

− 1

√ 2

  • Carlos Cotrini (ETH Z¨

urich) QC for dummies September 14, 2019 39 / 48

slide-134
SLIDE 134

What happens if we apply the Hadamard gate twice?

HH is equal to

  • 1

√ 2 1 √ 2 1 √ 2

− 1

√ 2

  • 1

√ 2 1 √ 2 1 √ 2

− 1

√ 2

  • 1

1

  • Carlos Cotrini (ETH Z¨

urich) QC for dummies September 14, 2019 39 / 48

slide-135
SLIDE 135

What happens if we apply the Hadamard gate twice?

HH is equal to

  • 1

√ 2 1 √ 2 1 √ 2

− 1

√ 2

  • 1

√ 2 1 √ 2 1 √ 2

− 1

√ 2

  • 1

1

  • This means that HH = I. That is, HH |ψ = |ψ.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 39 / 48

slide-136
SLIDE 136

Unitary transformations

A quantum gate G is a unitary transformation. A linear transformation G : CN → CN is unitary if G †G = I.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 40 / 48

slide-137
SLIDE 137

Unitary transformations

A quantum gate G is a unitary transformation. A linear transformation G : CN → CN is unitary if G †G = I. If you are not familiar with complex algebra, then you can think of G † as G ⊤, G’s transpose.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 40 / 48

slide-138
SLIDE 138

Unitary transformations

A quantum gate G is a unitary transformation. A linear transformation G : CN → CN is unitary if G †G = I. If you are not familiar with complex algebra, then you can think of G † as G ⊤, G’s transpose. Recall that the transpose of a matrix G ∈ CM×N is the matrix G ⊤ ∈ CN×M obtained by “mirroring” G through its diagonal. More precisely, for i ≤ M, j ≤ N, we have that

  • G ⊤

ij = Gji.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 40 / 48

slide-139
SLIDE 139

Unitary transformations

A quantum gate G is a unitary transformation. A linear transformation G : CN → CN is unitary if G †G = I. If you are not familiar with complex algebra, then you can think of G † as G ⊤, G’s transpose. Recall that the transpose of a matrix G ∈ CM×N is the matrix G ⊤ ∈ CN×M obtained by “mirroring” G through its diagonal. More precisely, for i ≤ M, j ≤ N, we have that

  • G ⊤

ij = Gji.

For example, 1 2 3 4 5 6 ⊤ =   1 4 2 5 3 6   .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 40 / 48

slide-140
SLIDE 140

Grover’s algorithm

The problem

Given a function f : {0, 1}n → {0, 1}, find an element x ∈ {0, 1}n such that f (x) = 1. We call such an element a solution of f .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 41 / 48

slide-141
SLIDE 141

Grover’s algorithm

The problem

Given a function f : {0, 1}n → {0, 1}, find an element x ∈ {0, 1}n such that f (x) = 1. We call such an element a solution of f . We assume that there are M ≪ N = 2n solutions of f .

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 41 / 48

slide-142
SLIDE 142

Quantum circuit

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 42 / 48

slide-143
SLIDE 143

Quantum circuit

Let |σ :=

1 √ M

  • x:f (x)=1 |x and
  • σ⊥

:=

1 √ N−M

  • x:f (x)=0 |x.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 42 / 48

slide-144
SLIDE 144

Quantum circuit

Let |σ :=

1 √ M

  • x:f (x)=1 |x and
  • σ⊥

:=

1 √ N−M

  • x:f (x)=0 |x.

|σ and

  • σ⊥

are normal and orthogonal.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 42 / 48

slide-145
SLIDE 145

Quantum circuit

Let |σ :=

1 √ M

  • x:f (x)=1 |x and
  • σ⊥

:=

1 √ N−M

  • x:f (x)=0 |x.

|σ and

  • σ⊥

are normal and orthogonal. |? lies in the span of these two vectors.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 42 / 48

slide-146
SLIDE 146

Grover’s rotation illustrated

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 43 / 48

slide-147
SLIDE 147

Grover’s rotation illustrated

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 44 / 48

slide-148
SLIDE 148

Grover’s rotation illustrated

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 45 / 48

slide-149
SLIDE 149

Grover’s rotation illustrated

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 46 / 48

slide-150
SLIDE 150

Quantum circuit for Grover’s rotation

Figure: Quantum circuit for Grover’s rotation.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 47 / 48

slide-151
SLIDE 151

Putting all together

1 The Grover rotation is implemented as G ≡ Uf → H → F → H. 1

Show that F’s matrix representation is 2 |00 . . . 0 |00 . . . 0⊤ − I.

2

Show that H⊤ = H.

3

Show that the matrix representation of HFH is 2 |? |?⊤ − I.

4

Show that Uf is a reflection through the qubit array

  • σ⊥

. Recall that a linear transformation is a reflection through a vector v if its matrix representation is 2vv ⊤ − I.

5

Conclude that G performs a rotation. It can be shown that this rotation is done by an angle of θ = 2 arcsin

  • M/N towards |σ.

2 Write down the circuit implementing Grover’s algorithm and argue

why it computes a solution of f with high probability.

Carlos Cotrini (ETH Z¨ urich) QC for dummies September 14, 2019 48 / 48