# Forming states of the form $\sqrt{p}\vert 0\rangle+\sqrt{1-p}\vert 1\rangle$

I'm curious about how to form arbitrary-sized uniform superpositions, i.e., $$\frac{1}{\sqrt{N}}\sum_{x=0}^{N-1}\vert x\rangle$$ for $$N$$ that is not a power of 2.

If this is possible, then one can use the inverse of such a circuit to produce $$\sqrt{p}\vert 0\rangle+\sqrt{1-p}\vert 1\rangle$$ (up to some precision). Kitaev offers a method for the reverse procedure, but as far as I can tell there is no known method to do one without the other.

Clearly such a circuit is possible, and there are lots of general results on how to asymptotically make any unitary I want, but it seems like a massive headache to distill those results into this one simple, specific problem.

Is there a known, efficient, Clifford+T circuit that can either produce arbitrary uniform superpositions or states like $$\sqrt{p}\vert 0\rangle+\sqrt{1-p}\vert 1\rangle$$?

• what do you mean by "efficient" in regards to producing $\sqrt{p}|0\rangle+\sqrt{1-p}|1\rangle$ given that there's no scaling involved in such a question – DaftWullie Feb 8 '19 at 12:08
• The scaling would be fidelity with the required state, since we likely can't produce exactly the right state. Can we get $\epsilon$ close with only $O(\log(1/\epsilon))$ gates, say? – Sam Jaques Mar 12 '19 at 9:21
• Yes: arxiv.org/abs/1212.6964 (don't ask me how it works!) – DaftWullie Mar 12 '19 at 9:49
• That's a good reference (I think I found the previous work they cite when I asked this question) but I was hoping there would be an easily describable, compact version of the same, since this is such a simple and fundamental problem. – Sam Jaques Mar 12 '19 at 12:41

As long as you want to set arbitrary states for a single qubit, like in your example, the solution is straightforward and it makes use of standard 2x2 $$R_y$$ gate. In there if you set

$$\theta = 2\arctan(\sqrt{1-p}/\sqrt{p})$$

and apply $$R_y(\theta)$$ in the form $$\begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2)\\ \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}$$

to an input qubit in superimposed state (i.e. passed through a H gate), you get what you're looking for.

Of course things get more complicated in case you want to set an arbitrary state over a qubit register of size > 1. In that case there are algorithms like Ventura's one (Initializing the Amplitude Distribution of a Quantum State) which can do it with polynomial complexity.

• Sure, but is there a way to construct $R_y(\theta)$ for arbitrary $\theta$ out of Clifford+T? Or do we just assume a gate set that includes $R_y(\theta)$ for all $\theta$? Is this realistic; if we can do noisy arbitrary rotations, can we distill them? – Sam Jaques Feb 8 '19 at 13:35
• I think the "Is this realistic" depends on the level at which you're computing. If you're computing on actual physical qubits, you probably have these arbitrary rotations available. If you're using logical qubits, such as in a fault-tolerant computation, you probably don't have them available. – DaftWullie Feb 8 '19 at 13:44
• So in all the algorithms intended for fault-tolerant computations that depend on creating arbitrary-sized superpositions, what are they supposed to do? – Sam Jaques Feb 8 '19 at 20:16
• Well, Solovay–Kitaev tells you that you can produce a gate $R_y(\theta)$ for any $\theta$ with precision $\varepsilon$ with $\log(1/\epsilon)$ gates, so even logical qubits are not an issue. – tobiasBora Mar 18 '19 at 12:35