Sample Size for a One-Sample Normal Hypothesis Test to Achieve Given Power Let $X_{1},X_{2},..,X_{n}$ be random sample from $N(\mu,1)$. We need to test $H_{0}:\mu=10$ against $H_{1}:\mu=11$. Set up a most powerful test with size 0.05 and also compute that $n$ for which power is at least $0.95$
So, first of all, from the hypothesis specification, we can see that the null will be rejected for the larger values of $\sum X_i$ or $\bar {X}$. So, the most powerful test is
Reject $H_0$ if $\bar X \ge k$. We don't need to solve the whole NP lemma thing here to get the MP test for this simple vs simple hypothesis.
To evalute k, we can use the size condition which is:
$P_0(\bar X \ge k) = P(\frac{\bar X - 10}{\frac{1}{\sqrt{n}}} \ge \frac{k - 10}{\frac{1}{\sqrt{n}}}) =0.05$
From here, We can write (from normal probability table) that $\frac{k - 10}{\frac{1}{\sqrt{n}}} = 1.65$
Hence, $k = 10 + \frac{1.65}{\sqrt{n}}$.
I am able to compute the most powerful test. Now, to use the power condition, I can write:
$P_1(\bar {X} \ge 10 + \frac{1.65}{\sqrt{n}})>0.95 => P_1(\frac{\bar X - 11}{\frac{1}{\sqrt{n}}} \ge -1\sqrt{n} + 1.65)>0.95$
I can see that this is also standard normal but I am not sure at which point the above inequality will be satisfied. Any help in this last step would be appreciated?
 A: General sample size formula. Let $\sigma$ be the normal population standard deviation and let $\Delta = |\mu_0 - \mu_a|$ be the difference to detect in a one-sided test. Then the general formula for Type II error $\beta$ a test at level $\alpha$ is to use a sample of size
$n = \frac{\sigma^2}{\Delta^2}(z_\alpha + z_\beta)^2,$ where $z_\alpha$ and $z_\beta$
cut probabilities $\alpha$ and $\beta,$ respectively, from the upper tail of a standard normal distribution. The power is $1 - \beta.$
Your attempt. Thanks for showing your work so far. You have $\sigma = \Delta = 1$ and $\alpha = \beta = 0.05,$ so that $z_{\alpha} = z_{\beta} = 1.645.$ Thus you have
$n \approx (1.645 + 1.645)^2 = 10.8241.$ Round up to $n = 11.$
You are off to a reasonable start, but you should use 1.645 instead of 1.65, and you seem to have a mistake in your final inequality. In your final version, can you show that @DillipSarwate's hint leads to $n = 11,$ as in the general formula above and in the
Minitab output below?
Minitab sample size computation.
    Power and Sample Size 

1-Sample Z Test

Testing mean = null (versus > null)
Calculating power for mean = null + difference
α = 0.05  Assumed standard deviation = 1

            Sample  Target
Difference    Size   Power  Actual Power
         1       7    0.80      0.841562
         1       9    0.90      0.912315
         1      11    0.95      0.952715

Power Curve for 1-Sample Z Test 


Simulation in R: With a million iterations we can expect 2-3 place
accuracy for power.
set.seed(211)
m = 10^6;  n = 11;  pv = numeric(m)
for(i in 1:m) {
 x = rnorm(11, 11, 1)             # 11 obs from NORM(11, 1)
 z = (mean(x) - 10)/(1/sqrt(11))  # z-statistic
 pv[i] = 1 - pnorm(z)             # right-tailed P-value
}
mean(pv <= 0.05)                  # Rejection probability @ 5%
[1] 0.952616                      # Matches MTB 'actual power'
2*sd(pv <= .05)/1000
[1] 0.0004249179                  # 95% margin of simulation error

