# $S^{\dagger}$ gate in Q#

I would like to implement $$S^{\dagger}$$ gate in Q# and I would like the best way to do it, is it correct to say that $$S^{\dagger}$$ is equivalent to R1( -Pi()/2 , q) ? Is it also correct to say that $$S^{\dagger}$$ is equivalent to Rz( -Pi()/2 , q) but with a global phase ?

Thank you.

It is correct. Since you have $$R_1(\theta) = \begin{bmatrix}1 & 0\\ 0 & e^{i\theta}\end{bmatrix}$$ and $$R_z(\theta) = \begin{bmatrix}e^{-i\theta/2} & 0\\ 0 & e^{i\theta/2}\end{bmatrix}$$ just using the value of $$\theta = -\pi/2$$ gives you $$R_1(-\pi/2) = \begin{bmatrix}1 & 0\\ 0 & -i\end{bmatrix} = S^{\dagger}$$ and $$R_z(-\pi/2) = e^{i\pi/4}\begin{bmatrix}1 & 0\\ 0 & -i\end{bmatrix}$$ which works exactly the same as $$S^{\dagger}$$ but with a global phase of $$e^{i\pi/4}$$.
Since the S operation supports the Adjoint functor, the Q# call Adjoint S(target) is the easiest way to call the $$S^{\dagger}$$ gate.
To verify that this is the same as the suggestion made above by Tharrmashastha V, you can use the AssertOperationsEqualReferenced operation:
AssertOperationsEqualReferenced(1,