# Trying to prove the Hadamard gate leaves a state unchanged

It is known that the Hadamard gate is the equivalent of doing a 180 degree rotation about the x + z axis.

I am therefore trying to prove that applying the gate on the state cos pi/8 |0> + sin pi/8 |1>, which lies on the x + z axis unchanged.

So, on applying the Hadamard on the above, I get

1/root(2)((cos pi/8 + sin pi/8)|0> + (cos pi/8 - sin pi/8)|1>)


So, I did try to take the common global phase out, but I'm unable to prove that this is the same state that I started out with. Any help on how to approach this will be appreciated.

• Hint: the only thing that matters is the ratio of the $|1 \rangle$ and $|0 \rangle$ coefficients. To prove these ratios are equal, use trig identities. – knzhou Jun 17 '18 at 15:10

Note that $$\sin(x\pm\pi/4)=\frac{1}{\sqrt2}(\sin x\pm\cos x).$$ It follows that \begin{align}\cos(\pi/8)+\sin(\pi/8) &= \sqrt2 \sin(3\pi/8), \\ \cos(\pi/8)-\sin(\pi/8) &= \sqrt2 \sin(\pi/8). \end{align} You should be able to reach the conclusion from here.