# Determining a sample size

1. Nov 21, 2015

### toothpaste666

1. The problem statement, all variables and given/known data

An investigator, interested in estimating a population mean, wants to be sure that the length of the 95% confidence interval does not exceed 5. What sample size should she use if σ = 18?

3. The attempt at a solution
the formula I found in my book is n = [(z_(α/2) σ)/E]^2

z_(α/2) = z.025 = 1.96

I am fairly certain if the length of the interval can't exceed 5, then 5 will be the max error so
E = 5
n = [1.96(18)/5]^2 = 49.8

Am I doing this correctly?

2. Nov 21, 2015

### Ray Vickson

Avoid using canned formulas; rather, work things out from first principles. So ask yourself: if $X_1, X_2, \ldots, X_n$ are iid random variables from the distribution $N(\mu,\sigma^2)$, what is the distribution of the sample mean
$$\bar{X} = \frac{1}{n} \sum_{i=1}^n X_i \: ?$$
Now you need to know how large to make $n$ in order to have
$$P(-2.5 \leq \bar{X} - \mu \leq 2.5 ) = 0.95,$$
assuming that you know $\sigma = 18$. At that point you are ready to state with absolute confidence the appropriate test to use. (And no, I will not tell you if you are correct or not!)

3. Nov 21, 2015

### toothpaste666

since

P(-z_(α/2) ≤ (X-μ)/(σ/sqrt(n)) ≤ z_(α/2)) = .95

P(-z.025 ≤ (X-μ)/(18/sqrt(n)) ≤ z.025) = .95

-1.96 ≤ sqrt(n)(X-μ)/18 ≤ 1.96

-1.96(18)/(X-μ) ≤ sqrt(n) ≤ 1.96(18)/(X-μ)

[-1.96(18)/(X-μ)]^2 ≤ n ≤ [1.96(18)/(X-μ)]^2

n = [1.96(18)/(X-μ)]^2

which is what I got before if E = (X-μ)
I think it does, but I am now not sure if it is equal to 5