Exercises
Exercises
1
The eigenvectors are as follows:
Pauli Z: |0⟩, |1⟩
Pauli X: |0⟩ + |1⟩, |0⟩ − |1⟩
Pauli Y : |0⟩ + i |1⟩, |0⟩ − i |1⟩
Bloch sphere representations:
Exercise 4.2
X X X
exp(iAx) = (iAx)n = (−1)n x2n I + (−1)n ixn A = cos(x)I + i sin xA
n n n
Exercise 4.3
Up to a global phase:
−i π /2
e−iπ/8
0 e 4 0
T = = π = Rz (π/4)
0 eiπ/8 0 ei 4 /2
Exercise 4.4
First consider
Rθz R−iθ
x Rz :
−i sin 2θ
cos 2 e
Rz Rx Rz =
−i sin 2θ cos 2θ eiθ
For θ = π2 : −i π −i π
1 e 2 e 2
Rz Rx Rz = √2 −i π2 π
e ei 2
π
Hence, by multiplying by ei 2 we get,
1
i π2 √1
1 1
e Rz Rx Rz = =H
2 1 −1
Exercise 4.5
We have n2x + n2y + n2z = 1
nz nx − iny
n̂ · ⃗σ =
nx + iny nz
Therefore,
n2x + n2y + n2z
2 0 1 0
(n̂ · ⃗σ ) = = =I
0 n2x + n2y + n2z 0 1
Consider, Rn (θ)Rn (−θ)
I = Rn (θ)Rn (−θ) = (cos( 2θ )I −sin( 2θ )n̂·⃗σ )(cos( 2θ )I +sin( 2θ )n̂·⃗σ ) = cos2 ( 2θ )I +sin2 ( 2θ )(n̂·⃗σ )2 =
(cos2 ( 2θ ) + sin2 ( 2θ ))I = I
Exercise 4.6
First, let’s show
that RZ (x) rotates around the Z-axis by an angle x. Consider the general
cos 2θ
state |ψ⟩ = iϕ . Then,
e sin 2θ
cos 2θ cos 2θ cos 2θ
x x x x
RZ (x) |ψ⟩ = (cos 2 I − i sin 2 Z) iϕ = cos 2 iϕ − i sin 2 =
e sin 2θ e sin 2θ −eiϕ sin 2θ
−ix/2
cos 2θ cos 2θ
e
=
eix/2 eiϕ sin 2θ ei(ϕ+x) sin 2θ
Hence, the state has been rotated by x around the Z-axis. Similarly, we get that RX (x) and
RY (x) rotate around the X and Y axis respectively.
We also have that,
Rn (x) = cos x2 I −i sin x2 (nx X +ny Y +nZ Z) = cos x2 I −i sin x2 (sin θn cos ϕn X +sin θn sin θn Y +
cos θn Z) = RZ (ϕn )RX (θn )(cos x2 I−i sin x2 Z)RX (θn )† RZ (ϕn )† = RZ (ϕn )RX (θn )RZ (x)RX (θn )† RZ (ϕn )†
Therefore, Rn (x) rotates the axis of rotation to the Z axis performs the rotations by angle x
and then returns the axis back to n, which is the same as rotating around n by an angle x.
Exercise 4.7
{X, Y } = 1 therefore, XY X = −XXY = −Y .
XRY (θ)X = X(cos 2θ I − i sin 2θ Y )X = cos 2θ I + i sin 2θ Y = RY (−θ)
Exercise 4.8
Any 2x2 unitary
matrix for a2 + b2 + c2 + d2 = 1 can be written as,
a + ib c + id
1)U = eiα
−c + id a − ib
Consider, the given form for U ,
θ θ θ
iα iα cos 2 − i sin 2 nz − sin 2 (ny + inx )
U = e Rn (θ) = e
sin 2θ (ny − inx ) cos 2θ + i sin 2θ nz
2 2 2
As, nx + ny + nz = 1 this has the same form as the general U , hence any arbitrary 2x2
unitary matrix can be written as U = eiα Rn (θ).
2) nz = √12 , ny = 0, nx = √12 , α = 0 and θ = π.
3) nx , ny = 0, nz = 1, α = θ = π4 .
2
Exercise 4.9
We can write,
cos γ2 −ei(α−β/2+δ/2) sin γ2 cos γ2 −ei(−β/2+δ/2) sin γ2
i(α−β/2−δ/2) i(−β/2−δ/2)
e iα e
U = i(α+β/2−δ/2) γ i(α+β/2+δ/2) γ =e i(β/2−δ/2) γ i(β/2+δ/2) γ =
e sin 2
e cos 2
e sin 2
e cos 2
iα a b
e
−b∗ a∗
which is the general form of a 2x2 unitary matrix as det(U ) = cos2 γ2 + sin2 γ2 = 1.
Exercise 4.10
ei(α−β/2−δ/2) cos γ2 −iei(α−β/2+δ/2) sin γ2
iα
U = e RZ (β)RX (γ)RZ (δ) =
−iei(α+β/2−δ/2) sin γ2 ei(α+β/2+δ/2) cos γ2
which once again is a unitary matrix.
Exercise 4.11
Exercise 4.12
From the proof of Corollary 4.2 we have, AXBXC = RZ (β)RY (γ)RZ (δ). We can see that
α = γ = δ = π2 and β = 0 gives H. Hence, we can take A = RY ( π4 ),B = RY (− π4 )RZ (− π4 )
and C = RZ ( π4 ).
Exercise 4.13
1 1
1 0 1 1 1 1 2 0
HXH = = =Z
1 −1 1 0
1 −1 2 0 −2
2
1 1 0 −i 1 1 0 2i
HY H = 21 = 12 = −Y HZH = HHXHH = X
1 −1 i 0 1 −1 −2i 0
Exercise 4.14
T = RZ ( π4 )
HT H = HRZ ( π4 )H = H(cos π8 − i sin π8 Z)H = cos π8 − i sin π8 X = RX ( π4 )
Exercise 4.15
(Check Errata for the sign in the second equation)
1)Rn̂2 (β2 )Rn̂1 (β1 ) = (c2 I − is2 n̂2 .σ)(c1 I − is1 n̂1 .σ) = c1 c2 I − s1 s2 (n̂2 .σ)(n̂1 .σ) − ic2 s1 n̂1 .σ −
ic1 s2 n̂2 .σ = c1 c2 I −s1 s2 (n̂1 .n̂2 I +i(n̂2 × n̂1 ).σ)−ic2 s1 n̂1 .σ −ic1 s2 n̂2 .σ = (c1 c2 −s1 s2 n̂1 .n̂2 )I −
i(c2 s1 n̂1 + c1 s2 n̂2 + s1 s2 n̂2 × n̂1 ).σ
Therefore,
c12 = c1 c2 − s1 s2 n̂1 .n̂2
s12 n̂12 = c2 s1 n̂1 + c1 s2 n̂2 + s1 s2 n̂2 × n̂1
2)β1 = β2 and n̂1 = ẑ, hence c1 = c2 = c and s1 = s2 = s. Therefore,
c12 = c2 − s2 ẑ.n̂2
s12 n̂12 = cs(ẑ + n̂2 ) + s2 n̂2 × ẑ
3
Exercise 4.16
√1
I I
H1 =
I −I
2
H 0
H2 = √12
0 H
Exercise 4.17
H 0 I 0 H 0 HH 0 I 0
= = = CN OT
0 H 0 Z 0 H 0 HZH 0 X
Exercise 4.18
When the second qubit is the control we have the following
representation,
1 0 0 0
0 1 0 0
CZ2 = |00⟩ ⟨00| + |01⟩ ⟨01| − |11⟩ ⟨11| + |10⟩ ⟨10| =
0 0 1 0
0 0 0 −1
Exercise 4.19
I 0 A B I 0 A XB
CNOTρCNOT = =
0 X C D 0 X XC XDX
X only rearranges elements, hence the CNOT only rearranges the elements of ρ.
Exercise 4.20
1 H H I 0 H H 1 HH + HXH HH − HXH
(H1 ⊗H2 )CNOT(H1 ⊗H2 ) = =2 =
2 H −H 0 X H −H HH − HXH HH + HXH
1 0 0 0
1 I +Z I −Z
0 0 0 1 nd
2 I −Z I +Z
= 0 0 1 0 = CNOT(2 qubit control)
0 1 0 0
The left circuit transforms between the |0⟩,|1⟩ and |+⟩,|−⟩ basis applies a CNOT and trans-
forms back. Hence, the effect of the CNOT on the |±⟩ |±⟩ is the same as applying the
CNOT with the 2nd qubit as target to the state in the |0⟩,|1⟩ basis and then replacing 0
with + and 1 with −. This process does indeed give the equations 4.24-4.27.
Exercise 4.21
Consider all the possible inputs,
|00ψ⟩ → |00ψ⟩ → |00ψ⟩ → |00ψ⟩ → |00ψ⟩ → |00ψ⟩
|01ψ⟩ → |01(V ψ)⟩ → |01(V ψ)⟩ → |01(V † V ψ)⟩ → |01ψ⟩ → |01ψ⟩
|10ψ⟩ → |10ψ⟩ → |11ψ⟩ → |11(V † ψ)⟩ → |10(V V † ψ)⟩ → |10ψ⟩
|11ψ⟩ → |11(V ψ)⟩ → |10(V ψ)⟩ → |11(V ψ)⟩ → |11(V V ψ)⟩ → |11U ψ⟩
Hence, the circuit does perform the C 2 (U ) operation.
4
Exercise 4.22
Firstly, we apply the circuit in figure 4.6 to the circuit in figure 4.8 for V = eiα AXBXC,
which gives,
α
α −α
C B A A† B† C† C B A
We move the 6th CNOT left from the 4th one, which involves adding CNOTs after the 4th
and 5th CNOTs from first to third qubit, which is due to,
and can be checked by considering all the possible inputs. We also see that AA† =
CC † = I. Hence we get the following circuit.
α
α −α
C B B† B A
The dashed section is diagonal hence commutes with the rest of the components there-
fore can be moved to the end for convenience.
α
α −α
C B B† B A
CNOTs 2 and 3, and 6 and 7 cancel each other, hence we’re left with the circuit.
α
α −α
C B B† B A
Exercise 4.23
For U = RX (θ) from corollary 4.2 we can see that A = H, B = RZ (− 2θ ), C = RZ ( 2θ )H, which
gives ABC = I and AXBXC = HXRZ (− 2θ )XRZ ( 2θ )H = HXXRZ ( 2θ )RZ ( 2θ )H = RX (θ).
For U = RY (θ) we can take A = I, B = RY (− 2θ ) and C = RY ( 2θ ), which gives ABC = I
and AXBXC = XRY (− 2θ )XRY ( 2θ ) = XXRY ( 2θ )RY ( 2θ ) = RY (θ).
5
Exercise 4.24
To verify the circuit we consider the state after each operation. Let the initial state be |xyz⟩,
where x, y, z ∈ {0, 1}.
|xyz⟩
yH3
1
√ (|xy0⟩ +(−1)z |xy1⟩)
2
yCNOT23
1
√ (|xyy⟩ +(−1)z |xy ȳ⟩)
2
†
yT3
1
√ (e−iyπ/4 |xyy⟩ +e−iȳπ/4 (−1)z |xy ȳ⟩)
2
yCNOT13
1
√ (e−iyπ/4 |xy(y ⊕ x)⟩ +e−iȳπ/4 (−1)z |xy(ȳ ⊕ x)⟩)
2
yT3
1
√ (ei(y⊕x−y)π/4 |xy(y ⊕ x)⟩ +ei(ȳ⊕x−ȳ)π/4 (−1)z |xy(ȳ ⊕ x)⟩)
2
yCNOT23
1
√ (ei(y⊕x−y)π/4 |xyx⟩ +ei(ȳ⊕x−ȳ)π/4 (−1)z |xyx̄⟩)
2
†
yT3
1
√ (ei(y⊕x−y−x)π/4 |xyx⟩ +ei(ȳ⊕x−ȳ−x̄)π/4 (−1)z |xyx̄⟩)
2
yCNOT13
1
√ (ei(y⊕x−y−x)π/4 |xy0⟩ +ei(ȳ⊕x−ȳ−x̄)π/4 (−1)z |xy1⟩)
2
†
yT2 T3
1
√ (ei(y⊕x−2y−x)π/4 |xy0⟩ +ei(ȳ⊕x−x̄)π/4 (−1)z |xy1⟩)
2
yCNOT12 H3
1 i(y⊕x−2y−x)π/4 1
(e + ei(ȳ⊕x−x̄)π/4 ) |x(y ⊕ x)0⟩ + (ei(y⊕x−2y−x)π/4 − ei(ȳ⊕x−x̄)π/4 (−1)z ) |x(y ⊕ x)1⟩
2 2†
yT2
1 i(−2y−x)π/4 1
(e + ei((1−2y)(1−2x)−x̄)π/4 ) |x(y ⊕ x)0⟩ + (ei(−2y−x)π/4 − ei((1−2y)(1−2x)−x̄)π/4 (−1)z ) |x(y ⊕ x)1⟩
2 2
yCNOT23
1 i(−2y−x)π/4 1
(e + ei((1−2y)(1−2x)−x̄)π/4 ) |xy0⟩ + (ei(−2y−x)π/4 − ei((1−2y)(1−2x)−x̄)π/4 (−1)z ) |xy1⟩
2 2
yT1 S2
6
1 1
(1 + ei((1−2y)(1−2x)−1+2x+2y)π/4 ) |xy0⟩ + (1 − ei((1−2y)(1−2x)−1+2x+2y)π/4 (−1)z ) |xy1⟩
2 2
=
1 1
(1 + (−1)xy+z ) |xy0⟩ + (1 − (−1)(xy+z) ) |xy1⟩
2 2
If x, y = 1 then we get |xyz̄⟩ and |xyz⟩ otherwise, hence the circuit does indeed implement
the Toffoli gate.
Exercise 4.25
1)
2)
If the first qubit is 0, then the Toffoli just performs the identity, hence the CNOTs cancel
leading to an overall identity. If the first qubit is 1, then the Toffoli performs a CNOT on
the last 2 qubits, which overall performs the SWAP operation.
3) For the Toffoli we take V = (1−i)(1+iX)
2
, which gives V 2 = X. Then, after changing the
order of the last 2 qubits the circuit is,
V V† V
Which simplifies to,
CV23 C32
V† V
4)As V is unitary the CV13 gate commutes with the CV23† and C12 gates, hence we can move
it to the left of CV23† . Afterwards, the last to CNOTs commute as well, hence we get
=
CV23 C32 CV23 C32 C32 CV23†
V V† V
which contains 5 two-qubit gates.
7
Exercise 4.26
Consider all the possible controls,
|00t⟩ → |00(RY (π/4)RY (π/4)RY (−π/4)RY (−π/4))t⟩ = |00t⟩
|01t⟩ → |01(RY (π/4)XRY (π/4)RY (−π/4)XRY (−π/4))t⟩ =
|01(RY (π/4)RY (−π/4)XXRY (π/4)RY (−π/4))t⟩ = |01t⟩
|10t⟩ → |10(RY (π/4)RY (π/4)XRY (−π/4)RY (−π/4))t⟩ =
|10(RY (π/4)RY (π/4)RY (π/4)RY (π/4)X)t⟩ = |10(RY (π)X)t⟩ = − |10(Zt)⟩
|11t⟩ → |11(RY (π/4)XRY (π/4)XRY (−π/4)XRY (−π/4))t⟩ =
|11(RY (π/4)RY (−π/4)RY (−π/4)RY (π/4)X)t⟩ = |11(Xt)⟩
Hence, the circuit does indeed implement the Toffoli gate, with the angle for the phase factor
being, (
π, for (c1 , c2 , t) = (1, 0, 0)
θ(c1 , c2 , t) =
0, otherwise
Exercise 4.27
We can write the matrix as,
U = |000⟩ ⟨000|+|010⟩ ⟨001|+|011⟩ ⟨010|+|100⟩ ⟨011|+|101⟩ ⟨100|+|110⟩ ⟨101|+|111⟩ ⟨110|+
|001⟩ ⟨111|
Which implies the following inputs and outputs
|000⟩ → |000⟩
|001⟩ → |010⟩
|101⟩ → |110⟩
|010⟩ → |011⟩
|011⟩ → |100⟩
|100⟩ → |101⟩
|110⟩ → |111⟩
|111⟩ → |001⟩
Firstly, we can notice that the first qubit only changes when both the other ones are set,
hence we start the circuit with a Toffoli(2,3,1) with the first qubit as target. Looking at
|001⟩ → |010⟩, |101⟩ → |110⟩, |010⟩ → |011⟩, |110⟩ → |111⟩ and |111⟩ → |001⟩ we can see
that C23 C32 after the Toffoli gives the desired results. For |011⟩ → |100⟩ and |100⟩ → |101⟩
we require a C13 after the rest of the gates. However, this changes |110⟩ → |111⟩ to |110⟩ →
|110⟩, hence we apply a Toffoli(1,2,3), as no other final state has both first and second qubit
set. Hence the circuit will be,
8
Exercise 4.28
Analogous to the circuit for C 2 (U ) we have,
V V† V
Exercise 4.29
A recursive circuit analogous to figure 4.6, using A = RZ ( π2 ), B = RZ (− π2 )RY (− π2 ) and
C = RY ( π2 ). The circuit is,
n−1
n−1
C B A
O(n) = O(n2 ).
P
Each recursion requires O(n) gates, hence the overall cost is n
For more details, arXiv:quant-ph/9503016v1.
Exercise 4.30
A recursive circuit can be used for this with V 2 = U , which analogous with figure 4.8 is,
n−1 n−1
=
U V V† V
The cost of the CV gates is O(1). Let the cost of the C n (U ) be Cn . The cost of the C n−1 (X)
is O(n), hence the total cost from recursion will be Cn = Cn−1 + O(n) = O(n2 ).
For more details, arXiv:quant-ph/9503016v1.
Exercise 4.31
I 0 0 I I 0 I 0 0 X 0 X
CX1 C = = = = X 1 X2
0 X I 0 0 X 0 X I 0 X
0
I 0 0 −iI I 0 I 0 0 −iX 0 −iX
CY1 C = = = = Y1 X2
0 X iI 0 0 X 0 X iI 0 iX 0
I 0 I 0 I 0 I 0 I 0 I 0
CZ1 C = = = = Z1
0 X 0 −I 0 X 0 X 0 −X 0 −I
I 0 X 0 I 0 I 0 X 0 X 0
CX2 C = = = =X
0 X 0 X 0 X 0 X 0 I 0 X 2
I 0 Y 0 I 0 I 0 Y 0 Y 0
CY2 C = = = = Z1 Y2
0 X 0 Y 0 X 0 X 0 Y X 0 −Y
I 0 Z 0 I 0 I 0 Z 0 Z 0
CZ2 C = = = = Z1 Z2
0 X 0 Z 0 X 0 X 0 ZX 0 −Z
9
RZ,1 (θ)C = (cos 2θ I − i sin 2θ Z1 )C = cos 2θ CI − i sin 2θ CZ1 = CRZ,1 (θ)
RX,2 (θ)C = (cos 2θ I − i sin 2θ X2 )C = cos 2θ CI − i sin 2θ CZ2 = CRX,2 (θ)
Exercise 4.32
P0 ρP0
The state after measurement is tr(P 0 ρP0 )
with probability tr(P0 ρP0 ) for measurement result
P1 ρP1
0 and tr(P1 ρP1 ) with probability tr(P1 ρP1 ) for measurement result 1. Hence,
P0 ρP0 P1 ρP1
ρ′ = tr(P0 ρP0 ) tr(P 0 ρP0 )
+ tr(P1 ρP1 ) tr(P 1 ρP1 )
= P0 ρP0 + P1 ρP1
X
tr2 (ρ) = ⟨i2 | ρ |i2 ⟩
X i X X X
tr2 (ρ′ ) = ⟨i2 | ρ′ |i2 ⟩ = ⟨i2 | (|j2 ⟩ ⟨j2 | ρ |j2 ⟩ ⟨j2 |) |i2 ⟩ = δij ⟨j2 | ρ |j2 ⟩ = ⟨i2 | ρ |i2 ⟩
i i,j i,j i
Therefore, tr2 (ρ) = tr2 (ρ′ ).
Exercise 4.33
The circuit performs the following,
CNOT H1
|xy⟩ −−−→ |x(y ⊕ x)⟩ −→ √1 (|0(y ⊕ x)⟩ + (−1)x |1(y ⊕ x)⟩)
2
Hence, the possible input outputs are,
|00⟩ → √12 (|00⟩ + |10⟩)
|01⟩ → √12 (|01⟩ + |11⟩)
|10⟩ → √12 (|01⟩ − |11⟩)
|11⟩ → √12 (|00⟩ − |10⟩)
Hence, the circuits effect on the Bell states is as follows,
√1 (|00⟩ + |11⟩) → |00⟩
2
√1 (|00⟩ − |11⟩) → |10⟩
2
√1 (|01⟩ + |10⟩) → |01⟩
2
√1 (|01⟩ − |10⟩) → |11⟩
2
Therefore, by performing a measurement in the computational basis at the end of the circuit,
we are overall performing a bell measurement.
†
The state |ψ⟩ after the measurement is given by √ Mm†|ψ⟩ . Hence, comparing with the
⟨ψ|Mm Mm |ψ⟩
effect of the circuit on the bell states we see that the measurement elements are,
M0 = (|00⟩ + |11⟩)(⟨00| + ⟨11|)
M1 = (|00⟩ − |11⟩)(⟨00| − ⟨11|)
M2 = (|01⟩ + |10⟩)(⟨01| + ⟨10|)
M3 = (|01⟩ − |10⟩)(⟨01| − ⟨10|)
As this are projective measurements the POVM elements are equal to these.
Exercise 4.34
This can be done by using a controlled gate to entangle the system to a qubit whose mea-
surement will collapse the state into the +1 or −1 eigenbasis, while will also give us the
state on the original qubit. The circuit performs the following,
H1 CU H1 1
|0ψin ⟩ −→ √1 (|0ψin ⟩ + |1ψin ⟩) −
−→ √12 (|0ψin ⟩ + |1(U ψin )⟩) −→ (|0ψin ⟩ + |1ψin ⟩ + |0(U ψin )⟩ −
2 2
1
|1(U ψin )⟩) = 2 (|0⟩ (I + U ) |ψin ⟩ + |1⟩ (I − U ) |ψin ⟩)
If the measurement value is 0 then the state is |ψout ⟩ = (I + U ) |ψin ⟩ for which U |ψout ⟩ =
U (I + U ) |ψin ⟩ = (I + U ) |ψin ⟩, therefore the result with eigenvalue +1 has taken place.
10
If the measurement value is 1 then the state is |ψout ⟩ = (I − U ) |ψin ⟩ for which U |ψout ⟩ =
U (I − U ) |ψin ⟩ = −(I − U ) |ψin ⟩, therefore the result with eigenvalue −1 has taken place.
Exercise 4.35
Let the system be in the state a |0ψ⟩ + b |1ψ⟩. Then the effect of the circuits are,
CU Mes.
1)a |0ψ⟩ + b |1ψ⟩ −−→ a |0ψ⟩ + b |1(U ψ)⟩ −−→ 0 with p = |a|2 and state |ψ⟩ or 1 with p = |b|2
and state U |ψ⟩
Mes. CU
2)a |0ψ⟩ + b |1ψ⟩ −−→ 0 with p = |a|2 or 1 with p = |b|2 , both with state |ψ⟩ −−→ |ψ⟩ with
p = |a|2 or U |ψ⟩ with p = |b|2
Hence, the two circuits perform the same operation.
Exercise 4.36
Consider all the possible input states.
If x = 00 then nothing needs to be applied.
If x = 01 we have for y,
|00⟩ → |01⟩, |01⟩ → |10⟩, |10⟩ → |11⟩, and |11⟩ → |00⟩. The circuit for this is,
|x1 ⟩
|x2 ⟩
|y1 ⟩
|y2 ⟩
If x = 10 we have for y,
|00⟩ → |10⟩, |01⟩ → |11⟩, |10⟩ → |00⟩, and |11⟩ → |01⟩. The circuit for this is,
|x1 ⟩
|x2 ⟩
|y1 ⟩
|y2 ⟩
If x = 01 we have for y,
|00⟩ → |11⟩, |01⟩ → |00⟩, |10⟩ → |01⟩, and |11⟩ → |10⟩. The circuit for this is,
|x1 ⟩
|x2 ⟩
|y1 ⟩
|y2 ⟩
Hence, the full circuit is,
|x1 ⟩
|x2 ⟩
|y1 ⟩
|y2 ⟩
11
Exercise 4.37
Identical
1 to the 3x3 matrix we do the following,
√1 0 0
√
2 2
√1 − √1 0 0
U1 = 0
2 2
0 1 0
0 0 0 1
√
2 √2 (1 + i) 0 √12 (1 − i)
1
√
1 0 √1 (1 − i) 2 √12 (1 + i)
U1 U = 2 2
1 −1 1 −1
1 −i −1 i
q
2 √1
3
0 3
0
0 1 0 0
U2 = q
1 2
3 0 − 3 0
√
0 0 0 1
√
3 √i √1 − √i
3 √3 3
0 √1 (1 − i) 2 √1 (1 + i)
2 2
1
U2 U1 U = 2 1
√ i
q
2 1
√ i
0 √
2
( 3 + 3) − 3 √ √
2
( 3 − 3 )√
1 −i −1 i
√3 1
2
0 0 2
0 1 0 0
U3 =
0 0 1 0√
1
2
0 0 − 23
2 0 0 0
√
0 √1 (1 − i) 2 √1 (1 + i)
2 2
U3 U2 U1 U = 12
1
√ i
q
2 1
√
i
0 √
2
( 3 + 3) − 3√ √
2
( 3 − 3 )
√
2 2
0 i √3 √
3
−i √23
1 √
0 √ √
0 0
3 3 i
0
√ 4√(1 + i) 4 √
( 3 − √3 ) 0
U4 =
3 i
0 4 ( 3 + √3 ) − 4 (1 − i) 0 3
0 0 0 1
1 q0 0 0
2
0
3
i √16 √1
6
U4 U3 U2 U1 U =
0 0 √1 1
√ i
2 2
0 √13 i √13 − √13 i
1 q0 0 0
2
0 0 − √13 i
3
U5 = 0 0 1
0
q
0 √13 i 0 − 23
1 0 0 0
0 1 0 0
U5 U4 U3 U2 U1 U = 0 0 √2 i √12 1
0 0 − √12 i √12
12
1 0 0 0
0 1 0 0
U6 = 0 0 √12 − √12
0 0 −i √12 −i √12
U6 U5 U4 U3 U2 U1 U = I
Therefore, U = U1† U2† U3† U4† U5† U6† .
Exercise 4.38
Exercise 4.39
U acts non-trivially on |010⟩ and |111⟩. Hence, from considering the Gray code |010⟩ →
|011⟩ → |111⟩, we read off the circuit to be,
Ũ
Exercise 4.40
−iβ n̂.σ/2
E(Rn̂ (α), Rn̂ (α+β)) = E(Rn̂ (α), Rn̂ (β)R q n̂ (α)) = ||(1−Rn̂ (β))Rq
n̂ (α) |ψ⟩ || = ||(1−e ) |ψ⟩ || =
p β β
iβ n̂.σ/2 −iβ n̂.σ/2 iβ/2
⟨ψ| (2 − (e +e )) |ψ⟩ = ⟨ψ| (2 − 2 cos 2 ) |ψ⟩ = 2 − 2 cos 2 = |1 − e |
For a small β such that α + β + mθ = nθ for m < n we have,
E(Rn̂ (α), Rn̂ (θ)n ) = E(Rn̂ (α), Rn̂ (α)Rn̂ (β)Rn̂ (θ)m ) = E(I, Rn̂ (β)Rn̂ (θ)m ) ≤ E(I, Rn̂ (β)) +
mE(I, Rn̂ (θ)m ) = |1 − eiβ/2 | + m|1 − eiθ/2 |
As |β|, |θ| < δ we have that |1 − eiβ/2 | + m|1 − eiθ/2 | < 3ϵ , hence E(Rn̂ (α), Rn̂ (θ)n ) < 3ϵ .
Exercise 4.41
For an initial state |00ψ⟩ the circuit performs the following,
H H2 1 Toffoli S
|00ψ⟩ −−1−→ 2
(|00⟩ + |01⟩ + |10⟩ + |11⟩) |ψ⟩ −−−→ 12 (|00ψ⟩ + |01ψ⟩ + |10ψ⟩ + |11(Xψ)⟩) −
→
1 Toffoli
2
(|00(Sψ)⟩ + |01(Sψ)⟩ + |10(Sψ)⟩ + |11(SXψ)⟩) −−−→ 12 (|00(Sψ)⟩ + |01(Sψ)⟩ + |10(Sψ)⟩ +
H H2 1
|11(XSXψ)⟩) −−1−→ 4
((|0⟩+|1⟩)(|0⟩+|1⟩)+(|0⟩+|1⟩)(|0⟩−|1⟩)+(|0⟩−|1⟩)(|0⟩+|1⟩)) |Sψ⟩+
1
4
(|0⟩ − |1⟩)(|0⟩ − |1⟩) |XSXψ⟩ = 14 (|00⟩ (3S + XSX) |ψ⟩ + (|01⟩ + |10⟩)(S − XSX) |ψ⟩ +
|11⟩ (XSX − S) |ψ⟩) = 41 (|00⟩ (3S + XSX) |ψ⟩ + (|01⟩ + |10⟩ − |11⟩)(S − XSX) |ψ⟩)
1
If both measurements give 0 then 4 (3S
+ XSX) is applied to |ψ⟩.
iπ/4 −i arctan 3
√
1 1 3+i 0 1 i(1 − 3i) 0 10 iπ/4 e e 0
(3S+XSX) = 4 =4 = 4 e =
4 0 1 + 3i 0 1 + 3i 0 e−iπ/4 ei arctan 3
√
10 π/4
4
e RZ (θ),
as cos 2θ cos(arctan 3 − π4 ) = √25 , hence cos θ = 2 cos2 2θ − 1 = 35 .
Otherwise, Z is applied, as
1−i 0 −iπ/4 1 0
S − XSX = =e
0 i−1 0 −1
√ iπ/4
1
The final state is 4 ( 10e |00(RZ (θ)ψ)⟩ + e−iπ/4 (|01⟩ + |10⟩ − |11⟩)Z |ψ⟩).
√ iπ/4
Therefore, p(|00⟩) = 10e4 = 85 .
If anything other then |00⟩ is measured we apply a −Z gate if the measurement is |11⟩ and
Z gate otherwise to the last qubit and afterwards apply the circuit again. Then for the
13
overall circuit,
X 3 n−1 5
p(RZ (θ)) = lim =1
n→+∞
n
8 8
Exercise 4.42
1)As θ is rational ∃m such that mθ = 2πn, hence raising both sides to the power of this m
we have, m
ei2πn = (3+4i)
5m
m
1 = (3+4i)
5m
(3 + 4i)m = 5m
2)3 + 4i = 3 + 4i mod 5
(3 + 4i)2 = −7 + 24i = 3 + 4i mod 5
Let us show that if for some a and n we have a = a mod n and a2 = a mod n then am = a
mod n. For a3 we have a3 = aa2 = anq1 + a2 = n(aq1 + q2 ) + a = a mod n. Assume true
for m − 1. Then am = aam−1 = anq1 + a2 = n(aq1 + q2 ) + a = a mod n, hence by induction
it’s true for all m ∈ N. Therefore, we have that, (3 + 4i)m = 3 + 4i mod 5. Hence, (3 + 4i)m
is not a multiple of 5, therefore ∄m ∈ N such that, (3 + 4i)m = 5m .
Exercise 4.43
The circuit shown in Exercise 4.41 implements an RZ (θ) gate with an irrational θ as shown
in Exercise 4.42. HRZ (θ)H = RX (θ), hence we can convert between Rn̂ (θ) and RZ (θ) as in
Exercise 4.6 by only using Hadamard, phase and Toffoli gates. Hence, in accordance with
equation 4.76 we have E(RZ (α), RZ (θ)n ) = E(Rn̂ (α), Rn̂ (θ)n ) < 3ϵ . Therefore, Hadamard,
phase, CNOT and Toffoli gates are universal for quantum computation.
Exercise 4.44
Exercise 4.45
Exercise 4.46
ρ is a complex 2n x2n hermitian matrix with trace 1. There are 2 ∗ 22n real components.
The diagonal has to be real so we get 2 ∗ 22n − 2n . As the matrix is hermitian only half
of the components other then the diagonal elements are independent, hence the number of
2n n
components is 2 ∗ 22n − 2n − (2 ∗ 2 2−2 ) = 4n . The trace being 1 fixes one of the diagonal
elements, hence the number of independent real components is 4n − 1.
Exercise 4.47
If [A, B] = 0
∞ ∞ X n n−k k ∞ X n ∞ X ∞
A+B
X (A + B)n X n A B X An−k B k X An−k B k
e = = = = =
n=0
n! n=0 k=0
k n! n=0 k=0
(n − k)!k! k=0 n=k
(n − k)!k!
∞ X ∞
X An−k B k
= eA eB
k=0 n−k=0
(n − k)!k!
Hence, applying this to e−iHt we get the desired result.
14
Exercise 4.48
n
X n n n! n(n − 1) . . . (n − c + 1)
L≤ <c =c =c = O(nc )
i=0
i c (n − c)!c! c!
Exercise 4.49
e(A+B)∆t = 1 + (A + B)∆t + 21 (A + B)2 ∆t2 + O(∆t3 ) = 1 + (A + B)∆t + 21 (A2 + B 2 + AB +
BA)∆t2 + O(∆t3 ) = 1 + (A + B)∆t + 12 (A2 + B 2 + 2AB − (AB − BA))∆t2 + O(∆t3 ) =
1 2
eA∆t eB∆t e− 2 [A,B]∆t + O(∆t3 )
ei(A+B)∆t = 1 + i(A + B)∆t + O(∆t2 ) = eiA∆t eiB∆t + O(∆t2 )
ei(A+B)∆t = 1 + i(A + B)∆t − 12 (A2 + B 2 + AB + BA)∆t2 + O(∆t3 ) = 1 + i( 21 A + B + 21 A)∆t −
( 14 A2 + 21 B 2 + 14 AB + 14 BA)∆t2 + O(∆t3 ) = eiA∆t/2 eiB∆t eA∆t/2 + O(∆t3 )
Exercise 4.50
a)From repeated use of 4.104 we have,
U∆t = [e−iH1 ∆t . . . e−iHL ∆t ][e−iHL ∆t . . . e−iH1 ∆t ] = [e−iH1 ∆t . . . e−iHL−1 ∆t ]e−i2HL ∆t [e−iHL−1 ∆t . . . e−iH1 ∆t ] =
[e−iH1 ∆t . . . e−iHL−2 ∆t ]e−i2(HL−1 +HL )∆t [e−iHL−2 ∆t . . . e−iH1 ∆t ] + O(∆t3 ) = e−i2H∆t + O(∆t3 )
b)E(U∆t m
, e−2miH∆t ) ≤ mE(U∆t , e−2iH∆t ) = m||(U∆t − e−2iH∆t ) |ψ⟩ || = m||O(∆t3 ) |ψ⟩ || =
3
mα∆t
Exercise 4.51
HXH = Z and RX (− π2 )Y = Z, hence the circuit is
H H
RX (− π2 ) RX ( π2 )
|0⟩ e−i∆tZ
15