I came to this problem and I cannot understand if the answer given to it in the book is wrong or if I am making some mistake while computing.
Problem: A fair coin is given ($p=1/2$, $q=1-p=1/2$). Then n flips with this coin are made. How large should $n$ be so that the probability of the number of heads being between $0.48n$ and $0.52n$ is $0.9$?
This problem is in a chapter about approximating the binomial distribution either with normal or with Poisson distribution.
First of all, I want to note that I understand this question as being about $P \geq 0.9$. I guess that's the only way one can understand the problem statement. Right?
So OK... Let X be the number of heads. I don't think Poisson approximation should be applied here (for several reasons) so I approximated here with normal distribution using this formula:
$P( 0.48n \leq X \leq 0.52n) \approx \Phi (\frac{0.52n - np}{\sqrt{npq}}) - \Phi (\frac{0.48n - np}{\sqrt{npq}})$
(note: here $\Phi$ is the CDF of the standard normal)
Then after working this out it leads me to:
$\Phi (\frac{4}{100}\sqrt{n}) >= 0.95$
From this and the CDF table of the standard normal I find:
$\frac{4}{100}\sqrt{n} >= 1.65$
The last one gives me:
$\sqrt{n} >= 41.25$
and then taking into account that $n$ is a natural number I get:
$n >= 1702$
But the answer given in the book is $n=1682$.
Which answer is correct? Am I making some mistake here?
Neither answer is correct in the sense of the exact value. The smallest $n$ such that $\Pr[0.48n \le X \le 0.52n] \ge 0.9$ where $X \sim \operatorname{Binomial}(n, p = 1/2)$ is $n = 1650$, since $$2^{-1650} \sum_{x=792}^{858} \binom{1650}{x} \approx 0.900969$$ and this is is the least $n$ for which $$g(n) = 2^{-n} \sum_{x=\lceil 0.48 n \rceil}^{\lfloor 0.52 n \rfloor} \binom{n}{x} \ge 0.9.$$ In other words, $n = 1650$ is the smallest sample size for which the desired probability is at least $0.9$.
The smallest $n$ such that $\Pr[0.48n' \le X \le 0.52n' \ge 0.9]$ for all $n' \ge n$, is $n = 1724$, because $$g(1723) = 2^{-1723} \sum_{x=828}^{895} \binom{1723}{x} \approx 0.898647,$$ and for no larger value of $n$ does $g(n)$ ever have a value strictly less than $0.9$. In other words, $n = 1724$ is the smallest sample size for which all samples at least as large will ensure the desired probability exceeds $0.9$. The reason for this phenomenon has to do with the fact that the binomial distribution is discrete, and $0.48n$ and $0.52n$ are not always integers for every integer $n$. A plot of $g(n)$ for each $n$ in $\{1640, \ldots, 1730\}$ is provided below:
Because neither of these values are the claimed value, we conclude that some kind of approximation was applied to make the computation simpler. The normal approximation to the binomial is customary; in such a case, $$Z = \frac{X - n/2}{\sqrt{n/4}}$$ is approximately standard normal. Then $$g(n) = \Pr[0.48n \le X \le 0.52n] \approx \Pr\left[ \frac{-0.02n}{\sqrt{n/4}} \le Z \le \frac{0.02n}{\sqrt{n/4}} \right] = \Pr[|Z| \le 0.04 \sqrt{n}] \\ = 2\Phi(0.04 \sqrt{n}) - 1$$ where $\Phi$ is the CDF of the standard normal distribution. Hence we require $$0.04 \sqrt{n} \ge \Phi^{-1}(0.95) = 1.64485$$ or $$n \ge 1690.96.$$ But this computation ignores the fact that when $n = 1691$, the boundary $[0.48n, 0.52n]$ is not integral. You can see this in the plot below, which is identical to the one above except the normal approximation to the binomial is represented as the black dashed line: