Maths
There is a lot more to a qubitโs state than just itโs probability however. Each qubit on its own is stored with two numbers. (
It gets even more complicated when qubits interact with each other.)

If you square the top number, you get the probability that when
measured, this qubit will be on. If you square the bottom number, you get the probability that when
measured, this qubit will be off.
These numbers can also be negative or complex. (If it is complex, the magnitude squared is the probability.)
Maths
The
not gate (and most other gates) can be represented by a matrix.

When you apply the gate, you multiply the matrix for the gate by the
vector for the qubit.
Maths
The
hadamard gate (and most other gates) can be represented by a matrix.

When you apply the gate, you multiply the matrix for the gate by the
vector for the qubit.
Notice if you apply a
hadamard gate to (โ0.5 ๐๐น๐น+ โ0.5 ๐๐), the ๐๐s cancel, making the qubit 100% off.
Notice also that applying the
hadamard gate twice will always do nothing.
Maths
When there are two qubits involved instead of each being represented by a
2d vector we represent both in one 4d vector.

Thus a
controlled not gate can be written using the following matrix: