# Hadamard gates and constructing them

Can anyone explain the process required to make a Hadamard gate that acts on 1st, 2nd and 3rd qbits?

For Hgates acting on the first qubit i realise the matrix is $H=\begin{pmatrix} 1&1\\1&-1\end{pmatrix}$, but I am unsure how to formulate such a gate. As to acting on the second qubit I have read this web page 1 but I am not really sure if it is correct, because it is just a 4x4 matrix without any zeroes. I found this $\begin{pmatrix} 1 & 1 \\-1 & 1 \end{pmatrix}$ on another website which will obviously have zeroes when it is multiplied by $I$. Simply can anyone explain how Hadarmd gates can be formulated and built to n qubits?

-
The web page talks about a Hadamard transform and not a Hadamard gate. To perform a Hadamard transform to an $n$-qubit state, you apply a Hadamard gate to each qubit individually. So the website is correct, but it doesn't directly apply to your question. –  Peter Shor Mar 11 '13 at 10:14

For two qubits, the answer is as follows. I don't feel like writing out $8\times 8$ matrices, so I'm not doing the 3-qubit case.
The Hadamard gate acting on the second qubit is $I \otimes H$:
$$\frac{1}{\sqrt{2}} \left( \begin{array}{rrrr} 1&1&0&0\\ 1&-1&0&0\\ 0&0&1&1\\ 0&0&1&-1 \end{array} \right).$$
The Hadamard gate acting on the first qubit is $H \otimes I$:
$$\frac{1}{\sqrt{2}} \left( \begin{array}{rrrr} 1&0&1&0\\ 0&1&0&1\\ 1&0&-1&0\\ 0&1&0&-1 \end{array} \right).$$