1
$\begingroup$

Hello I am trying to create an Q0->HSSH Q1->HSH using U3 Gate only.

I am trying U3(pi/2, 0, pi) for H Gate and U3(4pi/2, 2pi,0) for S gate.

The output state vector using normal H and S gate don't seem to match the output from U3. Am I not understanding something correctly?

$\endgroup$

1 Answer 1

1
$\begingroup$

I think you got the Hadamard gate correct, but not the S-gate.

The U3-gate is quite versatile, as it can be used to construct many other standard gates. For example: \begin{align*} U_3 (\theta=\frac{\pi}{2}, \phi= 0, \lambda=\pi) &= \begin{bmatrix} \cos(\theta/2) & -e^{-i\lambda}\sin(\theta/2) \\ e^{i\phi}\sin(\theta/2) & e^{i(\lambda + \phi)}\cos(\theta/2) \end{bmatrix} \\ &= \begin{bmatrix} \cos(\pi/4) & -(-1)\sin(\pi/4) \\ 1 \sin(\pi/4) & -1 \cos(\pi/4) \end{bmatrix}. \end{align*} With: \begin{align*} \cos{\frac{\pi}{4}} = \sin{\frac{\pi}{4}} = \frac{1}{\sqrt{2}}, \end{align*} we are able to construct a Hadamard gate: \begin{align*} \Rightarrow U_3 (\frac{\pi}{2}, 0, \pi) &= \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} = H \end{align*}

Another example is how to construct the flexible phase gate $U_1$ (with which we can generate the P-gate, S-gate, and T-gate): \begin{align*} \Rightarrow U_3 (0, 0, \lambda) &= \begin{bmatrix} \cos(\theta/2) & -e^{-i\lambda}\sin(\theta/2) \\ e^{i\phi}\sin(\theta/2) & e^{i(\lambda + \phi)}\cos(\theta/2) \end{bmatrix} \\ &= \begin{bmatrix} 1 & 0 \\ 0 & e^{i\lambda} \end{bmatrix} \\ &= U_1. \end{align*} Specifically, to generate a Z-gate: $$ U_3(0, 0, \pi) = \begin{bmatrix} 1 & 0 \\ 0 & e^{i\pi} \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} = Z $$ And, similarly, the S-gate: $$ U_3(0, 0, \pi/2) = \begin{bmatrix} 1 & 0 \\ 0 & e^{i\pi/2} \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} = S $$

$\endgroup$
2
  • $\begingroup$ Awesome that helps yeah I found my mistake, I was putting pi in lambda thinking the multiplication should lead to i, but turns out I cannot do basic trigonometry lol $\endgroup$
    – JaZZyCooL
    Jan 30, 2023 at 1:00
  • $\begingroup$ You may want to give my answer the check mark as being The Answer ;-) $\endgroup$
    – rhundt
    Jan 30, 2023 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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