# Relation between Rz gate and Phase gate

As I know, the $$Rz(\frac{\pi}{2})$$ gate is equivalent to the Phase gate $$S$$ up to the global phase. However, I found using qiskit, the $$Rz(\frac{-\pi}{2})$$ is also equivalent to the Phase gate $$S$$. I think it should be a $$S^\dagger$$ gate. Are they really the same up to a global phase?

I further tried the code and found any angles of $$Rz$$ gate equivalents to the phase gate $$S$$, which I think definitely is not true.

Here's the code I used:

The $$RZ(\theta)$$ gate is defined by: $$RZ(\theta)=\begin{pmatrix}\mathrm{e}^{-\mathrm{i}\frac\theta2}&0\\0&\mathrm{e}^{\mathrm{i}\frac\theta2}\end{pmatrix}=\mathrm{e}^{-\mathrm{i}\frac\theta2}\begin{pmatrix}1&0\\0&\mathrm{e}^{\mathrm{i}\theta}\end{pmatrix}=\mathrm{e}^{-\mathrm{i}\frac\theta2}P(\theta)$$ with $$P$$ being a phase gate. In particular, $$S=P\left(\frac\theta2\right)$$. So, as you mentioned, a $$RZ\left(\frac\pi2\right)$$ gate is equivalent up to a global phase to an $$S$$ gate. However, it is not equivalent to an $$S^\dagger$$ gate up to a global phase.
The reason for this is that a quantum circuit starts from the state $$|0\rangle$$. Thus, when applying your first circuit to it, you end up with $$\mathrm{e}^{-\mathrm{i}\frac\pi4}|0\rangle$$, which is equivalent to $$|0\rangle$$ up to a global phase. Since the second one leaves $$|0\rangle$$ unchanged, the final statevector is also $$|0\rangle$$, which is why your code (correctly) tells you that these two statevectors are equivalent.
Simply put an h gate before the rz and s gates respectively and you will see that the statevectors are no longer equivalent.