The nicest exposition I have found about the Hadamard gate in quantum computing is as follows: enter image description here

So, the Hadamard gate essentially takes a known input (black ball or white ball in this case) and outputs a seemingly random colored ball.

Next, we suppose this process is truly random. Then a sequence of two random generating machines will just output:

enter image description here

which is also a random output of black balls and white balls.

However, when we put two Hadamard boxes in sequence, this is what happens: enter image description here

This has to mean that there is a hidden variable stored somewhere that the Hadamard can somehow remember its original states. There is no other possible explanation other than that there is a hidden state invisible to us, is there?

Whether this hidden "variable" is knowable and measurable, or as quantum theory states, it is forever unknowable to us mortals, is a secondary question.

But primarily, there must be a hidden variable here, right? Without math, if possible (was it Richard Feynman who said if we have truly understood something then we could explain it entirely without any of complex calculations), please explain what hidden variable/mechanism is enabling 2 consecutive Hadamard gates to recover information about its original color of the ball we inputed into it?

Thank you and looking forward to ensuing discussions.

  • 1
    $\begingroup$ Most quantum mechanics interpretations do not invoke hidden variables to explain such a phenomenon, you just have to drop conterfactual definiteness $\endgroup$
    – Mauricio
    Oct 4, 2021 at 14:01
  • $\begingroup$ "was it Richard Feynman who said ..." - not exactly; he said something more along the lines of: one truly understands something if he is able to explain it to others (who perhaps have the necessary background, or are willing to invest time to catch up). But he was also famous for making his explanations as accessible as possible to those who might lack some of the prerequisite knowledge. He did say, though, that mathematics is the language of nature, and that it is practically impossible to develop deep knowledge & understanding without "speaking" that language. $\endgroup$ Oct 4, 2021 at 19:38

2 Answers 2


This picture is not wrong, but it involves a hidden simplification that makes it not quite right if taken literally.

enter image description here

You see, the random black ball / gray ball is what you get if you perform a measurement on the thing that comes out of the Hadamard gate, but that's not its direct output.

What comes out on the other side is a superposition state (a "gray" ball, if you will) - which is not some purely conceptual thing, it's a separate, third state (out of many more - there's a continuum of states; black, white and 50%/50% gray are just three out of many possibilities).

However, the "gray" state cannot be detected as such by the measuring device used; the measurement causes the state to "collapse" to white or black, in this case with 50% chance for either outcome. (With a measuring device constructed differently, you could detect this "gray" state, and a different kind of "gray" state, but not black or white - a measurement on, say, the black state would randomly collapse the qubit to one of the two distinct grays.)

The states of a qubit can perhaps be better understood as a clockface (with only one handle). In that picture, the qubit is in the black state when the handle is pointing to the right, to 3 o'clock, and in the white state when the handle is pointing straight up, to 12 o'clock. We say these states are orthogonal (literally, the state vectors, represented by the clock handle positions, are orthogonal)1.

1 There's a slight subtlety in that the clock handle can point in the exact opposite (negative) direction too; 9 o'clock is also measured as the black state, and 6 o'clock is also measured as the white state; there's no way to distinguish these on measurement, but the states are different, and they may affect how the qubit is transformed as it goes through different quantum logic gates.

enter image description here

Now, a qubit is in a superposition state, a "gray" state, when the clock handle points anywhere else - so, there's a whole bunch of superposition states, all of which correspond to different probabilities for the qubit to collapse to black or white after measurement (again, think of these as of different shades of gray). If the clock handle is closer to the horizontal axis, then the measurement is more likely to result in the black state, and if it is closer to the vertical axis, the white state is more likely. If the clock handle is at 45 deg. angle, the chances are 50/50.

enter image description here (source)

What the Hadamard gate does (in this analogy2) is it moves the clock handle by 45 degrees in the clockwise direction, and then mirrors the result across the horizontal axis (flipping the orientation of the vector vertically). So, if the state was black to begin with, this operation makes it point to half past 1 (45 deg. angle); what comes out of the gate is depicted in the image above (the arrow with the $|\psi\rangle$ label). This is why the measurement outcomes are random with equal probability.

2 I say "in this analogy" because there's also a different way to depict a qubit, called the Bloch sphere, where this operation corresponds to a different angle. However, the clockface analogy is IMO better for developing the initial intuition.

Now, what actually happens when you have two Hadamard gates in a series is that this rotate & flip operation happens twice in a row, and it just so happens that doing this gets you back to where you started - it's just the nature of the operation itself. A qubit comes out of the first gate in a superposition state, no measurement is performed, so it stays like that ("gray") before entering the other gate, and after that it is transformed back to the original state.

So, there's no extra hidden variable in the qubit itself, and the Hadamard gates have no "memory cells" to remember what the qubit's state was initially. It just that the operation itself is such that double application is the same, in its result, as doing nothing. Much like how, if you spun around your own body axis by 180 deg twice, you'd get back to your original orientation.

In linear algebra terms, this logic gate corresponds to the order 2 Hadamard matrix, and composing those results in the identity matrix (which does nothing when acting on a state vector):

$$ H = \frac{1}{\sqrt 2} \begin{bmatrix} 1 & 1 \\ 1 & -1 \\ \end{bmatrix} $$

$$ HH = \frac{1}{\sqrt 2} \frac{1}{\sqrt 2} \begin{bmatrix} 1 & 1 \\ 1 & -1 \\ \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 1 & -1 \\ \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ \end{bmatrix} $$

  • $\begingroup$ @Flip thank you for answering. I have some further questions about this, posted below, if you would oblige to explain in more details, please... Thanks! $\endgroup$
    – user315366
    Oct 4, 2021 at 21:51

@Flip thanks for answering! I have come across the mathematical versions of the explanation for this using the |0> + |1> braket form, also the finite state machine rotating explanation.

It seems to me that all these explanation essentially say that: enter image description here

  1. we can only ever see the projection of the real object, projected along the x or y "walls" (axis). Thus, there is some hidden attributes of the real object that we cannot see because of the limitations we have in perceiving nature (in the above picture it is the physical hand shape, which we cannot see because we can only ever see the shadow of it).

  2. we can cunning imagine how the unit circle state machine can be cleverly used to hide information if we are only able to see the shadow, like a magician does magic tricks. For example, if the original ball is black, we set the clock hands to 1:30, giving the illusion of 50% randomness between white and black ball emerging from the H box. But if the original ball is white, we set the clock hands to 10:30.

Because we can only ever measure the shadow of projection on the x and y walls on the axis, this produces exactly the same 50% random seeming probabilities as the ball emerges from the H box. But the real information is stored actually different internally (10:30 versus 1:30) which enables the second H box to differentiate whether the original ball is white or black.

If the H box sees that the clock is set to 1:30, then it knows original input ball is white. If it sees the clock is set to 10:30, then original input ball is black. This answer is obvious to the H gate because it can perceive this second dimension of circular states, which we in our mortal limitations cannot perceive.

Isn't this what all those mathematical symbolism are really saying, that there is a hidden "dimensionality" to the state of the balls, that we are unable to perceive?

If so, then to make the sudden jump, from recognizing our limitations to perceive this "circular dimensions", to suddenly philosophizing that the ball exists simultaneously in "superposition of states" both being black and white at the same time seems unnecessary and hocus pocus.

If Penn and Teller were to hide a ball and asks us to choose whether the hidden ball is in their right or left closed palm, would we philosophize that "Oh, the ball is in a superposition of states being both in Teller's left and right hands at the same time, its physical reality will only be revealed once we make an observation by having Teller open his palm"?

I guess this is what sounds unnecessary, like hocus-pocus, to me about saying that the ball passing through the H box somehow becomes a superposition of both being white and black. Isn't all the calculations of the form a|0> + b|1> just a mathematical shorthand notation for saying, for example, "The sky is grey, so there is a some probability of rain this afternoon".

Why do we then need to philosophize further about this, and say, "It is actually both raining and sunny this afternoon, and the superposition of this reality will only be revealed after we open our eyes and measure the result"?

  • 1
    $\begingroup$ "If the H box sees that the clock is set to 1:30, then it knows original input ball is white.". No, the H box doesn't "see" anything. It just transforms the state of the input qbit, it does not observe it. It couldn't do its job properly if it observed the qbit because that would collapse the state. $\endgroup$
    – PM 2Ring
    Oct 4, 2021 at 22:20
  • $\begingroup$ @PM thank you for answering! but then the sentence, "the Hadamard gate can also be expressed as a 90º rotation around the Y-axis, followed by a 180º rotation around the X-axis" is really saying the the Hadamard gate can "perceive" this circular dimension and manipulates it in a way that we mortals cannot, isn't that all what the mathematics is really saying? $\endgroup$
    – user315366
    Oct 4, 2021 at 22:50
  • 1
    $\begingroup$ @ James - I don't have time now, but I'll edit my answer tomorrow to provide more detail. This site doesn't work as a discussion forum (it's not like a thread), it's conceptualized to be one specific question followed by different answers, and the display order of the answers might change depending on votes, etc. So the way to do have a follow up question is to either edit the original, and then leave a @mention on a comment so that the person gets a notification, or to post it as a new question, with a link to the other. 1/2 $\endgroup$ Oct 4, 2021 at 23:23
  • 1
    $\begingroup$ @ James - but here's a quick overview; yes, it is a kind of projection and "the real information is stored actually different internally" is more or less correct; the objection by PM 2Ring is that the box doesn't examine the qubit in the physical measurement sense, it's just that it affects a qubit that's in a particular state in this way. So, it doesn't differentiate it physically, but you could say that it does differentiate it mathematically; the "knowledge" is encoded in the properties/construction of the box (it's not an irreversible function, until you do the measurement). 2/2 $\endgroup$ Oct 4, 2021 at 23:23
  • 1
    $\begingroup$ @ James - P.S. another point; because there are other ways for the qubit state to become "1:30", it doesn't mean that the original state was white or black (e.g. any other state could have been transformed by some other gate to "1:30") - the Hadamard gate doesn't know the history; it just transforms "1:30" to "3:00", and also happens to transform "3:00" to "1:30". $\endgroup$ Oct 4, 2021 at 23:30

Your Answer

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