Quantum computing takes advantage of quantum phenomena occurring between particles. One of them is superposition. This means that a particle is simultaneously in all possible states and only its reading results in a specific value. We can take advantage of this property by performing multiple calculations in parallel using the same particle to then quickly read out the correct result. Achieving such acceleration would not be possible using a classical machine.
Superposition is a state in which a qubit is in several states simultaneously. One of the gates that can create a superposition state is the Hadamard gate. Its matrix notation has the following form:
The value of 1/V2 has the chaaracter of normalizing the amplitudes to the value of 1. Note that the Hadamard gate acting on each of the 2 base states leads to a situation in which the probabilities of measuring states 0 and 1 are identical and equal to 50%.
Below is an example of a Hadamard gate circuit that will measure 0 and 1 at the output with a probability of 0.5.
In practice, since the code is run on a quantum computer simulator the actual distribution may differ from the theoretical one. An important parameter in this case is the number of runs of the circuit - the 'schots' parameter. Increasing it increases the accuracy of the results, but lengthens the calculations, especially for more complicated circuits