# How does the Hadamard gate work?

I'm learning about the Quantum Fourier Transform (QFT) and from what I can see the Hadamard gate equation doesn't make sense from what I have learnt so far. Here's a link to the resource (Example 2). I denote as applying Hadamard to the the nth Qubit.

I expect it to work in the following manner: $$|x_n\rangle = \alpha_n |0 \rangle + \beta_n |1 \rangle$$ $$|x_3x_2x_1\rangle \xrightarrow {H_1} |x_3x_2\rangle \frac{1}{\sqrt 2}\left[ \left( \alpha_1 + \beta_1 \right)|0\rangle + \left( \alpha_1 - \beta_1 \right)|1\rangle \right]$$ But in the equation provided by the cource, it's quite different. $$|x_3x_2x_1\rangle \xrightarrow {H_1} \vert x_3x_2\rangle \frac{1}{\sqrt{2}} \left[ \vert0\rangle + e^{\frac{2\pi i}{2}x_1} \vert1\rangle\right]$$

How does the first part equal the second? $$\left( \alpha_1 + \beta_1 \right)|0\rangle + \left( \alpha_1 - \beta_1 \right)|1\rangle = \vert0\rangle + e^{\frac{2\pi i}{2}x_1} \vert1\rangle$$

• Check Example 1 in the same link you've provided. Jan 18, 2023 at 12:35

I think you're confusing two bits of notation. When they write down something like $$|x_3x_2x_1\rangle,$$ then, yes, this is describing a quantum state, but they are only thinking about the case where the $$x_i$$ take on binary values. Any other superposition is implicitly dealt with by the fact that quantum mechanics is linear (so if you know what happens to all binary strings, you know what happens to any superposition of those).
If you calculate your prediction, with for $$x_1=0$$ ($$\alpha_n=1,\beta_n=0$$) or $$x_1=1$$ ($$\alpha_n=0,\beta_n=1$$), you'll find that both of these coincide with the given formula.