0% found this document useful (0 votes)
78 views

Quantum Computing

This document discusses quantum computing concepts including: 1. Quantum states are represented as vectors in a complex vector space, with qubits as unit vectors. 2. Single and multiple qubit gates like CNOT, Hadamard, and Toffoli can implement reversible logic and create superpositions. 3. Entangled states like |ψ⟩ = (|00⟩ + |11⟩)/√2 cannot be decomposed into independent qubits. 4. Quantum algorithms like Grover's search algorithm exploit quantum parallelism to amplify the probability of measuring solution states in superpositions.

Uploaded by

karthikheb
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Quantum Computing

This document discusses quantum computing concepts including: 1. Quantum states are represented as vectors in a complex vector space, with qubits as unit vectors. 2. Single and multiple qubit gates like CNOT, Hadamard, and Toffoli can implement reversible logic and create superpositions. 3. Entangled states like |ψ⟩ = (|00⟩ + |11⟩)/√2 cannot be decomposed into independent qubits. 4. Quantum algorithms like Grover's search algorithm exploit quantum parallelism to amplify the probability of measuring solution states in superpositions.

Uploaded by

karthikheb
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Quantum Computing

1. Quantum States and Quantum Gates


2. Multiple Qubits and Entangled States
3. Quantum Gate Arrays
4. Quantum Parallelism
5. Examples of Quantum Algorithms
1. Grover’s Unstructured Search Algorithm
2. Schor’s Factoring Algorithm
3. Quantum Error Correcting Codes

6. Quantum Computer Architecture


7. Quantum Computers and Complexity
Quantum States

For quantum computing we need only deal with finite quantum systems,
and it suffices to consider only finite dimensional complex vector spaces
with inner product.

A quantum bit (qubit) is a unit vector in a one-dimensional complex vector


space.

We will use Bra/Ket notation (invented by Dirac) to represent these unit


vectors.

1 0
|0> = 0 |1> =
1
Single-Qubit State Transformations
Identity Transformation
I: |0>  |0> 1 0
|1>  |1> 0 1

Complement
X: |0>  |1> 0 1

|1>  |0> 1 0

Negative Complement
Y: |0>  - |1> 0 1
|1>  |0> -1 0

XY Product (phase transformation)


Z: |0>  |0> 1 0
|1>  - |1> 0 -1
Reversible Gates

Controlled Not

CNOT: |00>  |00> 1 0 0 0

|01>  |01> 0 1 0 0

|10>  |11> 0 0 0 1

|11>  |10> 0 0 1 0

CNOT is unitary CNOT CNOT* = I


Reversible Gates

Controlled-Controlled-Not (Toffoli Gate)

The third bit is negated only if the first two are both 1

CCNOT : |00x> |00x> where |x> = |0> or |x> = |1>


|01x> |01x>
|10x> |10x>
|11x> |11y> where |y> = X|x> complement of qubit
Reversible Gates

Controlled-Not and Toffoli gates are both reversible and


the unitary transformations that they implement cannot
be decomposed into a tensor product of single qubit
transformations.

The Toffoli Gate can be used to construct a complete set of


Boolean connectives.

Negation Conjunction

T|1,1,x> = |1,1,x> T|x,y,0> = |x,y,xy>


Walsh Hadamard Transformation

The single-qubit Hadamard transformation

H: |0>  (1/2) (|0> + |1>)


|1>  (1/ 2) (|0> - |1>)

When applied to n bits individually, H generates a


superposition of all 2n possible states – which can
represent numbers from 0 to 2n – 1.

(H  H  ….  H) |00…00>
= (1/ 2n)((| 0> + |1>)  (|0>+|1>)  …  (|0>+|1>)

= (1/ 2n)  |x> where the summation is from x = 0 to x = 2n - 1


Bra/Ket Notation

Let |0> and |1> be any two basis vector (states) in the complex plane.
And let |x> be any (unit) vector (state) in the plane. Then:

|x> = a|0> + b|1>

<x| = |x>* = a*<0| + b*<1|

<x|x> = 1 = (a*<0| + b*<1|)(a|0> + b|1>)


= a*a <0|0> + a*b<0|1> + b*a<1|0> + b*b <1|1>
= a*a + b*b = 1
Since <0|0> = <1|1> = 1 and <0|1> = <1|0> = 0
Bra/Ket Notation

Consider again the transformation X: |0>  |1>


|1>  |0>

We can represent X as
X = |0><1| + |1><0|

X|0> = (|0><1| + |1><0|)|0> = |0><1|0> +|1><0|0> = |1>

X|1> = (|0><1| + |1><0|)|1> = |0><1|1> +|1><0|1> = |0>

All unitary transformations can be expressed in Bra/Ket notation


Multiple Qubit States

Multiple Qubit states are formed from the tensor product of


single Qubit states

|x> = a|0> + b|1>


|y> = c|0> + d|1>

|x>  |y> = (a|0> + b|1>)  (c|0> + d|1>)


= ac(|0>  |0>) + ad (|0>  |1>) +bc (|0>  |0>) +(bd(|1>  |1>)
= ac|00> + ad |01> + bc|10> + bd|11>

The tensor product of an m dimension vector and a k dimension vector is


an mk dimension vector
Entangled States

Consider the two 2-qubit states:

|> = 1/2(|00> + |11>) and


|> = 1/2(|00> + |01>)

|> is composed by the tensor product |0>  1/2(|0> + |1>)

Measurement of the second bit will yield |0> or |1> with a probability of ½
for each result, independently of whether the first bit has been measured
or not. Measurement of the first bit will always yield |0>.

|> cannot be decomposed into a tensor product of two single qubits

It is an entangled state.
The first measurement completely determines the outcome of the second.
Cloning

Quantum states cannot be copied or cloned!


Proof

Assume a unitary transformation U such that U|a0> = |aa>


Let |a> and |b> be orthogonal states, and

U|a0> = |aa> and U|b0> = |bb>


Now consider |c> = 1/2(|a> + |b>)
By linearity U|c0> =1/2(U|a0> +U |b0>) = 1/2(|aa> + |bb>)

But if U is a cloning transformation

U|c0> = |cc> = 1/2(|a> + |b>)  1/2(|a> + |b>)


= ½(|aa> + |ab> + |ba> + bb>) Contradiction!!
Quantum Gate Arrays

1-bit full adder

|c> |c>

|x> |x>

|y> |y>

|0> |s>
|1> |1> |0>
|0> |c’>
|0> |0> |1>

Let |c> = |1>, |x> = |0>, |y> = |1> |s> = |0>, |c’> = |1>
Quantum Gate Arrays

It is possible to construct reversible quantum gates for any classical


computable function f with m input and k output bits.
There exists a quantum gate array that implements the unitary
transformation Uf : |x, y>  |x, y  f(x)>, where  indicates bitwise xor.

|x> |x>

Uf

|y> |y  f(x)>
Quantum Gate Arrays

The previous transformation Uf is reversible

Uf + = Uf U f+ U f = U f U f = I

|x> |x>
|x>

Uf Uf

|y  f(x)> |y  f(x)  f(x)>


|y>

But |y  f(x)  f(x)> = |y>


Superposition of Quantum States

Consider the Tofolli Gate


|x> |x>

|y> |y>

|0> |x>  |y>

Apply T, the Tofolli transform, to the superposition of all inputs.

T(H|0>  H|0>  |0> ) = ½(|000> + |010> + |100> + |111>)

Quantum parallelism – Applying the Tofolli transform to a superposition


of all of the input states produces a superposition of all of the states in the
“truth table”
Superposition of Quantum States

BUT Only one of the superposed states can be extracted by


measurement

0
=
1
T(H|0>  H|0>  |0> ) = ½(|000> + |010> + |100> + |111>)

|000> + |010> + |100> 0

|111> 1

Measurement of the output projects the superposition


onto the set of states consistent with the result
Quantum Parallelism

In order to take advantage of quantum parallelism one must:

1. Transform the state in such a way as to


amplify the values of interest – so that they have
a higher probability of being selected during
measurement

Grover’s unstructured search algorithm

2. Find common properties of ALL the states of f(x)

Shor’s factoring algorithm


Grover’s Unstructured Search

Given an unstructured list of size N and a proposition P,


find an x in the list such that P(x) is true.

Let UP be the Quantum gate that implements the classical


function P(x), and let n be such that 2n  N.

UP : |x,0>  |x,P(x)>

UP operating on a superposition of all input states yields:


N-1
1/2n|x,P(x)>
i=0

If there is a single state where P(xi) = 1 (true), the probability


of reading that state in a measurement is just 1/2n
We need to increase the probability of selecting this state.
Grover’s Search Algorithm

1. Prepare a register containing the superposition of all values 0…2n-1

2. Compute P(x i) on this register.

3. Change the amplitude ai to -ai for xi such that P(xi) = 1


average

4. Apply inversion about the average to increase the amplitude of xi


with P(xi) = 1.
average

5. Repeat steps 2 through 4 /4(2n ) times.

6. Read the result


Grover’s Search Algorithm

Step 3. Changing the sign

Let UP be the unitary transformation that implements


UP |x, b> = |x, b  P(x)>

Apply UP to the superposition |> = (1/2n) x=0..n-1|x> and


Choose b = (1/2)(|0> - |1>)

Let X0 = {x|P(x) = 0}, and X1 = {x|P(x) = 1} then

UP|,b> = (1/2n)UP ( |x, b> +  |x, b>)


x  X0 x  X1
Grover’s Quantum Search Algorithm

UP|,b> = (1/2n)UP ( |x, b> +  |x, b>)


x  X0 x  X1

= (1/2n+1)UP ( |x, 0> +  |x, 0> -  |x, 1> -  |x, 1>)


x  X0 x  X1 x  X0 x  X1

= (1/2n+1) ( |x, 0  0> +  |x, 0  1> -  |x, 1  0> -  |x, 1  1>)


x  X0 x  X1 x  X0 x  X1

= (1/2n+1) ( |x, 0 > +  |x, 1> -  |x, 1 > -  |x, 0>)


x  X0 x  X1 x  X0 x  X1

= (1/2n) ( |x > -  |x >)  |b>


x  X0 x  X1

The amplitude of the states in X1 have been inverted


Grover’s Quantum Search Algorithm

Step 4. Apply inversion about the average

N-1 N-1
ai|xi>  (2A – ai)|xi> Where A denotes the average
i=0 i=0 of the ai’s

This inversion can be performed by the N x N matrix

(2/N) – 1 2/N 2/N ……… 2/N

2/N (2/N)-1 2/N ………. 2/N


D=
………………………………………...

2/N 2/N 2/N ………… 2/N


Grover’s Quantum Search Algorithm

The transformation D is unitary (D*D = I) and can


be decomposed into O(n) = O(logN) quantum gates.

D = WRW where W is the Walsh-Hadamard transformation and

1 0 0 …. 0
0 -1 0 …. 0
R=
0 …………… 0
0 ………...0 -1
Grover’s Quantum Search Algorithm

Consider R = R’ – I, where I is the identity matrix and R’ is

2 0 0 ……. 0
0 0 0 …….. 0
R’ =
0 ……………… 0
0 ……………0 0

Then WRW = W(R’ – I)W, and it is easily shown that

2/N 2/N 2/N ……. 2/N


2/N 2/N 2/N ….…. 2/N
WR’W = 2/N ………………….. 2/N
2/N ……………2/N 2/N

And WR’W – I = D
Schor’s Factoring Algorithm

Factor an integer M

Step 1 – choose arbitrarily an integer a


if a is not relatively prime to M we have found a factor
else apply the rest of the algorithm.

Step 2 – choose m such that M  2m < M2


Use quantum parallelism to compute f(x) = ax mod M
for all integers from 0 to 2m –1
The function is encoded in the quantum state

(1/2m) |x,f(x)> where x ranges from 0 to 2m -1


Schor’s Factoring Algorithm

Step 2 -- details
i
Repeatedly square a (mod M) 2
{classically} to get a for i  m
This requires O(m) squarings and multiplications of m-bit numbers
(mod M)

This gives way to a gate array that uses O(m log(m) loglog (m))
gates to multiply two m-bit numbers (using Schönhage-Strassen)

The multiplication algorithm then becomes:


f(x) := 1
for i = 0 to m – 1
if (xi == 1) then //where xi is ith bit from right of x
i
f(x) := f(x) * a2 (mod M) //subroutine 2
endif
endfor
Schor’s Factoring Algorithm

Step 2 – details (cont.)

Subroutine 2
i
let c = a2
(mod M), and b = poweri, then
result := 0
for j = 0 to m – 1
if (bi == 1) then
result := result + 2ic (mod M)
endif
endfor

Where 2ic is precomputed and built into the gate structure.


The inverse of this operation is then used to erase b.
Schor’s Factoring Algorithm

Step 3 – Construct a state that has the same period as f

Measure the last lg M bits of (1/2m) |x,f(x)>


The measurement projects the state space onto the subspace
that is compatible with the measured value>
The state after measurement is:

 0 otherwise
1 if f(x) = u
C x g(x)|x,u> where g(x) =
and C is a complex scale factor
Schor’s Factoring Algorithm

m bits

|x> A|x, 0>  |x, f(x)> |x>


where
f(x) = ax (mod M)
|0> |f(x)>
log M qubits
Measure last log M bits

State |x, f(x)> is collapsed to g(x) |x,u> where


u is the measured state, and g(x) = 1 if f(x) = u, else 0
Schor’s Factoring Algorithm

amplitude

x
The above graph displays the values of x consistent with the
measurement on |f(x)>

If only we could measure the separation between


adjacent values, our problem would be solved!
But alas, quantum mechanics only allows a single measurement!!
We must find a way of determining the periodicity of these states
from a single measurement of the first m bits of our register.
Schor’s Factoring Algorithm
The Fourier transform of this superposition of states that
give the measured u as a value of f(x) maps into states in a
frequency domain.
g(x)|x>
G(c)|c>

|x> A|x,0> UQFT

Measurement of
transformed
Measurement of f(x) states
Schor’s Factoring Algorithm

Step 4 – Perform a quantum Fourier transform on the resulting state

UQFT : x g(x)|x,u>  x G(c)|c,u>

When the period r of the function g(x) is a power of 2, the


resulting Fourier transform is

j cj |j(2m/r),u>

where the amplitude is 0 except at multiples of 2m /r. When the period


r does not divide 2m, the transform approximates the exact case and
most of the amplitude is attached to integers close to 2m /r
Schor’s Factoring Algorithm
Step 4 – details

1 0 0 0
0 1 0 0
Let Sj,k =
0 0 1 0
0 0 0 eik-j

where k –j = /2k-j

The quantum Fourier transform is then given by


Hm-1Sm-2,m-1 Hm-2Sm-3,m-1Sm-3,m-2 Hm-3 …. H1S0,m-1S0,m-2 …S0,1H0

Where the matrices are applied in reverse order (from left to right)
and the transformed state is the bit-reversed state of state |c>

The quantum Fourier transform requires m(m-1)/2 gates.


Schor’s Factoring Algorithm

Step 5 – Extract the period

Measure the state, and call the result v


v = j(2m/r)
In general j and r will be relatively prime and the period
is not a power of 2. A continued fraction expansion (on a
classical computer) will produce an integer value q, that
is likely to be the period.

Step 6 – Find a factor of M

If q is even, use the Euclidean algorithm to check


whether (aq/2 + 1) or (aq/2 - 1) has a non-trivial
factor with M
Schor’s Factoring Algorithm

The reason why (aq/2 + 1) or (aq/2 - 1) is likely to have a


non-trivial common factor with M is as follows:

If q is the period of f(x) = ax mod M then

aq = 1 mod M since
aq ax = ax mod M for all x.
If q is even we can write
(aq/2 + 1) (aq/2 - 1) = 0 mod M
thus, if neither of these factors is a multiple of M,
either has a non-trivial factor with M. (found by
using Euclid’s algorithm on a classical computer)
Schor’s Factoring Algorithm

Step 7 – Repeat the algorithm, if necessary

Reasons for having to repeat the algorithm

1. The value of v was not close enough to a multiple of 2m/r


2. The period r and the multiplier j have a common factor –
so that the denominator q was a factor of the period and
not the period itself
3. Step 6 yields M as M’s factor
4. The period of f(x) = ax mod M is odd

Schor shows (claims) that this procedure, when applied to a random a


(mod M) yields a non-trivial factor of M with probability at least 1
– 1/2k-1 where k is the number of distinct odd prime factors of M.
Schor’s Factoring Algorithm

Example

Let M = 21
Step 1 – choose a = 11 which is relatively prime to M

Step 2 – let M2  2m < 2 M2 441  2m < 882 then m = 9


find ax mod M on the superposition of states x = 0,…,2m - 1

Step 3 – Measure the last lg M qubits of the state


(1/2m) x|x, ax (modM)>
 C xg(x)|x, u>

Step 4 – Apply Fourier transform to collapsed state


UQFT : xg(x)|x, u>  G(c)|c>
Schor’s Factoring Algorithm

Step 5. Measure the transformed state


Assume measurement gives v = 427
Since v and 2m are relatively prime, the period r will
probably not divide 2m, and continued fraction expansion
of v/2m yields q = 6. (This is probably the period of f )

Step 6. Since q is even, aq/2 + 1 or aq/2 – 1 is likely to have a non-


trivial common factor with M. (On a classical computer)

a = 11, q/2 = 3, M = 21
(113 + 1) = 1332 (113 - 1) = 1330
gcd(1332, 21) = 7 and gcd(1330, 21) = 3
Quantum Error Correction

One problem in constructing quantum computers is the problem of


decoherence – the interaction of qubits with the external environment
causing them to transform in an unintended (and non-unitary) fashion.
Steane estimates the decoherence of any system likely to be built to be 107 times
too large to run Shor’s algorithm on a 130 digit number.*

Characterization of Errors

|  >  (e1I + e2 X + e3 Y + e4 Z)|  > = i ei Ei |  >

The possible errors for each single qubit consist of no errors (I),
bit- flip errors (X), phase errors (Z), and bit-flip phase errors (Y).
In the general case, possible errors are expressed as linear
combinations of unitary error operators Ei

*Steane, A. (1998) –preprint – http://xxx.lanl.gov/abs/quant-ph/9708022


Quantum Error Correction
Given – an error correcting code, C, with a syndrome extraction operator SC–
An n-bit quantum state |> is encoded in an n + k bit quantum state |>.

|> = C|>

Assume decoherence leads to an error state  i e i E i | >


The signal encoded state |> can be recovered as follows:

1. Apply the syndrome extraction operator SC to the quantum state (padded with
sufficient 0 bits.) SC(i ei Ei | >)  |0> = i ei Ei | >  |i>
2. Measure the |i> component of the result. This yields some random value i0 and
projects the state to Ei0 | , i0>
3. Apply the inverse error Ei0-1 to the first n+ k qubits of Ei0| , i0> to get the
corrected state | >
Quantum Error Correction

Example

Consider an error correcting code C that maps

|0>  |000>, and


|1>  |111>

C can correct single bit-flip errors

E = {I  I  I, X  I  I, I  X  I, I  I  X}

The syndrome extraction operator is:

S: |x0, x1, x2, 0, 0, 0>  |x0, x1, x2, x0 xor x1, x0 xor x2, x1 xor x2>
Quantum Error Correction

Consider the qubit

|> = 1/2(|0> - |1>)

C|> = |> = 1/2(|000> - |111>)

And the error is (two single bit-flip errors)

E =(4/5) X  I  I + (3/5) I  X  I

The resulting error state is

E |> = (4/5 X  I  I + 3/5 I  X  I )(1/2) (|000> - |111>)


Quantum Error Correction

continuing

E |> = (4/52)|(100> - |011>) + (3/52)(|010> - |101>)

Now apply the syndrome extraction operator to

Sc E |>  |000>

= Sc((4/52)|(100000> - |011000>) + (3/52)(|010000> - |101000>))


= (4/52)|(100110> - |011110>) + (3/52)(|010101> - |101101>)
= (4/52)|(100> - |011>)  |110> + (3/52)(|010> - |101>)  |101>
Quantum Error Correction

Measurement of the last three bits yields either state


|110> or |101>

Assume measurement yields |110>

then the state collapses to

1/2(|100> - |011>)  |110>

The error can now be removed by applying Ei-1 = X  I  I


to the first three bits of the state.

Ei-1 (1/2(|100> - |011>) = 1/2(|000> - |111>


The Architecture of a Quantum Computer

Preliminaries

Define an operator q † = |1><0|

q†|0> = |1><0| 0> = |1>


q†|1> = |1><0| 1> = 0

Similarly, q, the complex conjugate of q†, is defined


q = |0><1|
q|0> = |0><1| 0> = 0
q|1> = |0><1| 1> = |0>

Note that

q† + q = X and q†q + q q† = I
The Architecture of Quantum Computers

Time evolution of a quantum system

Let |in> be the initial state of a quantum system, then


the time evolution of this system is given by the equation

|out> = eiHt |in>

where H is the time evolution operator (Hamiltonian) and eiHt can be


expanded as

eiHt = 1 + iHt – H2t2/2! + …..

The operator H is operating an innumerable number of times,


and our output state is the superposition of all these possibilities
The Architecture for a Quantum Computer

The basic Computer Architecture

k
.

logic
.
.
1
0

Memory program
Program counter
The Architecture of a Quantum Computer
Are we there yet?
k |1>

k-1 |1>

. |0>
. |0>
. Ak-1 Ak-2 ,.,A2 A1
|1>

A2 |1>
2
1 A1 |0>

0 |1>

|0> A1|>
A2A1 |>
PC
† q A Qubit registers
q†
q 12q01A12
H =  q† i +1q i Ai +1 + c.c where summation is from i = 0 to i = k-1
References

Los Alamos preprint server: http://xxx.lanl.gov/archive/quant-ph

E. Reiffel and W. Polak. 1998. An Introduction to Quantum Computing for Non-


Physicists. lanl preprint.

R. P. Feynman. 1996. Lectures on Computation. Addison-Wesley.

P. W. Schor. 1997. Polynomial-time algorithms for prime factorization and discrete


logarithms on a quantum computer. Society for Industrial and Applied Mathematics
Journal on Computing 25, 5, 1484-1509. (Expanded version of 1994 paper)

You might also like