In probability theory, an event happens almost surely (a.s.) if it happens with probability one. The concept is analogous to the concept of "almost everywhere" in measure theory. It is often encountered in questions that involve infinite time, infinite-dimensional spaces such as function spaces, or infinitesimals.
"Almost sure" versus "sure"
The difference between an event being almost sure and sure is the same as the subtle difference between something happening with probability 1 and happening always.
If an event is sure, then it will always happen. No other event (even events with probability 0) can possibly occur. If an event is almost sure, then there are other events that could happen, but they happen almost never, that is with probability 0. While in the case of finitely many possible outcomes probability 0 is equivalent to never, infinite sequences of events, or a continuum of outcomes, allow outcomes that are zero-probability yet possible.
Example: Throwing a dart
For example, imagine throwing a dart at a unit square, and imagine that this square is the only thing in the universe. There is physically nowhere else for the dart to land. Then, the event that "the dart hits the square" is a sure event. No other alternative is imaginable.
Next, consider the event that "the dart hits the diagonal of the unit square exactly". The probability that the dart lands on any subregion of the square is equal to the area of that subregion. But, since the area of the diagonal of the square is zero, the probability that the dart lands exactly on the diagonal is zero. So, the dart will almost surely not land on the diagonal, or indeed any other given line or point. Notice that even though there is zero probability that it will happen, it is still possible.
Example: Tossing a coin
Suppose that a fair coin is flipped again and again. The infinite sequence of all heads (H-H-H-H-H-H-…), ad infinitum, is possible in some sense—it does not violate any physical or mathematical laws to suppose that tails never appears—but it is very, very improbable. In fact, such a sequence has probability zero. Thus, there will almost surely be at least a single tails flip in an infinite sequence of flips.
However, if instead of an infinite number of flips we stop flipping after some finite time, say a million flips, then the all-heads sequence has non-zero probability. If heads and tails are equiprobable, then the all-heads sequence has probability 2−1,000,000, thus the probability of getting a tails is 1 − 2−1000000 ≠ 1, and the event is no longer almost sure.
- Convergence of random variables, for "almost sure convergence"
- Constant random variable, for "almost surely constant"
- Almost everywhere, the corresponding concept in measure theoryda:Næsten sikkert