0% found this document useful (0 votes)
166 views7 pages

Solutions 2

This document provides solutions to problems from an introduction to quantum computing course. Problem 1 involves proofs regarding tensor products and transformations on multi-qubit systems. Problem 2 involves analyzing the action of circuits on qubit states. Problem 3 shows there is no pair of single qubit gates that can represent the CNOT gate. Problem 4 involves representing a two-qubit gate as a matrix and finding the matrix form of the CNOT gate.

Uploaded by

Neerav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
166 views7 pages

Solutions 2

This document provides solutions to problems from an introduction to quantum computing course. Problem 1 involves proofs regarding tensor products and transformations on multi-qubit systems. Problem 2 involves analyzing the action of circuits on qubit states. Problem 3 shows there is no pair of single qubit gates that can represent the CNOT gate. Problem 4 involves representing a two-qubit gate as a matrix and finding the matrix form of the CNOT gate.

Uploaded by

Neerav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Solutions to problem Set - 2

Introduction to quantum computing using QSim

Problem 1: Multi-qubit transformations


The following questions are based on the properties of the Kronecker (Tensor) product and trans-
formations on multi-qubit systems.

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:

A |0⟩ = |a0 ⟩ B |0⟩ = |b0 ⟩


A |1⟩ = |a1 ⟩ B |1⟩ = |b1 ⟩

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⟩

(A ⊗ I) ◦ (I ⊗ B) |00⟩ = (A ⊗ I) ◦ (I |0⟩ ⊗ B |0⟩)


= (A ⊗ I)(|0⟩ ⊗ |b0 ⟩)
= A |0⟩ ⊗ I |b0 ⟩
∴ (A ⊗ I) ◦ (I ⊗ B) |00⟩ = |a0 ⟩ ⊗ |b0 ⟩

and

(A ⊗ B) |00⟩ = (A |0⟩ ⊗ B |0⟩)


= |a0 ⟩ ⊗ |b0 ⟩

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

Now, considering the product of the operators:

B † ◦ A† (A ◦ B) = B † ◦ A† A ◦ B
  

= B † ◦ B ∵ A is unitary


= I ∵ B is unitary

Therefore, B † ◦ A† is the inverse of A ◦ B and the proof is complete.

b) Let U be a single qubit gate with actions on the standard basis given as follows:

U |0⟩ = |a⟩
U |1⟩ = |b⟩

Given V be a single qubit gate related to U through the following relation: V † XV = U


Find the action of the following circuit (i.e. find |ψ⟩), on the two-qubit computational basis
{|00⟩ , |01⟩ , |10⟩ , |11⟩}.
(There was an error in the circuit diagram for this question, the correct figure is given below:.)

|q0 ⟩
|ψ⟩
|q1 ⟩ V V†

Figure 1: Circuit diagram for Problem 1 b).

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:

I ⊗ V † ◦ CX ◦ (I ⊗ V ) |0⟩ ⊗ |q1 ⟩ = I ⊗ V † ◦ CX |0⟩ ⊗ V |q1 ⟩


 

= I ⊗ V † |0⟩ ⊗ V |q1 ⟩ , the control qubit is set to |0⟩




= |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 † ◦ CX ◦ (I ⊗ V ) |1⟩ ⊗ |q1 ⟩ = I ⊗ V † ◦ CX |1⟩ ⊗ V |q1 ⟩


 

= 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⟩}

The above circuit is therefore a representation of the controlled U gate.

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

Therefore the expansion of CNOT01 may be expressed as:

    
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

The above results are a contradiction, therefore it is impossible to express CNOT01 as A ⊗ B.

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:

|v0 ⟩⟨00| + |v1 ⟩⟨01| + |v2 ⟩⟨10| + |v3 ⟩⟨11| = U

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:

CNOT10 |00⟩ = |00⟩


CNOT10 |01⟩ = |11⟩
CNOT10 |10⟩ = |10⟩
CNOT10 |11⟩ = |01⟩

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

Problem 2: Boolean functions and quantum gates


The following questions are based on quantum implementations of Boolean functions.
a) Find the quantum circuits (bit oracles) for the following Boolean functions: [⊕ - XOR, ∨ -
OR, - NOT]

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 ⟩

Figure 2: Circuit diagram for Problem 2 a) i.

(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 )⟩

Figure 3: Circuit diagram for Problem 2 a) ii.

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⟩

Figure 4: Circuit diagram for Problem 2 a) iii.

b) Prove the following statements for a n-bit Boolean function bit oracle: [‘+’ denotes the XOR
operation]

UF |x⟩ |y⟩ → |x⟩ |F (x) + y⟩


n-qubit 1-qubit

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:

UF (|x1 ⟩ + |x2 ⟩) |0⟩ = |x1 ⟩ |F (x1 )⟩ + |x2 ⟩ |F (x2 )⟩

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:

|x⟩ |y + F (x) + F (x)⟩ = |x⟩ |y + 0⟩ = |x⟩ |y⟩

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

You might also like