Finding the sample size
In Year 12 Mathematical Methods (Queensland, QCAA), finding the sample size means finding \(n\), the number of independent Bernoulli trials, so that a binomial condition holds. Most often you want \(P(\text{at least one success})=1-(1-p)^{n}\) to reach a target \(c\): solve \(1-(1-p)^{n}\ge c\) for \(n\) with logarithms and round up. You also find \(n\) from an expected count \(np\), and find \(n\) and \(p\) from the binomial mean \(np\) and variance \(np(1-p)\).
A binomial random variable \(X\sim B(n,p)\) counts the number of successes in \(n\) independent Bernoulli trials, each with the same success probability \(p\). When \(n\) is the unknown and you are told a condition the distribution must satisfy, the task is to find the sample size \(n\).
The most common condition uses the complement. In one trial \(P(\text{no success})=1-p\), so in \(n\) independent trials \(P(\text{no successes})=(1-p)^{n}\) and
This probability increases towards \(1\) as \(n\) grows (each extra trial can only raise it), so requiring it to reach a target \(c\) gives an inequality you solve for \(n\). Because \(n\) is a whole number of trials, you round up.
Two other "find \(n\)" tasks appear: finding \(n\) so an expected count \(np\) meets a threshold, and finding \(n\) and \(p\) together from the binomial mean \(np\) and variance \(np(1-p)\).
| \(\mu\) | \(=\) | \(np\) |
| \(\sigma^{2}\) | \(=\) | \(np(1-p)\) |
| \(\dfrac{\sigma^{2}}{\mu}\) | \(=\) | \(1-p\) |
Probability of at least one success in \(n\) trials:
Solving the "at least one" condition for \(n\) (note the inequality reverses when dividing by \(\log(1-p)<0\)):
Binomial mean and variance (for finding \(n\) and \(p\)):
How to find the sample size
- Write the condition. For "at least one success", use \(P(\text{at least one})=1-(1-p)^{n}\) and set it \(\ge\) (or \(>\)) the target \(c\).
- Isolate the power. Rearrange to \((1-p)^{n}\le 1-c\) (or \(<1-c\)).
- Take logarithms and divide. \(n\log(1-p)\le \log(1-c)\); dividing by \(\log(1-p)\) (which is negative) reverses the inequality: \(n\ge \dfrac{\log(1-c)}{\log(1-p)}\).
- Round up. Take the smallest whole number of trials that satisfies the inequality.
- From mean and variance instead: divide \(\sigma^{2}\) by \(\mu\) to get \(1-p\) (hence \(p\)), then \(np=\mu\) gives \(n\). From an expected count: set \(np\ge m\) and solve, then round up.
| \(1-0.5^{n}\) | \(\ge\) | \(0.95\) |
| \(0.5^{n}\) | \(\le\) | \(0.05\) |
| \(n\) | \(\ge\) | \(\dfrac{\log 0.05}{\log 0.5}=4.32\ldots\) |
Round up: \(n=\mathbf{5}\) tosses.
| \(1-p=\dfrac{\sigma^{2}}{\mu}\) | \(=\) | \(\dfrac{9.6}{12}=0.8\) |
| \(p\) | \(=\) | \(0.2\) |
| \(n\times 0.2=12\Rightarrow n\) | \(=\) | \(60\) |
So \(p=\mathbf{0.2}\) and \(n=\mathbf{60}\).
| \(1-\left(\tfrac{5}{6}\right)^{n}\) | \(\ge\) | \(0.90\) |
| \(\left(\tfrac{5}{6}\right)^{n}\) | \(\le\) | \(0.10\) |
| \(n\) | \(\ge\) | \(\dfrac{\log 0.10}{\log(5/6)}=12.6\ldots\) |
Round up: \(n=\mathbf{13}\) rolls.
| \(E(X)=np\) | \(=\) | \(0.4\,n\) |
| \(0.4\,n\) | \(\ge\) | \(30\) |
| \(n\) | \(\ge\) | \(75\) |
So \(n=\mathbf{75}\) items must be sampled.
Common pitfalls
Frequently asked questions
What is the "sample size" here?
It is \(n\), the number of independent Bernoulli trials, chosen so that a binomial condition (usually about at least one success) holds.
Why is \(P(\text{at least one})=1-(1-p)^{n}\)?
By the complement: the only way to avoid "at least one" is "none", and \(P(\text{none})=(1-p)^{n}\) for \(n\) independent trials.
How do I solve \(1-(1-p)^{n}\ge c\)?
Rearrange to \((1-p)^{n}\le 1-c\), take logs, divide by \(\log(1-p)\) (reversing the inequality), then round up.
Why round up?
Because \(n\) must be a whole number and the probability increases with \(n\); the smallest whole number above the solution is the one that works.
How do I find \(n\) and \(p\) from the mean and variance?
Divide the variance by the mean to get \(1-p\) (hence \(p\)); then \(np=\mu\) gives \(n\).
Is this the normal-approximation sample size?
No. This is the exact binomial "find \(n\)" skill. Sample size from a normal approximation or a confidence interval for a proportion is a separate topic in sampling and interval estimates.