# How to prepare an arbitrary two-qubit state?

I know that to prepare a Bell state say $$|\phi^+\rangle$$, we need to initial state $$|0\rangle,|0\rangle$$ and then perform a Hadamard on the first and then use it as control to do a NOT gate on the second to obtain $$\dfrac{|00\rangle+|11\rangle}{\sqrt{2}}.$$ But what if wanted to create the state $$\alpha|00\rangle+\beta|01\rangle+\gamma|10\rangle+\eta|10\rangle.$$ How does one create this state?

First of all, I'm assuming you mean the state : $$\alpha \left|00\right> + \beta \left|01\right> + \gamma\left|10\right> + \eta \left|11\right>$$.

What you actually want to do is to act with a gate $$U$$ on the initial state $$\left|00\right>$$ so that $$U\left|00\right> = \alpha \left|00\right> + \beta \left|01\right> + \gamma\left|10\right> + \eta \left|11\right>$$.

So you will need a matrix $$U$$:

$$\begin{bmatrix} \alpha & 0 & 0 & 0\\ \beta & 0 & 0 & 0 \\ \gamma & 0 & 0 & 0\\ \eta & 0 & 0 & 0 \end{bmatrix}$$

so that when in acts on $$$$\left|00\right> = \begin{bmatrix} 1\\ 0\\ 0\\ 0 \end{bmatrix}$$$$

it produces the desired state. So how can someone build such a matrix?

You just have to find a decomposition, or an approximation to some extent, to a familiar set of single and 2-qubit quantum gates.

• Welcome to Quantum Computing SE! I think it would make sense to say that your matrix $U$ needs to have those elements as the first column, with other elements of $U$ being whatever they need to be for $U$ to be unitary, as a matrix with non-zero elements only in the first column won't be unitary – Mithrandir24601 Jun 18 at 23:16
• Yes I totally agree with that. – GiannisKol Jun 19 at 9:29

GiannisKol is correct in an abstract sense -- you simply want to specify any unitary matrix with the first column containing elements $$(\alpha,\beta,\gamma,\eta)$$. You then complete the other columns using any valid assignment (columns must be orthonormal, so you might use the Gram Schmidt procedure). However, there are obviously many options, and you are probably more interested in which of those options gives you a nice gate decomposition.

You have a couple of options for ways to proceed. One option is to rewrite the state as $$\sqrt{|\alpha|^2+|\beta|^2}|0\rangle\frac{\alpha|0\rangle+\beta|1\rangle}{\sqrt{|\alpha|^2+|\beta|^2}}+\sqrt{|\gamma|^2+|\eta|^2}|1\rangle\frac{\gamma|0\rangle+\eta|1\rangle}{\sqrt{|\gamma|^2+|\eta|^2}}.$$ To me, this instantly suggests one circuit. Start with a single-qubit rotation that rotates the first qubit as $$|0\rangle\rightarrow\sqrt{|\alpha|^2+|\beta|^2}|0\rangle+\sqrt{|\gamma|^2+|\eta|^2}|1\rangle$$ Now apply a single qubit rotation on the second qubit that rotates $$|0\rangle\rightarrow\frac{\alpha|0\rangle+\beta|1\rangle}{\sqrt{|\alpha|^2+|\beta|^2}}$$ Now, all you need is a controlled-$$U$$, controlled off the first qubit, targeting the second, where $$U$$ rotates $$\frac{\alpha|0\rangle+\beta|1\rangle}{\sqrt{|\alpha|^2+|\beta|^2}}\rightarrow \frac{\gamma|0\rangle+\eta|1\rangle}{\sqrt{|\gamma|^2+|\eta|^2}}.$$

A second method is to make use of the Schmidt decomposition. Using that, you can find that your initial state $$|\psi\rangle$$ may be written in the form $$|\psi\rangle=U_1\otimes U_2(\delta_0|00\rangle+\delta_1|11\rangle).$$ So, if we can produce $$\delta_0|00\rangle+\delta_1|11\rangle$$, then we just apply $$U_1$$ on the first quit and $$U_2$$ on the second, and we'll have made $$|\psi\rangle$$. How do we do this? Apply a single qubit unitary that rotates $$|0\rangle\rightarrow \delta_0|0\rangle+\delta_1|1\rangle$$ on, say, the first qubit. Then apply controlled-not controlled off the first qubit and targeting the second qubit. If you're decomposing your circuit in terms of controlled-not + single-qubit unitaries, this method does that for you automatically, and is clearly optimal in terms of the number of controlled-nots required.

You may also be interested in the content of Nielsen's majorization theorem. Part of this is a constructive way to deterministically and locally go from a maximally entangled state to the state you want. Again, it's related to the Schmidt decomposition. So, say you've already produced $$(|00\rangle+|11\rangle)/\sqrt{2}.$$ If you perform a generalised measurement with elements $$M_0=\delta_0|0\rangle\langle 0|+\delta_1|1\rangle\langle 1|,\qquad M_1=\delta_1|0\rangle\langle 0|+\delta_0|1\rangle\langle 1|$$ on one qubit, then if you get the 0 answer, you've produced the state you want. If you get the 1 answer, both qubits need $$X$$ applying. Then, finally, you apply $$U_1\otimes U_2$$.

You can prepare any arbitrary state with method described in Transformation of quantum states using uniformly controlled rotations.

The method is based on application of $$Ry$$ rotation for setting amplitudes and $$Rz$$ rotations for setting phases.

The method is able to transform any state $$|\psi_0\rangle$$ to another one $$|\psi_1\rangle$$ with intermediate step of transforming $$|\psi_0\rangle$$ to $$|0\rangle^{\otimes n}$$. So in practise, only part transforming $$|0\rangle^{\otimes n}$$ to $$|\psi_1\rangle$$ is probably relevant as state $$|0\rangle^{\otimes n}$$ is usually initial state of quatum registers.