Calculating a confidence interval In a random sample of $n=400$ people, 136 said they liked the product.
Construct a $95\%$ confidence interval for the population proportion who might like the product.
The sample proportion $\hat p$ is:
$$\hat p=\frac{136}{400}=0.34$$
My textbook says that the margin of error can be calculated from: $$E=\frac{1}{\sqrt{n}}=\frac{1}{\sqrt{400}}=0.05$$
But online I found another formula which goes like this:
$$E=z\frac{\sqrt{\hat p(1-\hat p)}}{\sqrt{n}}=1.96\frac{\sqrt{0.34(1-0.34)}}{\sqrt{400}}=0.046$$
Wow, both of these methods give similar results.
I don't understand where either formula comes from yet but would it be true to say that the second method is the correct approach and that the method in my textbook is a simplified approach? The first approach seems to assume a value of $\hat p =0.5$ and $z(95\%)=2$. I graphed the function $y=\sqrt{x(1-x)}$ and it seems to be a reasonable approximation in the range $0.3\le \hat p \le 0.7$.
So I conclude that the textbook formula can be used when $\hat p$ is close to $0.5$.
Any information that you think might help my understanding is welcome.
 A: The first formula $ME = 1/\sqrt{n}$ is more conservative than the second formula, guaranteeing a coverage probability of at least $95%, but the resulting interval is larger--sometimes much larger.
The usual formula is $$ME = z_{\alpha/2}^* \sqrt{\frac{\hat p(1-\hat p)}{n}},$$ where $z_{\alpha/2}^*$ is the upper $\alpha/2$ quantile of the standard normal distribution.  In your case, for a $95\%$ confidence interval, this corresponds to a choice $\alpha = 1 - 0.95 = 0.05$, and so we want the upper $2.5$ percentile of the standard normal, which is approximately $1.96$.  This just so happens to be a bit smaller than $2$, and because $\hat p(1-\hat p)$ for $0 \le \hat p \le 1$ is maximized when $\hat p = 1 - \hat p$ or $\hat p = 0.5$, the numerator $z \sqrt{\hat p (1-\hat p)}$ is bounded above by $1$.
But what this crude upper bound shows us is that it won't work if we were asked for a $90\%$ confidence interval, or a $99\%$ confidence interval, because the choice of $z^*_{\alpha/2}$ is different--in the $90\%$ case, it would be $z_{0.05}^* \approx 1.645$  and in the $99\%$ case it would be $z_{0.005}^* \approx 2.576$.
