Probability and Statistics
Rolling the dice…
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
Probability and Statistics
Rolling the dice…
Probability is counting with weights; statistics is reasoning back from data. Roll dice, test a thousand people, drop balls through a Galton board and watch averages settle — every simulation here is seeded, so you can replay it.
All 36 rolls of two dice on one grid and the 8 paths of three coins. Events are sets of outcomes — highlight them, then take unions, intersections and complements.
P(E) = |E| / |Ω|Counting PrincipleEqually Likely OutcomesKnowing B happened shrinks the sample space to B. See it on the dice grid, then drag the splits of an area model and watch P(A | B) change.
P(A | B) = P(A ∩ B) / P(B)Sample Spaces and EventsShrinking the SpaceA thousand people, a rare condition and a good test. Slide the base rate, sensitivity and false-positive rate and see why most positives are false alarms.
P(H | E) = P(E | H) P(H) / P(E)Conditional ProbabilityUpdating BeliefsA distribution as bars on a beam. The expected value is where it balances, and the variance measures how far the weight sits from that point. Drag the bars.
E[X] = ∑ x · p(x)Sample Spaces and EventsWeighted AverageBalls bounce left or right through a Galton board and pile up in bins. The pile takes the shape of C(n, k) pᵏ (1 − p)ⁿ⁻ᵏ — change n and p and drop more.
P(X = k) = C(n, k) pᵏ (1 − p)ⁿ⁻ᵏRandom Variables and ExpectationRepeated TrialsSlide μ and σ, drag two points along the axis, and read off the area between them. The 68–95–99.7 rule and z-scores fall out of one curve.
f(x) = e^(−(x − μ)² / 2σ²) / (σ√(2π))Binomial DistributionContinuous DensityRoll a die thousands of times and track the running average. It wanders at first, then settles on 3.5 inside a band that narrows like 1 / √n.
X̄ₙ → μ as n → ∞Random Variables and ExpectationConvergenceDraw samples from a lopsided distribution and average each one. The averages pile up into a bell curve whose width shrinks as σ / √n.
X̄ₙ ≈ N(μ, σ² / n)Law of Large NumbersSampling DistributionWith only 23 people the chance of a shared birthday passes 50%. The exact curve against a seeded simulation, and the pairs that explain it.
P = 1 − ∏ (365 − i) / 365Sample Spaces and EventsComplement CountingA 99%-accurate test, a room of 23 people, a streak of heads — the obvious answer is usually wrong. A picture of the whole sample space is the fastest fix.
Hashing, quicksort's pivot, Bloom filters, load balancing and A/B tests all rest on expectation, variance and the way averages concentrate.
Every metric, survey and benchmark is a sample. The law of large numbers and the central limit theorem say how much one can be trusted.