Problem 207
Problem 207
n=0
(xA)
n
n!
=
n=0
(xA)
2n
(2n)!
+
n=0
(xA)
2n+1
(2n + 1)!
=
n=0
(1)
n
x
2n
(2n)!
I +
n=0
(1)
n
x
2n+1
(2n + 1)!
A
= cos x I + sin x A
4.4- Express the Hadamard gate as a product of R
x
and R
y
rotation and a phase. 2
By denition the matrix of the Hadamard gate in the computer basis is given by
H =
1
1 1
1 1
=
X +Z
2
.
Thanks to (4.2), e
X/4
= (I +X)/
2 and e
Z/4
= (I +Z)/
2 are the R
x
, R
z
rotations
of angle /4. Hence
(I +X)
2
(I +Z)
2
(I +X)
2
=
1
2
2
(I +(X +Z) XZ) (I +X)
=
1
2
2
(I +(X +Z) XZ +X I ZX XZX)
=
2
(X +Z) = H
Math 4782, Phys 4782, CS4803, September 18, 2007 2
where XZ +ZX = 0 XZX = Z have been used. Thus H = e
/2
e
X/4
e
Z/4
e
X/4
.
2
Here n = (n
x
, n
y
, n
z
) R
3
is a vector of length one. Thus
( n )
2
= (n
x
X +n
y
Y +n
z
Z)
2
= (n
2
x
+n
2
y
+n
2
z
) I +n
x
n
y
(XY +Y X) +n
y
n
z
(Y Z +ZY ) +n
z
n
x
(ZX +XZ)
= I
since XY +Y X = 0 = Y Z +ZY = ZX +XZ.
4.7- Show that XY X = Y and use it to prove that XR
y
()X = R
y
(). 2
By denition X =
0 1
1 0
and Y =
0
0
0
0
, Y X =
0
0
= XY .
Hence XY X = Y X
2
= Y . Moreover, thanks to (4.2), R
y
() = cos I + sin Y so
that indeed
XR
y
()X = cos X
2
+ sin XY X = cos I sin Y = R
y
() .
4.8- An arbitrary single qubit unitary operator can be written in the form
U = e
R
n
() (1)
for some real numbers , and a tridimensional unit vector n.
1. Prove this fact.
2. Find values for , and n giving the Hadamard gate H.
3. Find values for , and n giving the phase gate S =
1 0
0
.
2
If eq. (1) holds, since H = (X + Z)/
2 gives
cos /2 + sin /2
X +Z
=
(X +Z)
2
= H .
In much the same way S is obtained in choosing = /4, = /4 and n = (0, 0, 1)
giving
S = e
/4
e
Z/4
.
Let now U be a 2 2 unitary matrix and it will be shown that (1) holds. First, det U is
a pure phase. For indeed | det U|
2
= det Udet U = det U det U
= det UU
= 1. Therefore
there is R such that det U = e
2
. Hence U = e
. Unitarity implies that both eigenvalues are pure phases. Since det W =
= e
. As a consequence tr W = 2 cos .
As any 2 2 matrix, W can be decomposed in a unique way in the Pauli basis namely
W = w
0
I +w
x
X +w
y
Y +w
z
Z , w
i
C.
Clearly tr W = 2w
0
so that w
0
= cos . Moreover writing w
i
as u
i
+v
i
with u
i
, v
i
R (for
i = x, y, z), this gives, with u = (u
x
, u
y
, u
z
) and v = (v
x
, v
y
, v
z
),
W = cos I +u +v , W
= cos I +u v .
By unitarity, it follows that
I = WW
= (cos
2
+|u|
2
+|v|
2
) I + (2 cos u +u v) ,
giving
cos
2
+|u|
2
+|v|
2
= 1 , 2 cos u = u v .
From the second equation, it follows that 2 cos |u|
2
= 0 so that either 2 cos = 0 or u = 0.
If u = 0, then u and v are colinear, and thanks to the l.h.s, |u|
2
+ |v|
2
= 1 so that there
is R and a unit vector n such that u + v = e
e
(/2/2)
cos /2 e
(/2+/2)
sin /2
e
(+/2/2)
sin /2 e
(+/2+/2)
cos /2
(2)
2
Any 2 2 unitary matrix can be written as
U =
a b
c d
< such that |a| = cos /2, |c| = sin /2, |d| = cos
/2
Math 4782, Phys 4782, CS4803, September 18, 2007 4
and |b| = sin
a
,
b
,
c
,
d
such that
a = cos /2 e
a
b = sin /2 e
b
c = sin /2 e
c
d = cos /2 e
d
From eq. (3), it follows that
c
d
=
a
b
or equivalently, there is a real number
such that
a
+
d
=
c
+
b
= 2.
Therefore it is possible to nd real numbers and
such that
a
=
b
=
c
= +
d
= +
Setting +
= and
= H , H
2
=
X
2
+XZ +ZX +Z
2
2
= I .
In addition
HXH =
X
3
+X
2
Z +ZX
2
+ZXZ
2
=
X + 2Z X
2
= Z
Consequently, multiplying to the right and to the left by H gives HZH = X, since H
2
= I.
At last, Y = ZX = XZ so that HY H = HXHHZH = ZX = Y .
4.17- (Building cnot from the controlled-Z gate) Construct a cnot gate from one
controlled-Z gate, that is, the gate whose action on the computational basis is specied by
the unitary matrix
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
(5)
and the two Hadamard gates, specifying the control and the target qubits. 2
Math 4782, Phys 4782, CS4803, September 18, 2007 5
Fig. 1 How to construct cnot from the controlled-Z gate
The controlled-Z gate can be described algebraically as C
1
(Z)|x, y = |x Z
x
|y. It
is easy to check that its matrix is given by eq. (5) in the computational basis. Since
X = HZH (see eq. (4)), cnot|x, y = |xX
x
|y = |x(HZH)
x
|y = |xHZ
x
H|y =
I H C
1
(Z) I H|x, y giving the result described in Figure 1.
4.18- Show that 2
Fig. 2
By construction C
1
(Z)|x, y = |x Z
x
|y = |x (1)
xy
|y = (1)
xy
|x, y = Z
y
|x |y
which is exactly what Figure 2 expresses.
4.21- Verify that Figure 3 implements the C
2
(U) operation 2
As can be seen from Figure 3, there are ve gates in the circuit of the r.h.s. Therefore the
quantum states describing the computer can be labeled by |
0
, , |
5
if |
0
denotes
the input, while |
s
denotes the state after the s-th gate. So that |
5
is the output. If
the input is given by |
0
= |x, y, z then
|
1
= |x |y V
y
|z
|
2
= |x |y +x V
y
|z
|
3
= |x |y +x (V
)
x+y
V
y
|z
|
4
= |x |y + 2x (V
)
x+y
V
y
|z
= |x |y (V
)
x+y
V
y
|z
|
5
= |x |y V
x
(V
)
x+y
V
y
|z
In the last expression, giving the output, x + y has to be understood modulo 2. Namely
|
out
= |x, y V
x
(V
)
x+y
V
y
|z. So that if (x, y) = (1, 1) then the one-qubit operation
Math 4782, Phys 4782, CS4803, September 18, 2007 6
Fig. 3 Circuit for the C
2
(U) gate. V is any unitary satisfying V
2
= U. The special case
V = (1 )(I +X)/2 corresponds to the Tooli gate
V
x
(V
)
x+y
V
y
is always the indentity I, since V
= V
1
. However, if x = y = 1 then
x +y = 0, mod 2 and V
x
(V
)
x+y
V
y
= V
2
= U. Thus V
x
(V
)
x+y
V
y
= U
xy
for all (x, y)
{0, 1}
2
. And therefore |
out
= |x, y U
xy
|z = C
2
(U)|x, y, z.
It is easy to check that if V = (1 )(I + X)/2 = e
/4
e
X/4
, V
2
= (cos /2 +
sin /2X) = X. So that the previous circuit implements the Tooli gate.
4.23- Construct a C
1
(U) gate for U = R
x
() and U = R
y
() using only cnot and single
qubit gates. Can you reduce the number of single qubit gates from three to two ? 2
Fig. 4 Circuit implementing C
1
(U) : here ABC = I and U = e
AXBXC.
The quantum circuit in Figure 4 describes how to implement a C
1
(U) gate from using
only one-qubit and cnot gates.
By construction det U = e
. If U = R
y
() = e
Y
then = 0. Moreover, taking A =
I, B = e
Y/2
and C = e
Y/2
, leads to ABC = BC = I and AXBXC = XBXC =
e
Y/2
e
Y/2
= e
Y
since XY X = Y (see Exercise 4.7). In this case then, only the two
1-qubit gates B, C are needed. Actually A and C could be interchanged here.
If U = R
x
() however, a solution is given by A = H, B = e
Z/2
and C = e
Z/2
H. This
is because HZH = X and XZX = Z (see Exercise 4.13). It does not seem possible to
reduce the number of single qubit gates then.
Math 4782, Phys 4782, CS4803, September 18, 2007 7
4.24- Verify that Figure 5 implements the Tooli gate 2
Fig. 5 Implementation of the Tooli gate
To compute the outcome of the r.h.s. it will be convenient to proceed gate by gate as
indicated by the arrows in Figure 5. Since T = e
/8
e
Z/8
and since XZX = Z it
follows that XT
X = e
/4
T. It is easy to jump directly to the step #9. This gives
|
1
= |x, y, z , |
9
= |x, y X
x
T
X
y
TX
x
T
X
y
H|z
|
10
= |x T
|y TX
x
T
X
y
TX
x
T
X
y
H|z
|
11
= |x X
x
T
|y HTX
x
T
X
y
TX
x
T
X
y
H|z
|
12
= |x T
X
x
T
|y HTX
x
T
X
y
TX
x
T
X
y
H|z
|
13
= |x X
x
T
X
x
T
|y HTX
x
T
X
y
TX
x
T
X
y
H|z
|
14
= e
x/4
|x SX
x
T
X
x
T
|y HTX
x
T
X
y
TX
x
T
X
y
H|z
where T|x = e
x/4
|x has been used. If x = 0 then
|
out
= |0 |y |z = toffoli|0, y, z .
as can be checked immediately. If x = 1 then e
x/4
SX
x
T
X
x
T
|y = e
/4
SXT
XT
|y =
S|y = ()
y
|y. Thus, whenever y = 0 this gives
|
out
= |1 |0 HTXT
TXT
H|z = |1, 0, z
If now x = y = 1 then
|
out
= |1, 1 HTXT
XTXT
XH|z = toffoli|1, 0, z .
noindent However it is easy to check that
TXT
X =
e
/4
0
0 e
/4
(TXT
X)
2
= Z .
Math 4782, Phys 4782, CS4803, September 18, 2007 8
So that
|
out
= |1, 1 HZH|z = |1, 1 X|z = toffoli|1, 1, z .
Hence the result is the same as for the Tooli gate for all values of (x, y, z).
4.25- Recall that the Fredkin (controlled-swap) gate performs the transform
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1
(6)
1. Give a quantum circuit which uses three Tooli gates to construct the Fredkin gate
(Hint : think of the swap-gate construction- you can control each gate one at a time).
2. Show that the rst and the last Tooli gates can be replaced by cnot-gates.
3. Now replace the middle Tooli gate with the circuit of Figure 3 to obtain a Fredkin
gate construction using only six two-qubit gates.
4. Can you come up with an even simpler construction, with ve two-qubit gates ?
2
Fig. 6 The Fredkin gate is a controlled-swap gate
1. As can be seem from eq. (6), the Fredkin gate acts on the computational basis as
F|0, y, z = |0, y, z and F|1, y, z = |1, z, y. In other words if swap|y, z = |z, y
then it can be written as F|x, y, z = |x (swap)
x
|y, z. Hence the Fredkin gate is
nothing but a controlled-swap. The swap-gate can be implemented by three alter-
nating cnot-gates, suggesting that the Fredkin gate be given by the quantum circuit
described on the l.h.s. of Figure 6. A direct calculation of the outcome of this quan-
tum circuit gives indeed, if |
i
represents the quantum state of the computer after
the i-th gate,
Math 4782, Phys 4782, CS4803, September 18, 2007 9
|
1
= |x, y, z +xy
|
2
= |x, y +xz +x
2
y, z +xy
= |x, xy +xz, z +xy
|
out
= |
3
= |x, xy +xz, z +xy +xxy +x
2
z
= |x, xy +xz, xz +xy
In these equations, x = x
2
, x = 1 x = 1 + x, xx = 0 have been used. If x = 0 the
outcome is therefore |0, y, z while if x = 1 it is |1, z, y. Hence the l.h.s. of Figure 6
implements indeed the Fredkin gate.
2. Actually the left and the right Tooli gates can be replaced by a simple cnot gate,
as in the r.h.s. of Figure 6. For indeed the same calculation performed now on the
r.h.s. gives
|
1
= |x, y, z +y
|
2
= |x, y +xz +xy, z +y
= |x, xy +xz, z +y
|
out
= |
3
= |x, xy +xz, z +y +xy +xz
= |x, xy +xz, xz +xy
giving indeed the same result.
3. Replacing the Tooli gate in the middle by the quantum circuit given in Figure 3, will
give Figure 7, where V = e
/4
(I +X)/
2. In such a case V
2
= X, or, equivalently
(V
)
2
= X. It can be checked directly that the r.h.s. of Figure 7 gives indeed the
Fredkin gate for, using the same type of computation as before,
|
1
= |x, y, z y
|
2
= |x V
yz
|y |y z
|
3
= |x V
yz
|y |x y z
|
4
= |x (V
)
xyz
V
yz
|y |x y z
|
5
= |x (V
)
xyz
V
yz
|y |y z
|
6
= |x V
x
(V
)
xyz
V
yz
|y |y z
= |x |u |y z
|
out
= |
7
= |x |u |u y z
where
|u = V
x
(V
)
xyz
V
yz
|y .
Math 4782, Phys 4782, CS4803, September 18, 2007 10
Fig. 7 Quantum circuit implementing the Fredkin gate
Hence if x = 0 then |u = |y and |u y z = |z. If x = 1 then |u =
V (V
)
1yz
V
yz
|y = V
2{yz}
|y = X
yz
|y = |yyz = |z. Then |uyz = |y.
Thus
|
out
= |x (swap)
x
|y, z = F|x, y, z .
This circuit requires seven elementary two-qubit-gates and not six as suggested. Ho-
wever, the product of two such gates is a two-qubit gate so that the product of the
rst gates on the r.h.s. of Figure 7 can be considered as a unique two-qubit gate,
meaning that only 6 such gates are necessary. If G denotes this product then
G|y, z = e
/4
(|y +|z)
2
4. It does not seem possible to decrease the number of two-qubit gates.
4.35- (Measurement commutes with controls) A consequence of the principle of
deferred measurements is that measurements commute with quantum gates when the qubit
being measured is a control qubit, that is :
Fig. 8
(Recall that double lines represents classical bits in this diagram.) Prove the rst equality.
The rightmost circuit is simply a convenient notation to depict the use of measurement
result to classically control a quantum gate. 2
Math 4782, Phys 4782, CS4803, September 18, 2007 11
If |x, y is the input in these circuit, then on the leftmost circuit, the quantum state of
the computer before measurement is |x U
x
|y. In general then the input will be a linear
combinations
x,y
xy
|x, y of the computational basis. The measurement will give an
outcome for the value of the rst qubit. If this outcome is x, then then, thanks to the
axioms about measurement, the output will be given by
|
out
=
y
xy
U
x
|y
y
|
xy
|
2
= U
x
y
xy
|y
y
|
xy
|
2
In the middle circuit, the measurement of the rst qubit is made rst. If x is the outcome
then the new state, right after the measurement is given by
|
meas
=
y
xy
|y
y
|
xy
|
2
The classical bit x is then applied to control the gate U so that the output will be U
x
|
meas