# Cannot derive probability graph for Hadamard gate given in Qiskit textbook

I am reading the Qiskit textbook(beta) and they have explained Hadamard gate using an amplitude tree. To show how two H-gates on a qubit give the output as 0 everytime they said to consider that it reverses the direction of the qubit when the input and output state of the qubit is 1.(as shown in the image below)

Following this, if we apply 2 H-gates on a qubit in state 1, the output they said would similarly always be 1 but when I made that tree, it again came out as 0 as shown below.

Edit: My conclusion about the H-gate stated as "it reverses the direction of the qubit when the input and output state of the qubit is 1" was the wrong idea that led to the incorrect amplitude tree. You can find the correction pointed out in the answer marked correct.

• In the future, please include a link to the page you are referencing so that anyone trying to help does not have to go search it out for themselves! I have included the link in my response by putting [square brackets around the words that will be the link](with the website in round brackets beside it). Hope this helps! Commented Oct 6, 2022 at 15:03
• Got it. And thanks!
– Rai
Commented Oct 6, 2022 at 15:12

Edit: Starting with $$|1\rangle$$ The mistake is in the bottom right of your diagram. After your first Hadamard gate, the structure of the diagram leaving the $$|1\rangle$$ must be identical to what you did in the first Hadamard of your diagram. (Hadamard acts on $$|1\rangle$$ the same every time, so the diagram is the same.) With this change you should get the amplitude 1 for $$|1\rangle$$ and 0 for $$|0\rangle$$