Search code examples
measurementquantum-computing

Hadamard gate returns same result which is different from my expects


I meausred some states after approve hadamard gate. I guess that after measuremnt and because of properties of hadamard gate,

The measurement result will always different. But after I checked , the result is always same

=> After approve hadamard gate at q_0 gate at 2 qubits

=> After approve hadamard gate at q_2 gate at 3 qubits

=> After approve hadamard gate at q_1 gate at 3 qubits

=> After approve hadamard gate at q_0 gate at 3 qubits

I learned that hadamard gate yieds same probabilities of each state. But the measurement result always returns same.


Solution

  • You have to understand what we really mean by probability first. Let me give you an example : probability of getting head on a coin is 1/2. What this means is that if we flip the coin lets say 1000 times, almost half the times we will get heads. It doesnt mean if we flip it once then half the coin will be head and other half tails. Thus is a long run, the distribution of heads and tails might be something like 509(heads) and 491(tails) but there will be stretches where coin will flip 10 straight heads.

    Now to HADAMARD. Hadamard creates an equal probability for 1 and 0 when applied to ket 0. This means when you measure it, it has a fifty percent probability of getting you 0 and other fifty for getting you 1. thus you can get 10 straight ket 0s when measuring but if you do it for 1000 times, distribution becomes equal. This is why when we use real quantum computers or even simulators, we adjust something called 'shots' to a large number. And that number is how many times that circuit is measured and we get an idea of what quantum state was.

    GO to 'set up and run' on composer and you'll understand rest.