# How to prove the matrix identities $HXH = Z$ and $HZH = X$?

As we know Hadamard gates are used to bring quantum bits into superposition states.

I’m trying to understand how identities $$HXH = Z$$ & $$HZH = X$$ w.r.t rotation.

Consider the matrix representations of these operations and with little algebra, things will become obvious.

$$H = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1\\ 1 & -1 \end{bmatrix}$$ $$X = \begin{bmatrix} 0 & 1\\ 1 & 0 \end{bmatrix}$$ $$Z = \begin{bmatrix} 1 & 0\\ 0 & -1 \end{bmatrix}$$

Then it is clear that $$HXH = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1\\ 1 & -1 \end{bmatrix} \begin{bmatrix} 0 & 1\\ 1 & 0 \end{bmatrix} \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1\\ 1 & -1 \end{bmatrix}$$ $$= \begin{bmatrix} 1 & 0\\ 0 & -1 \end{bmatrix} = Z$$

Things will follow similarly for $$HZH$$.

You can think of this operation as change of basis in linear algebra. (Keep in mind that $$H=H^{-1}=H^{†}$$)

$$X$$ is a 180$$^{\circ}$$ rotation about the x-axis,

$$Z$$ is a 180$$^{\circ}$$ rotation about the z-axis,

Since $$H$$ swaps the x-axis with the z-axis, (and a subsequent $$H$$ swaps them back to their original orientation)

then: $$HXH = Z$$

Also because $$H=H^{-1}$$ and so:

$$X = H^{-1}ZH^{-1} = HZH$$