Given a 2-qubits system, the 4 computational basis states are $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$.

Is it possible to prepare these states by a one-parameter quantum circuit "ansatz" $U(\theta)$ passing 4 distinct continuous values of $\theta \in \mathbb{R}$?

If yes, how does this parametric circuit look like and what is the process to build it?

  • 2
    $\begingroup$ This is very similar to a problem posted in the QHack 2023. I think that the policy for this type of questions is to wait for the end of the event to answer it $\endgroup$
    – Tristan Nemoz
    Commented Feb 19, 2023 at 20:18

3 Answers 3


You can do it by performing a rotation of $\theta$ in the Fourier basis. I'll give the reasoning for an arbitrary number of qubits.

Let us denote by $\mathsf{QFT}$ the unitary matrix corresponding to the QFT transformation. Note that: $$\mathsf{QFT}|x\rangle=\sum_k\mathrm{e}^{\frac{2\mathrm{i}\pi kx}{2^n}}|k\rangle$$ In particular, this means that, for $x$ and $y$ being two integers: $$\mathsf{QFT}^\dagger\sum_k\mathrm{e}^{\frac{2\mathrm{i}\pi kx}{2^n}}\mathrm{e}^{\frac{2\mathrm{i}\pi ky}{2^n}}|k\rangle=|x+y\pmod{2^n}\rangle$$ So if we perform a rotation in the Fourier basis, we end up with an addition in the computational basis.

Thus, our idea is that we want to apply a rotation of $\theta\in\mathbb{N}$ in the Fourier basis on $|0\rangle$ so that we end up with $|\theta\rangle$.

Suppose you start from the $|0\rangle$ state. You then apply a layer of Hadamard gates: $$\frac{1}{\sqrt{2^n}}\sum_x|x\rangle$$ You now apply a Phase gate with parameter $2^{n-i+1}2\theta\frac\pi{2^{n}}=\theta\frac\pi{2^{i-2}}$ on the $i$-th qubit. For an arbitrary basis state $|x\rangle$, let us denote: $$x=\sum_{i=0}^{n-1}b_i2^{n-i+1}$$ This is simply the binary decomposition of $x$. Note that $b_i$ represents the state of the $i$-th qubit. Because of how the Phase gate works, the rotation on the $i$-th wire will have an effect only if $b_i=1$. Thus, if the state is $|x\rangle$, the angle of the rotation that we apply is: $$\sum_{i=0}^{n-1}b_i2^{n-i+1}2\theta\frac{\pi}{2^n}=2x\theta\frac\pi{2^n}$$ Which means that the state is now: $$\frac{1}{\sqrt{2^n}}\sum_x\mathrm{e}^{\frac{2\mathrm{i}\pi x\theta}{2^n}}|x\rangle$$ Which means that applying $\mathsf{QFT}^\dagger$ on this state yields $|\theta\rangle$.


The answer to the question is affirmative. Here is an example of a single-parameter two-qubit circuit $U(\theta)$ that allows to prepare all four computational basis states starting from the fiducial state $|00\rangle$:

enter image description here

Specifically, the parameter values to obtain each computational basis state (up to a negligible global phase factor) are the following:

  • $U(0) |00\rangle = |00\rangle$.

  • $U(\frac{\pi}{2}) |00\rangle = |01\rangle$.

  • $U(\pi) |00\rangle = |10\rangle$.

  • $U(\frac{3\pi}{2}) |00\rangle = |11\rangle$.

The way I arrived at this circuit goes as follows. Let the parameterized $4 \times 4$ unitary matrix we are seeking, $U(\theta)$, be the time-evolution operator of some two-qubit Hamiltonian $\mathcal{H}$, $U(\theta) = e^{-i \theta \mathcal{H}}$. Assuming a priori the relation between the values of the parameter $\theta$ and the computational basis states that are enumerated above, we want

\begin{equation} U\left(\frac{\pi}{2}\right) = e^{-i \frac{\pi}{2} \mathcal{H}} = \begin{pmatrix} 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{pmatrix}, \end{equation}

in which case our Hamiltonian is given by

\begin{equation} \mathcal{H} = \frac{2i}{\pi} \ln \left[ \begin{pmatrix} 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{pmatrix} \right] = \frac{1}{2} \begin{pmatrix} -1 & 1 - i & -1 & 1 + i \\ 1 + i & -1 & 1 - i & -1 \\ -1 & 1 + i & -1 & 1 - i \\ 1 - i & -1 & 1 + i & -1 \end{pmatrix}. \end{equation}

Now that we have the two-qubit Hamiltonian $\mathcal{H}$, the desired single-parameter two-qubit unitary $U(\theta) = e^{-i \theta \mathcal{H}}$ is unequivocally defined. The only missing step is decomposing such two-qubit circuit in terms of basis gates for an arbitrary value of the parameter $\theta$. There are multiple ways of doing this; I opted for diagonalizing $\mathcal{H}$, as in $\mathcal{H} = V D V^{\dagger}$, which allows to express $U(\theta)$ as $U(\theta) = V e^{-i \theta D} V^{\dagger}$, thus leaving the $\theta$-dependence entirely to the diagonal part, which is easier to decompose.


How about $$ U(\theta) = X^{\text{bin}(\theta)_0} \otimes X^{\text{bin}(\theta)_1} $$ for $\theta\in \{0,1,2,3\}$ and $\text{bin}: \{0,1,2,3\} \rightarrow \{0,1\}^2$ being the binary representation, $\text{bin}(0) = (0,0)$, $\text{bin}(1) = (0,1)$, etc.

  • $\begingroup$ Thank you! This of course works but I would like my parameter $\theta$ to have real continuous values (i.e. rotation angles). I just edited my question accordingly $\endgroup$ Commented Feb 18, 2023 at 9:31

Your Answer

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

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