Confidence interval for μ when σ2 is known
If \(\{X_1, X_2,\dots, X_n\}\) is a random sample from a \(\NormalDistn(\mu, \sigma^2)\) distribution and the population variance, \(\sigma^2\), is known, then
\[ \overline{X} \;\;\sim\;\; \NormalDistn(\mu,\;\frac{\sigma^2}{n}) \]and
\[ \frac{\overline{X} - \mu}{\diagfrac{\sigma}{\sqrt{n}}} \;\;\sim\;\; \NormalDistn(0,\;1) \]is a pivot for the parameter \(\mu\). Since
\[ P\left(-1.96 \;\;\lt\;\; \frac{\overline{X} - \mu}{\diagfrac{\sigma}{\sqrt{n}}} \;\;\lt\;\; 1.96 \right) \;\;=\;\;0.95 \]we get the following 95% confidence interval for \(\mu\)
\[ \overline{X} -1.96 \frac{\sigma}{\sqrt{n}} \;\;\lt\;\; \mu \;\;\lt\;\; \overline{X} +1.96 \frac{\sigma}{\sqrt{n}} \]Intervals with other confidence levels can be obtained by replacing 1.96 with other quantiles from the standard normal distribution.
Unknown σ2
However in most situations when a random sample is obtained from a normal distribution, the distribution's variance, \(\sigma^2\), is an unknown value, so this method does not work. However a pivot can still be found by replacing the unknown \(\sigma^2\) by the sample variance, \(S^2\).
Pivot for μ when σ² is unknown
If \(\overline{X}\) and \(S^2\) are the mean and variance of a random sample of size \(n\) from a \(\NormalDistn(\mu, \sigma^2)\) distribution,
\[ \frac{\overline{X} - \mu}{\diagfrac{S}{\sqrt{n}}} \;\;\sim\;\; \TDistn(n-1 \text{ df}) \]is a pivot for the parameter \(\mu\).
Since the numerator has a standard normal distribution, the denominator involves a Chi-squared distribution, and the sample mean and variance are independent,
\[ \frac{\overline{X} - \mu}{\diagfrac{S}{\sqrt{n}}} \;\sim\; \frac{\NormalDistn(0,\;1)}{\sqrt{\Large \frac {\ChiSqrDistn(n-1\text{ df})}{n-1}}} \;=\; \TDistn(n-1\text{ df}) \]Since the distribution does not involve any unknown parameters, this proves that we have a pivot.