Suppose I have 100 qubits that I want to entangle and put into superposition. To do so I construct a Hadamard gate to do this. By definition, the Hadamard is going to be a 2^100 X 2^100 matrix - which is huge.

How does one go about actually performing this operation? The size of the Hadamard matrix is exponential relative to the number of qubits (ie 2^100 X 2^100). Is there a way to perform this operation without actually making this huge matrix? Or can we only work with a 'small' number of qubits at once?

Follow up question: does using 100 4x4 Hadamard gates (one for each qubit) do the same thing as using a single 2^100 x 2^100 Hadamard gate? If so, how do these qubits become entangled?

  • 1
    $\begingroup$ just reminding that "Nature" doesn't build Hadamard matrices, and that one small piece of semi-reflecting glass can operate on a LARGE number of photons, all at once. Nevertheless, it is a valid question, asking how to construct complex gates from more simple ones. $\endgroup$
    – Ran G.
    Oct 27, 2015 at 21:35
  • 2
    $\begingroup$ D.W. - just a heads up. Math.SE told me to post on CSTheory.SE. CSTheory.SE told me to post here. Sorry for the reposts. Would love to get some feedback on this. $\endgroup$
    – C Shreve
    Oct 28, 2015 at 3:02
  • $\begingroup$ Isn't the fast Walsh–Hadamard transform what you're looking for? It recursively breaks down the Hadamard matrix into 4 copies of a smaller Hadamard matrix (one negated). $\endgroup$
    – TLW
    Oct 28, 2015 at 4:53
  • $\begingroup$ @D.W. : the post on CSTheory is actually closed, so I don't think the crossposting policy applies. Ideally that post would have been migrated rather than C.Shreve reposting it, but migration of posts from there doesn't seem to be as efficient as it could be. $\endgroup$ Oct 28, 2015 at 8:46
  • $\begingroup$ @NieldeBeaudrap, you're absolutely right -- sorry that I missed that. As for migration, you (or the OP) can arrange for the question to be migrated by clicking "flag" to flag it for moderator attention. It's not automatic: you need to take some specific action to have that happen. $\endgroup$
    – D.W.
    Oct 29, 2015 at 17:52

1 Answer 1


It does require that, but you get it for free.

When you apply a 2x2 gate to a single qubit, the gate you are applying to the $n$-qubit system that qubit is in is automatically $2^n$ x $2^n$. If you apply an $H$ to the third qubit out of six, then the operation you applied to the six qubits is $I_2 \otimes I_2 \otimes H \otimes I_2 \otimes I_2 \otimes I_2$. That's a 64x64 matrix; exactly what you needed.

So performing a Hadamard transform on $n$ qubits is actually very easy, even though some very large matrices are being thrown around if you think about what's happening in that way. Just independently hit each qubit with the usual single-qubit $H$ gate.

Note that Hadamarding each qubit doesn't entangle them, though. It puts them in a superposition, but the state still factors. If you want to entangled all the qubits, you could instead hit one of them with a Hadamard then use Controlled-Nots to toggle each of the other qubits based on that Hadamard'ed qubit.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.