Solutions 2
Solutions 2
a) If A and B are two single qubit gates, prove the following relations: [I is the 2 × 2 identity
matrix and ◦ denotes matrix multiplication. All other symbols carry their usual meanings]
(This problem uses concepts discussed in slides 9 − 11, Week 2 Session 1-2.)
i. (A ⊗ I) ◦ (I ⊗ B) = (A ⊗ B)
Solution: The aim of this problem is to prove the distributive property of the tensor
product. Let the action of the A and B on the single-qubit standard basis given by the
following relations:
The proof can be proven by showing that the action of the operators (A ⊗ I) ◦ (I ⊗ B)
and (A ⊗ B) on the two-qubit basis is the same:
Let us first consider the action of the two operators on the basis element |00⟩
and
Similarly, the equality can be proven for all other basis elements and this completes the
proof.
1
−1
ii. (A ◦ B) = B † ◦ A†
Solution: The proof of this question is based on the fact that A and B are single qubit
gates and are therefore unitary transformations.
Therefore, from the definition of matrix inverse:
−1
(A ◦ B) (A ◦ B) = I
B † ◦ A† (A ◦ B) = B † ◦ A† A ◦ B
= B † ◦ B ∵ A is unitary
= I ∵ B is unitary
b) Let U be a single qubit gate with actions on the standard basis given as follows:
U |0⟩ = |a⟩
U |1⟩ = |b⟩
|q0 ⟩
|ψ⟩
|q1 ⟩ V V†
Solution: Since the circuit uses a CX gate, it may be worthwhile examining the effect of the
circuit in the cases, |q0 ⟩ = |0⟩ and |q0 ⟩ = |1⟩.
The matrix corresponding to the given circuit is given by:
M = I ⊗ V † ◦ CX ◦ (I ⊗ V )
(The method for this has been discussed in slides 11 − 13, Week 2 Session 2-3.)
2
When the qubit q0 is in |0⟩, the action of the above circuit is given by:
= |0⟩ ⊗ V † V |q1 ⟩
= |0⟩ ⊗ |q1 ⟩ , V is unitary.
When the qubit q0 is in |1⟩, the X gate is applied to second qubit. Therefore, the action of
the above circuit is given by:
= I ⊗ V † |1⟩ ⊗ XV |q1 ⟩
= |1⟩ ⊗ V † XV |q1 ⟩
= |1⟩ ⊗ U |q1 ⟩ , from the definition of V .
Therefore, the action of the circuit on the two-qubit standard basis is given by;
M
{|00⟩ , |01⟩ , |10⟩ , |11⟩} −→ {|00⟩ , |01⟩ , |1⟩ ⊗ |a⟩ , |1⟩ ⊗ |b⟩}
c) Show that there exists no pair of single qubit gates, A, B that satisfy the following relation:
A ⊗ B = CNOT01
Solution: Assuming that it is possible to write CNOT01 in the form A ⊗ B. Where A and B
are single qubit gates given by the matrices:
A00 A01 B00 B01
A= B=
A10 A11 B10 B11
B00 B01 B B01
A00 B10 A01 00
B11 B
10 B11
A⊗B =
B B01 B B01
A10 00 A11 00
B10 B11 B10 B11
1 0 0 0
0 1 0 0
=
0 0 0
1
0 0 1 0
This further implies that the following relations are true:
3
B00 B01 1 0 B00 B01 0 1
A00 = A11 =
B10 B11 0 1 B10 B11 1 0
⇒ A00 B01 = A00 B10 = 0 ⇒ A11 B01 = A00 B10 = 1
⇒ A00 B00 = A00 B11 = 1 ⇒ A11 B00 = A00 B11 = 0
∴ B01 = B10 = 0 ∴ B01 = B10 ̸= 0
and B00 = B11 ̸= 0 and B00 = B11 = 0
d) If a two-qubit gate has the following action on the two-qubit standard basis:
U |00⟩ = |v0 ⟩
U |01⟩ = |v1 ⟩
U |10⟩ = |v2 ⟩
U |11⟩ = |v3 ⟩
i. Prove the following relation:
Solution: This relation can be verified by multiplying the left hand side of the above
equation with elements of the two-qubit standard basis. As an example, the product
with |00⟩ is shown.
(|v0 ⟩⟨00| + |v1 ⟩⟨01| + |v2 ⟩⟨10| + |v3 ⟩⟨11|) |00⟩ = |v0 ⟩ ⟨00|00⟩ + |v1 ⟩ ⟨01|00⟩
+ |v2 ⟩ ⟨10|00⟩ + |v3 ⟩ ⟨11|00⟩
= |v0 ⟩
The other terms vanish because of the orthonormality of the two-qubit standard basis.
working out the expression for the other elements of the basis will complete the proof.
ii. Using the above relation, find the matrix form of CNOT10 .
Solution: The action of CNOT10 on the two-qubit standard basis is given as:
4
The operator form of CNOT10 is given by:
CNOT10 = |00⟩⟨00| + |11⟩⟨01| + |10⟩⟨10| + |01⟩⟨11|
if one were to try to expand this to the matrix form, we get the following result.
1 0 0 0
0 0 0 1
CNOT10 =
0 0 1 0
0 1 0 0
i. F (x0 , x1 ) = x0 ⊕ x1
Solution: This is a two variable function. Therefore the bit oracle requires a 3-qubit
operation and is represented by the following circuit:
|x0 ⟩ |x0 ⟩
|x1 ⟩ |x0 ⟩
|0⟩ |(x0 ⊕ x1 )⟩
|x0 ⟩
(This is also explained in the python notebook titled, “2.Boolean function oracles.ipynb”.)
ii. F (x0 , x1 ) = x0 ∨ x1
Solution: This is a two variable function. Therefore the bit oracle requires a 3-qubit
operation. It will also be of benefit to represent the OR gate in terms of the AND gate.
x0 ∨ x1 = x0 ∧ x1
This is due to the De Morgan’s law.
The bit oracle of the AND gate can be represented by a single Toffoli (CCX) gate.
Additionally, the negation of the bit value stored in any qubit can be performed using
the Pauli X gate.
Therefore, the circuit for this function is as shown below:
5
|x0 x1 ⟩ |x0 x1 ⟩
|x0 ⟩ X X |x0 ⟩
|x1 ⟩ X X |x0 ⟩
(x0 ∧ x1 )
|0⟩ X
= |(x0 ∨ x1 )⟩
|(x0 ∧ x1 )⟩
iii. F (x) = x
Solution: It should be remembered that what is required for this question is a bit oracle,
which will be a two-qubit circuit. This circuit will be given by:
|x⟩
|x⟩ X X |x⟩
|0⟩ |x⟩
b) Prove the following statements for a n-bit Boolean function bit oracle: [‘+’ denotes the XOR
operation]
i. The bit oracle causes entanglement between the input qubits, |x⟩ and the target qubit,
|y⟩.
Solution: To prove this statement, we can consider two distinct input values x1 and
x2 for the Boolean function such that:
F (x1 ) ̸= F (x2 )
The action of the the bit-oracle UF on the state, |x1 ⟩ + |x2 ⟩ is given by:
6
In the above expression, normalization has been temporarily disregarded. Now since
it is known that x1 ̸= x2 and F (x1 ) ̸= F (x2 ). It is impossible to separate the target
qubit from the n-qubit input states. This implies that there is entanglement between the
input qubits and the target qubit. The following statement is a property of all Boolean
function oracles.
“As long as the Boolean function F (x) is not constant the quantum bit oracle UF
causes entanglement between the input and the output qubits.”
(This was also discussed in slides 11 − 12, Week 3 Session 2-3.)
ii. UF† = UF
Solution: The proof of this statement involves applying the bit oracle of the Boolean
function twice. This is done as shown below:
UF F U
|x⟩ |y⟩ −−−
→ |x⟩ |y + F (x)⟩ −−−
→ |x⟩ |y + F (x) + F (x)⟩
Using the property of the XOR gate, y + y = 0, the resultant state of of the above
equation can be written as:
This implies that applying the Boolean function bit oracle, UF twice is the same as
applying the identity gate (or no gate). This implies that:
UF−1 = UF
and since, UF is also unitary (as it is a quantum gate), UF−1 = UF† , this when used with
the previous result proves the statement.
UF† = UF