iLabs

Shunya / Probability & Statistics

Shunya · Maths lab

Probability & statistics

Build a sample space, tap together an event, and watch P(E) update live. Flip coins and roll dice thousands of times and watch chance settle onto the theory. Draw balls from a bag with and without replacement, drag data points to see the mean, median and mode react, work with grouped data and the ogive, then explore how binomial and normal distributions take shape.

The maths behind it

What each mode covers

Coins & dice — flip one or two coins (fair or biased) or roll one or two dice up to 100,000 times. Bars show what happened, orange marks show the theory, and the running-frequency graph shows the law of large numbers. Class 9 and 10 probability.
Bag of balls — draw two balls from a bag you fill, with or without replacement. A tree of every outcome shows the exact fractions, and a simulation checks them. Conditional probability and the multiplication rule, class 12.
Bayes' theorem — a tree of 10,000 people (or items, or draws) for a medical test, three machines or three urns. Change the priors and likelihoods and see the total probability and the posterior P(cause | evidence) update, then check it by simulation. In Probability, a second event B gives conditional probability and the independence test. Class 12.
Random variable — a probability distribution as a bar chart (a die, two dice, coin tosses, a game, or your own weights) with its mean, variance and standard deviation, and a Y = aX + b change of variable. Class 12.
Poisson — the number of rare, independent events in an interval at an average rate λ, with the probabilities, the cumulative shading, a simulation and a comparison with the binomial it is the limit of. Class 12.
Mean, median, mode — type your own numbers or drag dots to see the mean, median, mode, range, quartiles, variance and standard deviation react, with a box plot. Class 9 and class 11 statistics.
Grouped data — a histogram whose bars you drag, with the mean, median and mode from the class formulas, a frequency polygon and the less-than ogive. Class 10 statistics.
Binomial — choose n and p, read P(X = k), the cumulative probability, the mean and variance, and compare simulated experiments and the normal curve. Class 12 probability distributions.
Normal curve — set the mean and standard deviation, drag two points to shade the area between them, see the 68–95–99.7 rule and draw random samples. A first look beyond the core class 12 syllabus.

Part of Shunya. See the syllabus map for the chapters these modes map to. Also try the Function & Graph Explorer. Random experiments use your browser's random number generator, so every run is different.

Formulas used in this lab

Experimental probability Class 9

Experimental probability
P(E)=trials in which E happenedtotal number of trialsP(E) = \dfrac{\text{trials in which } E \text{ happened}}{\text{total number of trials}}
Expected number of times in n trials
n×P(E)n \times P(E)
Difference from the theoretical value
∣ experimental P−theoretical P ∣\bigl|\,\text{experimental } P - \text{theoretical } P\,\bigr|
Law of large numbers
experimental P(E)⟶theoretical P(E) as n grows\text{experimental } P(E) \longrightarrow \text{theoretical } P(E) \text{ as } n \text{ grows}

Probability of an event Class 10

Equally likely outcomes
P(E)=number of favourable outcomestotal number of outcomesP(E) = \dfrac{\text{number of favourable outcomes}}{\text{total number of outcomes}}
Range of a probability
0≤P(E)≤1,P(impossible)=0,P(certain)=10 \le P(E) \le 1,\qquad P(\text{impossible}) = 0,\qquad P(\text{certain}) = 1
Complement
P(not E)=1−P(E)P(\text{not } E) = 1 - P(E)
All outcomes together
∑P(outcome)=1\sum P(\text{outcome}) = 1
Two dice, sum s (out of 36 pairs)
P(sum=s)=6−∣s−7∣36,2≤s≤12P(\text{sum} = s) = \dfrac{6 - |s - 7|}{36},\qquad 2 \le s \le 12
Two tosses of a coin with P(H) = p
P(0 H)=q2,P(1 H)=2pq,P(2 H)=p2,q=1−pP(0\text{ H}) = q^2,\quad P(1\text{ H}) = 2pq,\quad P(2\text{ H}) = p^2,\quad q = 1 - p

Mean, median and mode Class 9

Mean
xˉ=∑xn\bar{x} = \dfrac{\sum x}{n}
Median, n odd (the middle value of the sorted list)
(n+12)th value\left(\dfrac{n + 1}{2}\right)\text{th value}
Median, n even
(n2)th value+(n2+1)th value2\dfrac{\left(\frac{n}{2}\right)\text{th value} + \left(\frac{n}{2} + 1\right)\text{th value}}{2}
Mode (there can be more than one, or none)
most frequent value\text{most frequent value}
Range
largest−smallest\text{largest} - \text{smallest}

Grouped data Class 10

Class mark and class width
x=l+u2,h=u−lx = \dfrac{l + u}{2},\qquad h = u - l
Mean (direct method)
xˉ=∑fx∑f\bar{x} = \dfrac{\sum f x}{\sum f}
Median
Median=l+n2−cff×h\text{Median} = l + \dfrac{\frac{n}{2} - cf}{f} \times h
Mode
Mode=l+f1−f02f1−f0−f2×h\text{Mode} = l + \dfrac{f_1 - f_0}{2f_1 - f_0 - f_2} \times h
Empirical relation
Mode≈3 Median−2 Mean\text{Mode} \approx 3\,\text{Median} - 2\,\text{Mean}
Median class (the first class with cumulative frequency at least n/2)
cf≥n2cf \ge \dfrac{n}{2}

Spread: quartiles, variance and standard deviation Class 11

First quartile (median of the lower half)
Q1=median(lower half)Q_1 = \text{median}(\text{lower half})
Third quartile (median of the upper half)
Q3=median(upper half)Q_3 = \text{median}(\text{upper half})
Interquartile range
IQR=Q3−Q1\text{IQR} = Q_3 - Q_1
Variance
σ2=∑(x−xˉ)2n\sigma^2 = \dfrac{\sum (x - \bar{x})^2}{n}
Standard deviation
σ=σ2\sigma = \sqrt{\sigma^2}

Conditional probability and independent events Class 12

Multiplication rule
P(A∩B)=P(A) P(B∣A)P(A \cap B) = P(A)\,P(B \mid A)
Conditional probability
P(B∣A)=P(A∩B)P(A)P(B \mid A) = \dfrac{P(A \cap B)}{P(A)}
Independent events
P(A∩B)=P(A) P(B)P(A \cap B) = P(A)\,P(B)
Two draws with replacement
P(both red)=rN×rNP(\text{both red}) = \dfrac{r}{N}\times\dfrac{r}{N}
Two draws without replacement
P(both red)=rN×r−1N−1P(\text{both red}) = \dfrac{r}{N}\times\dfrac{r - 1}{N - 1}
Same colour, and its complement
P(same)=P(RR)+P(BB)+P(GG),P(different)=1−P(same)P(\text{same}) = P(RR) + P(BB) + P(GG),\qquad P(\text{different}) = 1 - P(\text{same})

Total probability and Bayes' theorem Class 12

Multiplication rule
P(E∩B)=P(B) P(E∣B)=P(E) P(B∣E)P(E \cap B) = P(B)\,P(E \mid B) = P(E)\,P(B \mid E)
Addition rule
P(E∪B)=P(E)+P(B)−P(E∩B)P(E \cup B) = P(E) + P(B) - P(E \cap B)
Independent events
P(E∩B)=P(E) P(B), equivalently P(E∣B)=P(E)P(E \cap B) = P(E)\,P(B), \text{ equivalently } P(E \mid B) = P(E)
Partition
H1,…,Hn mutually exclusive and exhaustive: P(H1)+⋯+P(Hn)=1H_1,\dots,H_n \text{ mutually exclusive and exhaustive: } P(H_1)+\dots+P(H_n) = 1
Total probability
P(E)=P(H1)P(E∣H1)+⋯+P(Hn)P(E∣Hn)P(E) = P(H_1)P(E \mid H_1) + \dots + P(H_n)P(E \mid H_n)
Bayes' theorem
P(Hi∣E)=P(Hi) P(E∣Hi)∑jP(Hj) P(E∣Hj)P(H_i \mid E) = \dfrac{P(H_i)\,P(E \mid H_i)}{\sum_j P(H_j)\,P(E \mid H_j)}

Binomial distribution Class 12

Probability of k successes in n trials
P(X=k)=(nk)pkqn−k,q=1−pP(X = k) = \binom{n}{k} p^k q^{n-k},\qquad q = 1 - p
Binomial coefficient
(nk)=n!k! (n−k)!\binom{n}{k} = \dfrac{n!}{k!\,(n - k)!}
At most k successes
P(X≤k)=∑i=0kP(X=i)P(X \le k) = \sum_{i=0}^{k} P(X = i)
At least k successes
P(X≥k)=1−P(X≤k−1)P(X \ge k) = 1 - P(X \le k - 1)
Mean, variance and standard deviation
μ=np,σ2=npq,σ=npq\mu = np,\qquad \sigma^2 = npq,\qquad \sigma = \sqrt{npq}
Most likely value
⌊(n+1)p⌋\lfloor (n + 1)p \rfloor
Normal curve fits well when
np≥5  and  nq≥5np \ge 5 \ \text{ and } \ nq \ge 5

Normal distribution Class 12

Density of the normal curve
f(x)=1σ2π e−(x−μ)22σ2f(x) = \dfrac{1}{\sigma\sqrt{2\pi}}\, e^{-\frac{(x - \mu)^2}{2\sigma^2}}
Standardising (z-score)
z=x−μσz = \dfrac{x - \mu}{\sigma}
Probability between a and b
P(a<X<b)=Φ(zb)−Φ(za)P(a < X < b) = \Phi(z_b) - \Phi(z_a)
The 68 – 95 – 99.7 rule
P(∣X−μ∣<σ)≈0.6827,P(∣X−μ∣<2σ)≈0.9545,P(∣X−μ∣<3σ)≈0.9973P(|X - \mu| < \sigma) \approx 0.6827,\quad P(|X - \mu| < 2\sigma) \approx 0.9545,\quad P(|X - \mu| < 3\sigma) \approx 0.9973
Total area under the curve
∫−∞∞f(x) dx=1\int_{-\infty}^{\infty} f(x)\,dx = 1

Random variables and the Poisson distribution Class 12

Probability distribution
pi≥0,∑ipi=1p_i \ge 0,\qquad \sum_i p_i = 1
Mean (expected value)
E(X)=μ=∑ixi piE(X) = \mu = \sum_i x_i\,p_i
Variance and standard deviation
Var⁡(X)=E(X2)−[E(X)]2=∑xi2pi−μ2,σ=Var⁡(X)\operatorname{Var}(X) = E(X^2) - [E(X)]^2 = \sum x_i^2 p_i - \mu^2,\qquad \sigma = \sqrt{\operatorname{Var}(X)}
Linear change of variable
E(aX+b)=aE(X)+b,Var⁡(aX+b)=a2Var⁡(X)E(aX + b) = aE(X) + b,\qquad \operatorname{Var}(aX + b) = a^2\operatorname{Var}(X)
Poisson probability
P(X=k)=e−λλkk!,k=0,1,2,…P(X = k) = \dfrac{e^{-\lambda}\lambda^k}{k!},\quad k = 0, 1, 2, \dots
Mean and variance of Poisson
E(X)=Var⁡(X)=λE(X) = \operatorname{Var}(X) = \lambda
Poisson as a limit of the binomial
(nk)pk(1−p)n−k→e−λλkk! as n→∞, np=λ\binom nk p^k(1-p)^{n-k} \to \dfrac{e^{-\lambda}\lambda^k}{k!}\ \text{as } n\to\infty,\ np = \lambda