Home / Probability

Probability Basics

Roll dice thousands of times and watch the messy experimental frequencies settle onto the exact theoretical answer. Probability is what happens in the long run — not what happens next.

Controls


The chart compares the experimental frequency with the theoretical probability as trials accumulate.

Experimental Frequency vs Theory

law of large numbers

Live Calculation

P(A)
0
P(B)
0
P(A and B)
0
P(A or B)
0
Sample space — every equally likely outcome

Overview

Events and their probabilities

A sample space lists possible outcomes; an event is a subset of those outcomes. For a fair six-sided die, the event “roll an even number” has three outcomes, so its probability is 3/6 = 1/2. The complement has probability P(Aᶜ) = 1 − P(A).

For any events A and B, the addition rule is P(A ∪ B) = P(A) + P(B) − P(A ∩ B). The overlap must be subtracted because it is counted twice. If A and B are mutually exclusive, the overlap is empty and the simpler sum applies.

Probability Basics

Probability assigns numbers from 0 to 1 to events, with rules for combining uncertainty consistently.

Independence and repeated trials

A and B are independent when learning that one occurred does not change the probability of the other: P(A ∩ B) = P(A)P(B). Independence is an assumption about the process, not a consequence of events being different. For independent coin tosses, the probability of two heads is 1/2 × 1/2 = 1/4.

Repeated independent trials with the same success probability lead to the binomial model; see Bernoulli, binomial, and Poisson distributions. When information changes the probability, use conditional probability and Bayes’ theorem.

Long-run frequency is not a guarantee

The law of large numbers says sample averages converge toward their expected value under suitable assumptions as the number of trials grows. It does not say short runs must balance out: a streak of tails does not make heads “due.”

How to combine events without confusing the rules

The addition rule is for “A or B”: add their probabilities, then subtract the overlap because it was counted twice. The multiplication rule is for “A and B”: use P(A ∩ B)=P(A)P(B|A). Only for independent events does this become P(A)P(B). For one fair die, let A mean “even” and B mean “greater than 3.” Then P(A)=3/6, P(B)=3/6, and P(A ∩ B)=2/6. So P(A ∪ B)=3/6+3/6−2/6=4/6. The events overlap and are not independent: knowing the result is even changes the chance it exceeds 3. Listing the outcomes first is a useful way to verify the calculation.

These rules rely on a probability model that matches the process. If a die is biased or outcomes are sampled without replacement, equal-likelihood or independence assumptions may fail. Write down what is being randomized before choosing a formula; see conditional probability when what is already known changes the calculation.

Try this above

Change the event probabilities or trial count in the visualiser. Compare a single outcome with the distribution of many repeated trials.

A probability can be specified from a theoretical model, estimated from repeated observations, or assigned from expert information; those are different sources of uncertainty. Long-run relative frequency is one way to assess a model, but a finite sample will not match the probability exactly. For events, complements are often easier to calculate: “at least one success” is 1−P(no successes). This shortcut is especially useful in repeated independent trials. A probability model should describe the sampling mechanism, not just the outcomes observed so far.

Sources and next steps

Predict, then reveal

About to run: switch Experiment to Flip three coins (heads count). Before it does — what happens to the readout?

Committing to an answer first is the point — the reveal runs the experiment on the visualisation above and reads the real value back, so nothing here is scripted.

Check yourself

0 of 3

Answer without scrolling back up.

  1. Two fair coin flips. What is the probability of two heads?

  2. P(A|B) means:

  3. A test is 99% accurate for a disease affecting 1 in 10,000 people. You test positive. Roughly how worried should you be?

Cheat sheet

Probability Basics

Count outcomes, combine events with addition and multiplication rules, and see why a fair coin owes you nothing after ten heads.

MATHS · vizlearn.in/maths/probability_basics.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.