2
$\begingroup$

$ \newcommand{\ket}[1]{|#1\rangle} \newcommand{\tens}[1]{% \mathbin{\mathop{\otimes}\limits_{#1}} }$I'm trying to self-learn quantum information basics by reading Dancing with Qubits by Robert Sutor.

On page 334 for the state of $U_f$ (which flips the sign of the desired state) at different steps.

Just to include the details: $U_f$ applies $S, H, CX, H$, and $S$ to the second qubit, $q_1$.

Starting from the initial state, we have two qubits, and we apply to each of them a Hadamard gate and the state is now: $\frac{1}{2}(\ket{00} + \ket{01} + \ket{10} + \ket{11}$.

Then we apply to the second qubit the $S$ gate (the first step in $U_f$), which I think is $(\frac{\sqrt{2}}{2}(\ket{0} + \ket{1})) \tens{} S(\frac{\sqrt{2}}{2}(\ket{0} + \ket{1})) = (\frac{1}{2}(\ket{0} + \ket{1})\tens{} (\ket{0} + i\ket{1}) = 1/2(\ket{00}+ i\ket{01} + \ket{10}+ i\ket{11})$ this is consistent with the result in the textbook.

And then I put the $H^{\tens{}^2}$ and $S$ for the second qubit in the IBM quantum composer, the result on the Q-sphere for $\ket{00}, \ket{01}$ is at a phase angle of $0$, while for $\ket{10}, \ket{11}$ is at a phase angle of $\frac{\pi}{2}$. and the output state is [ 0.5+0j, 0.5+0j, 0+0.5j, 0+0.5j ].

I was wondering what is the reason for this inconsistency in the textbook and the IBM quantum composer.

Thank you in advance!

$\endgroup$
3
  • 1
    $\begingroup$ +1 and welcome to our new community! We hope to see much more of you in the future!! I've adjusted the $\newcommand{\ket}[1]{|#1\rangle}$ $\newcommand{\tens}[1]{% \mathbin{\mathop{\otimes}\limits_{#1}}% }$ because it was causing an indentation on the first line of text. Now is also not ideal since it creates extra unnecessary whitespace, but at least it doesn't look so weird. If only we could do \vspace{-10mm} at the end. $\endgroup$ Aug 25 at 2:11
  • $\begingroup$ @user1271772 you can fix that by simply using inline equations (i.e. single dollar signs) $\endgroup$
    – glS
    Aug 25 at 10:59
  • $\begingroup$ That's what it was before. The difference that ended up working was not "simply" using single dollar signs but also in addition removing the newline. $\endgroup$ Aug 25 at 15:55
1
$\begingroup$

The state you obtain is the following one: $$\frac12\left(|00\rangle+|01\rangle+i|10\rangle+i|11\rangle\right)$$ instead of: $$\frac12\left(|00\rangle+i|01\rangle+|10\rangle+i|11\rangle\right)$$ You can see that the difference between these two states is the fact the the $\frac\pi2$ phase (that is, the $i$ factor) is placed on the states that have their first qubit set to $1$ instead of their second one. This is due to the fact that Qiskit uses little-endian ordering for the qubits, contrarily to most textbooks (in particular, contrarily to Robert Sutor's one).

What this means is that you must read the qubits from bottom to top to read the state. Thus, when you want to apply the $S$ gate to the second qubit, you have to do it on the first wire of the composer, which will give you the right result.

All in all, it is supposed to look like this on the IBM Quantum composer:

Correct composer layout

which will give you the expected state:

Correct QSphere

$\endgroup$

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.