iLabs Shunya

Shunya / Probability & Statistics

Shunya · Maths lab

Probability & statistics

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.
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 Ptheoretical 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
0P(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)=1P(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)=6s736,2s12P(\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=1pP(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
largestsmallest\text{largest} - \text{smallest}

Grouped data Class 10

Class mark and class width
x=l+u2,h=ulx = \dfrac{l + u}{2},\qquad h = u - l
Mean (direct method)
xˉ=fxf\bar{x} = \dfrac{\sum f x}{\sum f}
Median
Median=l+n2cff×h\text{Median} = l + \dfrac{\frac{n}{2} - cf}{f} \times h
Mode
Mode=l+f1f02f1f0f2×h\text{Mode} = l + \dfrac{f_1 - f_0}{2f_1 - f_0 - f_2} \times h
Empirical relation
Mode3Median2Mean\text{Mode} \approx 3\,\text{Median} - 2\,\text{Mean}
Median class (the first class with cumulative frequency at least n/2)
cfn2cf \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=Q3Q1\text{IQR} = Q_3 - Q_1
Variance
σ2=(xxˉ)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(AB)=P(A)P(BA)P(A \cap B) = P(A)\,P(B \mid A)
Conditional probability
P(BA)=P(AB)P(A)P(B \mid A) = \dfrac{P(A \cap B)}{P(A)}
Independent events
P(AB)=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×r1N1P(\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)=1P(same)P(\text{same}) = P(RR) + P(BB) + P(GG),\qquad P(\text{different}) = 1 - P(\text{same})

Binomial distribution Class 12

Probability of k successes in n trials
P(X=k)=(nk)pkqnk,q=1pP(X = k) = \binom{n}{k} p^k q^{n-k},\qquad q = 1 - p
Binomial coefficient
(nk)=n!k!(nk)!\binom{n}{k} = \dfrac{n!}{k!\,(n - k)!}
At most k successes
P(Xk)=i=0kP(X=i)P(X \le k) = \sum_{i=0}^{k} P(X = i)
At least k successes
P(Xk)=1P(Xk1)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
np5  and  nq5np \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