# How to you initialize a qubit into a magic state in IBM Quantum composer

I want to build/prepare a qubit transforming from $$\vert 0 \rangle$$ into a magic state. How do I do that? the particular magic state I have in mind is the following,

$$|\varphi\rangle = \frac{1}{\sqrt{2}}(|0\rangle+e^{\frac{i\pi}{4}}|1\rangle)$$

First, use a Hadamard gate to create the superposition $$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$ If you write down what you want next, you will find that you need to act with the unitary gate with matrix $$\begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix}$$ which is exactly the $$P$$ gate with argument $$\frac{\pi}{4}$$. So your circuit will look something like this:

Alternatively, you could use Qiskit with initialize function and then decompose the resulting circuit until you get something that can be implemented with gates in the composer. The $$P$$ gate is also equivalent (up to a global phase) to the $$R_z$$ gate so you could also use that one.