0
$\begingroup$

In section 2.3 of the Qiskit textbook (Phase Kickback), there's an example where a controlled-T gate is applied to $|1+\rangle$.

You're asked to attempt the same thing with $|0+\rangle$. I've done this by means of statevectors and successfully got the correct answer (that it has no effect): $$\text{Controlled-T}|0+\rangle$$ $$=\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & e^{\frac{i\pi}{4}} \end{pmatrix}\times\frac{1}{\sqrt{2}} \begin{pmatrix}1\\1\\0\\0\\\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\\0\\0\\\end{pmatrix}$$

The textbook's example (using $|1+\rangle$) performs the calculation in Dirac representation - i.e. by factoring out the individual qubits. I decided to try the same thing with the above. Here's what I got: $$|0+\rangle = |0\rangle \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$ $$=\frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$$

$$\text{Controlled-T}|0+\rangle =\frac{1}{\sqrt{2}}(|00\rangle + e^{\frac{i\pi}{4}}|01\rangle)$$ $$=|0\rangle \otimes\frac{1}{\sqrt{2}}(|0\rangle + e^{\frac{i\pi}{4}}|1\rangle)$$ When I then multiply that out to get the statevector, I get: $$\frac{1}{\sqrt(2)}\begin{pmatrix}1\\e^{\frac{i\pi}{4}}\\0\\0\\\end{pmatrix}$$ which is clearly different. What am I doing wrong with the algebraic approach?

$\endgroup$
2
$\begingroup$

$\textrm{Controlled-T} = |0\rangle\langle 0| \otimes I + |1\rangle\langle1| \otimes T$

Thus, if you apply this to the state $|\psi \rangle = |0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg)$ you have:

\begin{align} \textrm{Controlled-T} |\psi\rangle &= \bigg[|0\rangle\langle 0| \otimes I + |1\rangle\langle1| \otimes T \bigg] |0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg) \\ &= \bigg[ |0\rangle\langle 0| \otimes I \bigg]|0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg) + \bigg[ |1\rangle\langle1| \otimes T \bigg]|0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg) \\ &= |0\rangle \bigg( \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg) + 0 = |\psi\rangle \end{align}

Thus nothing changed.

$\endgroup$
2
  • $\begingroup$ Could you maybe explain why the second term becomes $0$ ? I am definitely missing something here ! $\endgroup$ Feb 23 at 21:12
  • 1
    $\begingroup$ $(|1\rangle \langle 1|)|0\rangle = \vec{0} $. I should have wrote my $0$ with a vector notation earlier. $\endgroup$
    – KAJ226
    Feb 23 at 22:13
2
$\begingroup$

Controlled-T gate has no effect on the $|01\rangle$ state (the control qubit is in $|0\rangle$ state), rather than add a phase to it.

$\endgroup$
3
  • $\begingroup$ While I understand that in principle, it doesn't seem to work with the example in the textbook. They factored out Controlled-T|1+⟩. The steps they used were as follows: $$|1+\rangle=\frac{1}{\sqrt{2}}(|10\rangle+|11\rangle$$ $$Controlled-T|1+\rangle=\frac{1}{\sqrt{2}}(|10\rangle+e^{\frac{i\pi}{4}}|11\rangle)$$ $$=|1\rangle\otimes\frac{1}{\sqrt{2}}(|0\rangle+e^{\frac{i\pi}{4}}|1\rangle)$$ This only makes sense to me if the textbook is using the second qubit as the control, so I was following that pattern. What did I miss? $\endgroup$ Feb 24 at 7:36
  • 1
    $\begingroup$ The first qubit is actually the control; the |10⟩ term didn't change because T gate has no effect on the |0⟩ state, so it's applied in the controlled variant but doesn't have effect. $\endgroup$ Feb 24 at 8:26
  • $\begingroup$ Right - thank you. This makes a lot more sense now. I'd normally seen the first qubit as the control, but I couldn't understand why the T gate had just been dropped from the $|10\rangle$ state. Upvoted. $\endgroup$ Feb 24 at 8:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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