2
$\begingroup$

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)$$

$\endgroup$

1 Answer 1

2
$\begingroup$

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:

                                                            enter image description here

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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