# Quantum Katas - Tutorials - SingleQubitGates - Exercise 7 - Preparing an arbitrary state

Exercise 7 "Preparing an arbitrary state" from the Quantum Katas - Tutorials - SingleQubitGates asks to prepare a state $$\alpha|0\rangle + e^{i\theta}\beta|1\rangle$$, using parameters $$\alpha$$, $$\beta$$, and $$\theta$$.

In brief, $$\theta$$ is one of known-inputs, why we don't use $$\theta$$ for the Ry gate directly ? Something like this..

Ry(theta, q);
R1(theta, q);


But alas, I got error:

Qubit in invalid state. Expecting: Zero
Expected:   0
Actual: 0.061208719054813704
Try again!


Any ideas would be highly appreciated!!

The angle to use for Ry gate is not necessarily the same one as the given angle $$\theta$$ to use for R1 gate. This means that you need to figure out the angle for Ry gate from the parameters $$\alpha$$ and $$\beta$$. If you're using $$\theta$$ for both angles, you'll be preparing a state $$\cos \frac{\theta}{2}|0\rangle + e^{i\theta}\sin \frac{\theta}{2}|1\rangle$$, not $$\alpha|0\rangle + e^{i\theta}\beta|1\rangle$$ the task asks for.