# Quantum gates with respect to phase angles [duplicate]

We can say that

$$X (\cos \frac{\theta}{2} |0\rangle + e^{i \phi}\sin \frac{\theta}{2} |1\rangle) = \cos \frac{\pi-\theta}{2} |0\rangle + e^{-i \phi}\sin \frac{\pi-\theta}{2} |1\rangle$$,

a fact that can be derived by multiplying the $$X$$ matrix and the state vector and using angle identities:

$$X (\cos \frac{\theta}{2} |0\rangle + e^{i \phi}\sin \frac{\theta}{2} |1\rangle) = e^{i \phi}\sin \frac{\theta}{2} |0\rangle + \cos \frac{\theta}{2} |1\rangle = e^{i \phi}\cos \frac{\pi - \theta}{2} |0\rangle + \sin \frac{\pi - \theta}{2} |1\rangle = \cos \frac{\pi-\theta}{2} |0\rangle + e^{-i \phi}\sin \frac{\pi-\theta}{2} |1\rangle$$

Is there a writeup somewhere or a standard way to derive this identity for other gates, i.e. $$Y, Z, H, \sqrt{Y}$$?

• Do you know about the Bloch sphere? Any unitary gate acting on a qubit is equivalent to a rotation of the Bloch vector (describing the state) about some axis by some angle (axis and angle determined by the unitary. Commented May 11, 2021 at 18:17

As Quantum Mechanic said in the comments, the Bloch vector is the way to go. Any one-qubit pure state $$|\psi\rangle$$ can be written in the form $$|\psi\rangle\langle\psi|=\frac12(I+n_XX+n_YY+n_ZZ)$$ where $$n_X^2+n_Y^2+n_Z^2=1$$. Moreover, the vector $$\vec{n}=(n_X,n_Y,n_Z)$$ can also be written as $$(\sin\theta\cos\phi,\sin\theta\sin\phi,\cos\theta)$$. So, if we can tell what happens to the Bloch vector, you can easily map this through to the angles.
So, consider the action of the $$X$$ matrix of $$|\psi\rangle$$. $$|\psi\rangle\langle\psi|\mapsto X|\psi\rangle\langle\psi|X=\frac12(I+n_XX-n_YY-n_ZZ).$$ You just need to use the commutation properties of the Pauli matrices. So, we see that $$(n_X,n_Y,n_Z)\xrightarrow X (n_X,-n_Y,-n_Z)$$
By the same token, you very quickly get \begin{align*} (n_X,n_Y,n_Z)&\xrightarrow Z (-n_X,-n_Y,n_Z) \\ (n_X,n_Y,n_Z)&\xrightarrow H (n_Z,-n_Y,n_X) \end{align*} I've left the other couple for you to do.