I'm just starting to learn quantum computing and playing around with my own circuits. I've seen a few examples of circuits where people are placing two Hadamar gates side by side.
I've worked out the math and it seems to me that any 2D vector multiplied by the Hadamar Matrix twice would just return to it's initial state.
The Hadamar transform is represented by $\dfrac{1}{\sqrt2}\left[\begin{array}{l}1&1\\1&-1\end{array}\right]$ and here I'm applying it to the vector $[a,b]$
$$\dfrac{1}{\sqrt2}\left[\begin{array}{l}1&1\\1&-1\end{array}\right]\left[\begin{array}{l}a\\b\end{array}\right] = \dfrac{1}{\sqrt2}\left[\begin{array}{l}a+b\\a-b\end{array}\right]$$
Applying the Hadamar transformation to the result gives $$= \dfrac{1}{\sqrt2}\left[\begin{array}{l}1&1\\1&-1\end{array}\right]\dfrac{1}{\sqrt2}\left[\begin{array}{l}a+b\\a-b\end{array}\right]$$ $$ = \dfrac{1}{\sqrt2}\dfrac{1}{\sqrt2}\left[\begin{array}{l}2a\\2b\end{array}\right]$$ $$= \dfrac{1}{2}\left[\begin{array}{l}2a\\2b\end{array}\right]$$ $$= \left[\begin{array}{l}a\\b\end{array}\right] $$
Why then would one ever need to put two Hadamar gates side by side in a circuit? If they just cancel out?
Am I making the mistake of mixing classical computing with quantum?