lecture 1: elementary quantum algorithms

39
Lecture 1: Elementary quantum algorithms Dominic Berry Macquarie University

Upload: jerica

Post on 23-Feb-2016

39 views

Category:

Documents


1 download

DESCRIPTION

Lecture 1: Elementary quantum algorithms. Dominic Berry Macquarie University. 1982. Quantum simulator. All classical computers work in fundamentally the same way. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lecture 1: Elementary quantum algorithms

Lecture 1: Elementary quantum algorithms

Dominic BerryMacquarie University

Page 2: Lecture 1: Elementary quantum algorithms

Quantum simulator All classical computers work in fundamentally the same

way.

Quantum systems are fundamentally different. The size of the problem goes up exponentially in the size of the system, making them hard to simulate.

In 1982 this led Feynman to propose quantum computers. A quantum system should be able to efficiently simulate another quantum system.

Richard Feynman

Efficiently means that the resources used (time and size of the system) should scale at most polynomially in the size of the system to be simulated.

Polynomially means as , , , etc.

1982

Page 3: Lecture 1: Elementary quantum algorithms

Universal quantum computer A classical computer uses bits, e.g.

Quantum computers replace this with a quantum state

Each digit is a two-level quantum system – a qubit. David Deutsch

Quantum computers can be in superpositions of these states

Represent the state as a vector:

1985

Page 4: Lecture 1: Elementary quantum algorithms

Universal quantum computer Operations on the state can be represented as matrices:

The allowed operations on this state are unitary matrices. These satisfy

The indicates the Hermitian conjugate – the transpose and complex conjugate of the matrix.

Any allowed operation is reversible. Using on will restore the state .

A special case is permutation matrices – a permutation matrix only changes one computational basis state to another.

Page 5: Lecture 1: Elementary quantum algorithms

Examples of permutations1. The NOT operation, also called an , acts on a single qubit

It takes to , and vice versa.

2. The controlled NOT acts on two qubits. It performs an on the target qubit if the control qubit is in the state . Otherwise it does nothing.

3. The Toffoli gate is a NOT controlled by two qubits. It performs an only if both controls are in the state .

[1 0 0 00 1 0 00 0 0 10 0 1 0 ]

[1 0 0 0 0 0 0 00 1 0 0 0 0 0 00 0 1 0 0 0 0 00 0 0 1 0 0 0 00 0 0 0 1 0 0 00 0 0 0 0 1 0 00 0 0 0 0 0 0 10 0 0 0 0 0 1 0

]

Page 6: Lecture 1: Elementary quantum algorithms

Turning classical into quantum The NAND gate is universal for classical circuits and acts as below.

We can perform the same operation using a Toffoli gate.

We can convert any classical algorithm into a quantum algorithm, replacing the NAND gates with Toffolis, and keeping the extra qubits.

¿ 𝐴 ⟩

¿𝐵 ⟩

¿𝑄⟩¿1⟩

¿ 𝐴 ⟩

¿𝐵 ⟩

𝐴𝐵 𝑄

Page 7: Lecture 1: Elementary quantum algorithms

Turning classical into quantum Any function we could calculate on a classical computer we could also

compute on a quantum computer, with the addition of some extra “garbage” registers.

This can be turned into a computation that does this:

Method:1. Add an ancilla, and perform the program as above to give .2. Copy the output of the function into the extra ancilla, to give .3. Invert the program above, giving . For ancillas that are not initially zeroed, we can just perform the XOR.

Page 8: Lecture 1: Elementary quantum algorithms

Part of the story: Superposition Now what if we start the state in a

superposition?

For qubits, we have evaluated an exponential number of different values of the function.

But if we measure it, we only ever find one value of the function!

Page 9: Lecture 1: Elementary quantum algorithms

The other part: Interference We can’t just calculate many values

of a function, we need some way to interfere them to obtain some global property of the function.

We need non-permutation gates:

The Hadamard gate has a matrix representation

Just measuring Schrödinger’s cat would never show it in a superposition.

If we could do a Hadamard on Schrödinger’s cat, we would turn

1. to , and

2. to

showing we have superposition.

Page 10: Lecture 1: Elementary quantum algorithms

The other part: Interference We can’t just calculate many values of a function, we need some way to

interfere them to obtain some global property of the function.

Universal sets of gates:

1. The Hadamard gate

together with the Toffoli gate is universal for real unitaries.

2. The or gate

together with the Hadamard and CNOT is universal.

Page 11: Lecture 1: Elementary quantum algorithms

The Deutsch algorithm Problem: Given a function mapping bits to bits, determine if it

is one-to-one [i.e. ]. Classically we need to evaluate both and . Quantum algorithm:

1. Start with

2. Perform a Hadamard on both qubits to give

3. Apply the gate mapping to give

4. Apply Hadamard on qubit 2 to give

David Deutsch

1985

Page 12: Lecture 1: Elementary quantum algorithms

The Deutsch algorithm1. Start with

2. Perform a Hadamard on both qubits to give

3. Apply the gate mapping to give

4. Apply Hadamard on qubit 2 to give

5. Apply Hadamard on qubit 1 to give

6. Rearranging gives

David Deutsch

1985

If then we only get this part qubit 1 is in state .

If then we only get this part qubit 1 is in state .

Page 13: Lecture 1: Elementary quantum algorithms

The Deutsch algorithm Problem: Given a function mapping bit to bit , determine if it

is either constant or balanced.

Classically we need to evaluate both and .

Deutsch quantum algorithm gives result with one function evaluation.

Quantum algorithm has two crucial steps:1. Calculate the function on both input values simultaneously.2. Interfere the result.

David Deutsch

1985

Page 14: Lecture 1: Elementary quantum algorithms

The Deutsch algorithm Problem: Given a function mapping bit to bit , determine if it

is either constant or balanced.

Classically we need to evaluate both and .

Deutsch quantum algorithm gives result with one function evaluation.

David Deutsch

1985

¿1⟩

¿0 ⟩ 𝐻

𝐻𝑈 𝑓

𝐻

𝐻

measurement

Calculate the function on both input values simultaneously.

Interfere the result.

Page 15: Lecture 1: Elementary quantum algorithms

The Deutsch-Jozsa algorithm Problem: Given a function mapping bits to bit , determine if

it is either constant or balanced. There is a promise that it is either.

Classically we need to evaluate values of .

Deutsch-Jozsa quantum algorithm gives result with one function evaluation.

David Deutsch

1992

Richard Jozsa

¿1⟩

|0 ⟩⊗𝑛 𝐻⊗𝑛

𝐻𝑈 𝑓

measurement𝐻⊗𝑛

Page 16: Lecture 1: Elementary quantum algorithms

Phase oracles We have previously assumed that the unitary for the function acts as

In both cases we have needed to turn this into a phase in order to make the algorithm work, i.e.

Instead we can just take the oracle to have this form:

Page 17: Lecture 1: Elementary quantum algorithms

The Deutsch-Jozsa algorithm Deutsch algorithm: start with

The function evaluation yields

A Hadamard gives

The probability of measuring is

1992

Deutsch-Jozsa algorithm: start with

The function evaluation yields

Hadamards give

The probability of measuring is

Page 18: Lecture 1: Elementary quantum algorithms

Problem: Given a function mapping bit to bit such that , determine .

The function evaluation yields

Hadamards give

The probability of measuring is

1993Bernstein,

VaziraniFourier sampling

Page 19: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Problem: Given a function mapping bits to bit ,

determine the value of such that . We have a promise that the value is unique.

Classically we need to evaluate values, .

Lov Grover

1996

Grover’s algorithm enables a search with queries.

Quantum algorithm has two crucial steps:1. Calculate the function on all values simultaneously.2. Reflect about the equal superposition state.

These steps are repeated times.

Page 20: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm We start in the state

We repeat the following times:1. Apply the function calculation .2. Apply the reflection operation .

The system will be in the state such that .

But how do we perform ?

Lov Grover

1996

Page 21: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm But how do we perform ? First, invert the operation that prepares - just Hadamards

on all qubits. Then, reflect about ; i.e. apply . Lastly, repeat the operation that prepares .

Lov Grover

1996

𝐻𝐻𝐻𝐻𝐻𝐻𝐻𝐻

𝐻𝐻𝐻𝐻𝐻𝐻𝐻𝐻

𝐻¿1⟩

Page 22: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm What does do?

Each coefficient is reflected about the mean Lov Grover

1996

Page 23: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Example: Take , with solution . We start in the state

Apply the function calculation , giving

The mean is Lov Grover

1996

Page 24: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Example: Take , with solution . We start in the state

Apply the function calculation , giving

The mean is

Therefore, when we apply the reflection operation , we get

Lov Grover

1996

Page 25: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Example: Take , with solution . Reflecting target… The mean is .

Lov Grover

1996

Page 26: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Example: Take , with solution . Reflecting target… The mean is . Reflecting about mean… Reflecting target… The mean is . Lov Grover

1996

Page 27: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Example: Take , with solution . Reflecting target… The mean is . Reflecting about mean… Reflecting target… The mean is . Reflecting about mean…

Lov Grover

1996

Solution with high probability.

Page 28: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Another way of looking at it: Rotations

Define the ket perpendicular to .

Then

with .

The operation reflects and leaves all orthogonal states unchanged.

The action of on is

Lov Grover

1996

Page 29: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Another way of looking at it: Rotations The action of on is

The action of on is

Now use

This gives

Lov Grover

1996

Page 30: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Another way of looking at it: Rotations The action of on is

The action of on is

The action of on is

Now use

This gives

Lov Grover

1996

Page 31: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Another way of looking at it: Rotations

Consider a state written as

The action of on is

Then applying gives

Lov Grover

1996

Page 32: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Another way of looking at it: Rotations

The Grover iteration gives Lov Grover

1996

¿ 𝑠⟩

¿𝜔⟩

¿ 𝑠 ′ ⟩𝑈 𝑓∨𝑠⟩

𝜙

Page 33: Lecture 1: Elementary quantum algorithms

Another way of looking at it: Rotations

The Grover iteration gives

Grover’s search algorithm

Lov Grover

1996

¿ 𝑠⟩

¿𝜔⟩

¿ 𝑠 ′ ⟩𝑈 𝑓∨𝑠⟩

𝑈 𝑠𝑈 𝑓∨𝑠⟩

𝜙3𝜙

Page 34: Lecture 1: Elementary quantum algorithms

Another way of looking at it: Rotations

The Grover iteration gives

Grover’s search algorithm

Lov Grover

1996

¿ 𝑠⟩

¿𝜔⟩

¿ 𝑠 ′ ⟩𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )2∨𝑠⟩

𝜙

5𝜙𝑈 𝑠𝑈 𝑓∨𝑠⟩

Page 35: Lecture 1: Elementary quantum algorithms

Another way of looking at it: Rotations

The Grover iteration gives

Grover’s search algorithm

Lov Grover

1996

¿ 𝑠⟩

¿𝜔⟩

¿ 𝑠 ′ ⟩𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )2∨𝑠⟩

𝜙

7𝜙

𝑈 𝑠𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )3∨𝑠⟩

Page 36: Lecture 1: Elementary quantum algorithms

Another way of looking at it: Rotations

The Grover iteration gives

Grover’s search algorithm

Lov Grover

1996

¿ 𝑠⟩

¿𝜔⟩

¿ 𝑠 ′ ⟩𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )2∨𝑠⟩

𝜙

9𝜙 𝑈 𝑠𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )3∨𝑠⟩(𝑈 𝑠𝑈 𝑓 )4∨𝑠 ⟩

Page 37: Lecture 1: Elementary quantum algorithms

Another way of looking at it: Rotations

The Grover iteration gives

Grover’s search algorithm

Lov Grover

1996

¿ 𝑠⟩

¿𝜔⟩

¿ 𝑠 ′ ⟩𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )2∨𝑠⟩

𝜙

11𝜙𝑈 𝑠𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )3∨𝑠⟩(𝑈 𝑠𝑈 𝑓 )5∨𝑠⟩

Page 38: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm Another way of looking at it: Rotations In general

For solution we want

Lov Grover

1996

¿ 𝑠⟩

¿𝜔⟩

¿ 𝑠 ′ ⟩𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )2∨𝑠⟩

𝜙

11𝜙𝑈 𝑠𝑈 𝑓∨𝑠⟩

(𝑈 𝑠𝑈 𝑓 )3∨𝑠⟩(𝑈 𝑠𝑈 𝑓 )5∨𝑠⟩𝑘opt ≈

𝜋4 √𝑁− 12

For

Page 39: Lecture 1: Elementary quantum algorithms

Grover’s search algorithm What about multiple targets? In general we have values of such that . Let us define

where are the values of such that . Define a modified

Then

with . The analysis is the same, except with the modified value of .

1996

𝑘opt ≈𝜋4 √𝑁 becomes𝑘opt≈

𝜋4 √𝑁𝑚

Lov Grover

Define projector

and reflector