# Multiple Hadamard gates Transformation on N qbits

I am newbie to quantum computing and having a bit confusion regarding the action of Hadamard gate on multiple qbits which are already in superposed state (I well understand how it works for qbits which are in |00..00> state) i.e. in the middle of the circuit.

For example in Grover's algorithim with three qbits |ψ2>=1√8(|000⟩+|001⟩+|010⟩+|011⟩+|100⟩−|101⟩−|110⟩+|111⟩) this state when given to Hadamard gates (on all three qibts) generates state |ψ3a⟩=12(|000⟩+|011⟩+|100⟩−|111⟩). Also when given |ψ3a⟩=12(-|000⟩+|011⟩+|100⟩−|111⟩), it generates |ψ3a⟩=12(-|101⟩-|110⟩). Now when I apply the truth table I might get the intended answers but is their any logical way or a generalized formula to infer the output without diving into applying Hadamard to each single ket and xoring them to get the results, as its not fun for larger number of qbits.

Thanks.

• Hi and welcome to Quantum Computing SE. Please use MathJax for typesetting mathematical expressions. Jul 15, 2022 at 5:25
• sure and thanks Jul 15, 2022 at 9:50

There is a formula for the Hadamard transform on $$N$$ qubits. $$H^{\otimes N}=\frac{1}{\sqrt{2^N}}\sum_{x,y\in\{0,1\}^N}(-1)^{x\cdot y}|y\rangle\langle x|$$ In this case, $$x\cdot y=\sum_{i=1}^Nx_iy_i$$ is just like thinking of the binary strings as vectors and taking their inner product.
For the 3-qubit cases that you're describing, this just expands to an $$8\times 8$$ matrix. If you take it and apply it to any input state, it'll tell you the output state.