Starting from an unknown state $α|00⟩ + β|11⟩$, where $\alpha,\beta$ are properly normalized, how can I create a circuit that transforms that state to a $\frac{1}{\sqrt{2}} (β|00⟩-α|01⟩+β|10⟩+α|11⟩)$ state?
2 Answers
Note that the output state can be written as,
$\frac{1}{\sqrt{2}}(\beta|00\rangle - \alpha|01\rangle + \beta|10\rangle + \alpha|11\rangle)$
= $\frac{1}{\sqrt{2}}(\beta(|00\rangle + |10\rangle) - \alpha(|01\rangle - |11\rangle))$
= $\frac{1}{\sqrt{2}}(\beta(|0\rangle + |1\rangle)|0\rangle - \alpha(|0\rangle - |1\rangle)|1\rangle)$
= $\beta|+\rangle|0\rangle - \alpha|-\rangle|1\rangle$
= $\beta(H|0\rangle)|0\rangle - \alpha(H|1\rangle)|1\rangle$
Where $|+\rangle$ and $|-\rangle$ are the two orthogonal x-basis states: $$|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = H|0\rangle$$ $$|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = H|1\rangle$$ And $H$ is the Hadamard gate.
To create the circuit first note that in the final state $\alpha$ is amplitude of the state $|11\rangle$ instead of $|00\rangle$. The opposite happens with $\beta$. It is a bit-flip operation. So, we need to apply $X$-gate to both qubits. The resulting state will be $$\beta|00\rangle + \alpha|11\rangle$$ Then we need to change the sign of the $|11\rangle$ state. It is a phase-flip operation. So, we need to apply $Z$-gate to any one of the qubits. Now we have, $$\beta|00\rangle - \alpha|11\rangle$$ Finally, we need to apply $H$-gate to the second qubit.
-
$\begingroup$ Thank you @Egretta-Thula for the answer. I don't understand what happened on line 4 of the answer. $\endgroup$– HamidehCommented Apr 5, 2022 at 12:24
-
1$\begingroup$ @Hamideh, it is just a simple replacement. I updated my answer to be more clear. If you need any further clarification please let me know. $\endgroup$ Commented Apr 5, 2022 at 13:00
-
$\begingroup$ I don't know about the circuit yet. It seems to me that I need an H, a swap and a z gate? Can you please help me with inferring the gates? $\endgroup$– HamidehCommented Apr 16, 2022 at 1:33
-
1$\begingroup$ Now my answer contains the circuit. $\endgroup$ Commented Apr 16, 2022 at 10:27
-
1$\begingroup$ I assumed little-endian notation which means that if the state is $|01\rangle$ then the first qubit is $|1\rangle$ and the second qubit is $|0\rangle$ $\endgroup$ Commented Apr 16, 2022 at 13:11
Since the circuit U
is linear (as always) you can investigate its action to each input independently:
$$ \begin{align} U\bigl(\alpha|00\rangle + \beta|11\rangle\bigr) &= \alpha U|00\rangle + \beta U|11\rangle\\ &=\alpha\frac1{\sqrt{2}}\bigl(-|01\rangle +|11\rangle\bigr) + \beta\frac1{\sqrt{2}}\bigl(|00\rangle + |10\rangle\bigr) \end{align} $$
You, therefore, need a circuit that acts as:
$$ \begin{align} U|00\rangle &= \frac1{\sqrt{2}}\bigl(-|01\rangle + |11\rangle\bigr) \\ U|11\rangle &= \frac1{\sqrt{2}}\bigl(|00\rangle + |10\rangle\bigr) \end{align} $$
It is obvious that there is no one unique circuit that achieves this since you don't know its action on $|01\rangle$ and $|10\rangle$.
Next you can check if the right hand side contains entangled qubits or not so that you know if you need entangling (two-qubit) gates or not. Obviously, they are not entangled:
$$ \begin{align} -|01\rangle +|11\rangle &= -\bigr(|0\rangle -|1\rangle\bigl)|1\rangle = -\bigr(H|1\rangle\bigl)|1\rangle\\ |00\rangle +|10\rangle &= \bigr(|0\rangle +|1\rangle\bigl)|0\rangle = \bigr(H|0\rangle\bigl)|0\rangle\\ \end{align} $$
Therefore, the action of $U$ is:
$$ \begin{align} U|00\rangle &= \frac1{\sqrt{2}}\bigl(-|01\rangle + |11\rangle\bigr) \\ &= -HI|11\rangle \\ &= HZ|11\rangle \\ &= (HZ)(XX)|00\rangle \end{align} $$
and
$$ \begin{align} U|11\rangle &= \frac1{\sqrt{2}}\bigl(|00\rangle + |10\rangle\bigr) \\ &= HI|00\rangle\\ &= (HI)(XX)|11\rangle \\ &= (HZ)(XX)|11\rangle \end{align} $$
where in the last step we replaced $I$ with $Z$ since it has no effect on the state $|00\rangle$.
So one possible circuit that transforms your input state to the desired output state is a circuit with two $X$ gates followed by a $H$ gate on one qubit and a $Z$ gate on the other.