2
$\begingroup$

Using the gates ${CNOT, H, T}$, construct a 2-qubit gate that acts as follows on the computational basis

$ |0⟩⊗|0⟩ = |0⟩⊗|0⟩ $

$ |0⟩⊗|1⟩ = e^{pi*i/4}|0⟩⊗|1⟩ $

$ |1⟩⊗|0⟩ = e^{pi*i/4}|1⟩⊗|0⟩ $

$ |1⟩⊗|1⟩ = |1⟩⊗|1⟩ $

I'm not sure how to solve this - I'm sure that if someone shows me the solution (ie the actual circuit) I'd understand it, but I really want to know how to generally come up with solutions to problems where we're meant to create circuits as well(I've been using trial and error so far).

Some observations about this problem (which may or may not be helpful):

  • The last qubit is always unchanged (equivalent to passing it through a CNOT with $|0⟩$ as the first input qubit).

  • We definitely need to use the $T$ gate for the terms which have $e^{pi*i/4}$

$\endgroup$

1 Answer 1

3
$\begingroup$

The $T$ gate applies a phase of $e^{\pi i / 4}$ to $|1\rangle$, i.e., it has the following effect: $T(\alpha|0\rangle + \beta|1\rangle) = \alpha|0\rangle + e^{\pi i / 4}\beta|1\rangle$. We want this effect to be applied when one of the qubits is in $|1\rangle$, but not both. Therefore, we need a way to distinction these two states.

We can use the $\mathrm{CNOT}$ gate to differentiate these two states from the rest. To do this, apply a $\mathrm{CNOT}$ gate with the first qubit as control and the second as target. This will leave $|00\rangle$ and $|01\rangle$ unaffected, $|10\rangle$ turns into $|11\rangle$ and $|11\rangle$ into $|10\rangle$. In other words, it will set the second qubit to $|1\rangle$ if and only if one qubit but not both were in the $|1\rangle$ state.

The states we want to apply the $\pi / 4$ phase to are now mapped to the states with $|1\rangle$ in the second qubit. Thus, we can apply the $T$ gate to the second qubit, changing $|01\rangle$ into $e^{\pi i / 4}|01\rangle$ and $|11\rangle$ into $e^{\pi i / 4}|11\rangle$.

Now we only have to map back to our original states, which can be easily done with a $\mathrm{CNOT}$ gate just as the first one.

Put into a Qiskit circuit, this look as follows.

from qiskit import QuantumCircuit
from qiskit.quantum_info import Operator

qc = QuantumCircuit(2)

qc.cx(0, 1)
qc.t(1)
qc.cx(0, 1)

print(qc)
print(np.round(Operator(qc).data, 5))

Which gives the circuit and unitary:

q_0: ──■─────────■──
     ┌─┴─┐┌───┐┌─┴─┐
q_1: ┤ X ├┤ T ├┤ X ├
     └───┘└───┘└───┘
[[1.     +0.j      0.     +0.j      0.     +0.j      0.     +0.j     ]
 [0.     +0.j      0.70711+0.70711j 0.     +0.j      0.     +0.j     ]
 [0.     +0.j      0.     +0.j      0.70711+0.70711j 0.     +0.j     ]
 [0.     +0.j      0.     +0.j      0.     +0.j      1.     +0.j     ]]
$\endgroup$
2
  • $\begingroup$ Why do we apply $T$ to the second qubit? We need $|0⟩⊗|1⟩=e^{pi∗i/4}|0⟩⊗|1⟩$ where the $e^{pi*I/4}$ term is on the first qubit not the second $\endgroup$ Apr 29, 2022 at 6:53
  • 1
    $\begingroup$ @SVMteamsTool $e^{\pi i / 4}$ is a global phase in $e^{\pi i / 4} |01\rangle$, meaning that $e^{\pi i / 4} |0\rangle \otimes |1\rangle = |0\rangle \otimes e^{\pi i / 4} |1\rangle$. Try writing both states as vectors to see they are equivalent. $\endgroup$
    – epelaez
    Apr 29, 2022 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.