# On the theory behind confidence intervals exercises

I have something wrong in my understanding of the theory behind confidence intervals, as an example I have an exercise that states:

A sample of size $n = 100$ produced the sample mean of $\hat{X} = 16$. Assuming the population standard deviation is $\sigma = 3$ , compute a 95% confidence interval for the population mean $\mu$.

Now my reasoning is the following:

I know from the central limit theorem that $\frac{\hat{X} - \mu}{\sigma / \sqrt{n}}$ is going to approximately normally distributed. I am looking for an $a$ s.t. $P(-a < \mu < a) = 0.95$ (since I know the distribution is symmetrical) but

$$P(-a < \mu < a) = P(-a < -\mu < a) = P(\frac{-a + \hat{X}}{\sigma / \sqrt{n}} < -\mu < \frac{+a + \hat{X}}{\sigma / \sqrt{n}})$$

So now I just need to look up in a $z$-table the value of $\frac{+a + \hat{X}}{\sigma / \sqrt{n}}$ and divide it by two since the distribution is symmetric.

I realized while writing this that probably saying $P(-a < \mu < a) = 0.95$ makes no sense since the mean of the population is not a random quantity but a fixed constant. I will leave my previous reasoning so an answerer can better understand where I am getting confused.

Could someone explain to me the theoretical passages that solve this exercise and clear up my confusion?

I don't know what exactly the confusion is that you're having, but I'll try a step by step approach of how I mostly derive these confidence intervals. Basically, if we want to derive a confidence interval for $\mu$ where the variance $\sigma^2$ is unknown, then we can use the method you proposed above. Let us start by calculating a symmetric confidence interval for $\mu$. Note however, that $\bar{X}$ need not be normally distributed
\begin{align} 1-\alpha=\mathbb{P}[\frac{-c - \mu}{\frac{\sigma}{\sqrt{n}}} < \frac{\bar{X} - \mu}{\frac{\sigma}{\sqrt{n}}}< \frac{c - \mu}{\frac{\sigma}{\sqrt{n}}}] = \mathbb{P}[-z_{1-\alpha/2} < Z < z_{1-\alpha/2}] \end{align} Where $Z$ follows a standard normal distribution and $z_{1-\alpha/2}$ are the equal tailed critical values. Finally, you can now look up these critical values in any table or compute them. If you now want to know the confidence interval for $\mu$ you can simply start "working backwards".
In other words, your confidence interval for $\mu$ is given by: \begin{align} u \in \;( \bar{x} - z_{1-\alpha/2} \frac{\sigma}{n},\bar{x} + z_{1-\alpha/2} \frac{\sigma}{n}) \end{align} Where in this case, $\bar{x}$ is the realization for $\bar{X}$