# Quantum Computing MAS 725 Hartmut Klauck NTU 20.2.2012.

## Presentation on theme: "Quantum Computing MAS 725 Hartmut Klauck NTU 20.2.2012."— Presentation transcript:

Quantum Computing MAS 725 Hartmut Klauck NTU 20.2.2012

Quantum Computing Suppose we have a supply of qubits in some basis state We want to apply a unitary transformation Corresponding to a function we wish to compute So that measuring the resulting state gives us a desired output This unitary transformation must be the product of “few” simple, local, unitary transformations I.e., unitary transformation on 2 or 3 qubits This means to build a quantum circuit

What is the difference to probabilistic computations Randomized/probabilistic computations can be described similarly Keeping track of the probability distribution as a vector of probabilities Important difference: amplitudes can be negative, allowing for negative interference effects Undesirable computations can “cancel each other out”

“Parallel” Computing?

What can we do with the resulting state? Measuring now just yields the uniform distribution on x,f(x) We do (at least) get “really random” values of x To determine interesting properties of f we usually have to work harder and employ interference effects.

Time for the first algorithm Deutsch’s Algorithm Setup: Input is in a Black Box A function f:{0,1}  {0, 1} unknown to us (is the input) Access: We can read f(0) or read f(1) Either f(0)=f(1) or f(0)  f(1) Problem: decide which is the case

Deutsch’s Problem How many times do we have to query the Black Box? Any deterministic algorithm that must not err has to read f(0) and f(1). Any randomized algorithm with only 1 query has error probability ½ (i.e. is as good as tossing a coin for an answer....)

Quantum queries In a deterministic query algorithm the result of previous queries determines the next position to query Randomized queries: In our case there is a probability distribution on 0 and 1, that determines whether we query f(0) or f(1) Quantum queries can be in superposition instead We have to model a quantum query as a unitary operator

Quantum queries Definition of query operation: U f |i i |a i =|i i |a © f(i) i for all i,a 2 {0,1}; © is XOR operation: 0 © 0=0; 0 © 1=1; 1 © 1=0 Then U f is defined for all basis states and ) U f is defined

First Idea: “Parallel” computation

Deutsch’s Algorithm

Idea for the analysis: Effect of U f on |x i ­ 1/2 1/2 (|0 i - |1 i ): results in (-1) f(x) |x i ­ 1/2 1/2 (|0 i -|1 i ) Because: U f |0 i ­ 1/2 1/2 ( |0 i -|1 i ) = |0 i ­ 1/2 1/2 ( |f(0) i -|f(0) © 1 i ) = (-1) f(0) |0 i ­ 1/2 1/2 ( |0 i -|1 i )

Deutsch’s Algorithm U f |1 i ­ 1/2 1/2 ( |0 i -|1 i ) = |1 i ­ 1/2 1/2 ( |f(1) i -|f(1) © 1 i ) = (-1) f(1) |1 i ­ 1/2 1/2 ( |0 i -|1 i ) We can disregard the second qubit now

Deutsch’s Algorithm Now apply Hadamard transform (on the remaining qubit) State before the transformation: f(0) = f(1): § 1/2 1/2 (|0 i +|1 i ) f(0)  f(1): § 1/2 1/2 (|0 i -|1 i ) Case 1: f(0)=f(1): H § 1/2 1/2 (|0 i +|1 i ) = § |0 i Case 2: f(0)  F(1): H § 1/2 1/2 (|0 i -|1 i ) = § |1 i Measurement decides between both cases perfectly

Deutsch’s Algorithm H UfUf H |0 i |1 i Measurement H

Quantum Circuits We write algorithms as circuits on n qubits, unitary transformations are written as boxes Initial states of qubits are denoted on the left side

Deutsch-Josza Algorithm f:{0,1} n  {0,1} Is f balanced (50% 0, 50% 1) or constant? Promise: f is either balanced or constant, if not the output of the algorithm can be anything We show an algorithm with 1 query and no error Any deterministic algorithm needs : 2 n /2+1 queries! Why? We give an adversary argument: Fix f depending on the queries of the algorithm, f(x 1 )=0,...,f(x l )=0 Before l > 2 n /2 the algorithm cannot make a “safe” decision Algorithm can be forced to make an error (f might still be balanced or constant)

Deutsch Josza Algorithm H UfUf H ­ n |0 i n |1 i Measure H ­ n nnn

U f Gate/Black Box U f |x i |a i =|x i |a © f(x) i for all x 2 {0,1} n,a 2 {0,1} f:{0,1} n ! {0,1} © ist XOR Operation: 0 © 0=0; 0 © 1=1; 1 © 1=0

Deutsch Josza Algorithm

Deutsch Josza Then Hadamard Amplitude of |0 n i : f constant ) § 1 f balanced ) 0

A remark The Deutsch Josza problem can be solved easily by a randomized algorithm that is allowed to err with some small probability We will soon see quantum algorithms that “do better”

Deutsch-Josza Algorithm Deterministic: 2 n /2+1 queries Quantum: 1 query, O(n) gates (local transformations), no error Randomized algorithms are also efficient, but they need to make errors