We introduced the topic of sample size in Unit 5. There we were estimating the required sample size for comparing a sample mean with a known parametric mean using the Ztest. That approach can readily be extended to estimate the sample size required for detecting a difference between means with a given power using the twosample ttest.
With the ztest the population standard deviation was assumed to be known. But now the population standard deviation is estimated rather than known. Strictly speaking we should therefore replace the zvalues with tvalues and use an integrative procedure to estimate sample size (this is because the values of t will be dependent on n).
Such a method was proposed by Snedecor & Cochran (1980) and is given in various texts  however, it is much more timeconsuming and will usually give similar results to the method given here. It should also be remembered that estimating required sample size can only ever be an approximate exercise since there is no guarantee that variability will remain constant.
Algebraically speaking:
For a onetailed test:

n 
= 
(r + 1)^{2}(z_{α} + z_{β})^{2} σ^{2} 

δ^{2}r 
where
 n is the required total sample size = n_{1} + n_{2}.
 r is the ratio of the sample sizes for each group (n_{1}/ n_{2}),
 z_{α} is obtained from your probability calculator or tables given that P(Z < z_{α}) = 1 − α and α is the significance level.
 z_{β} is obtained from your probability calculator or tables, given that P(Z < z_{β}) = 1 − β and
1 − β is the power,
 δ is the difference that one wishes to be able to detect,
 σ is the known common standard deviation. In practice we only have an estimate of this being the square root of the pooled estimate of the variance. Some authorities recommend adding 2 to the number of samples required to allow for this.
For a twotailed test, we use z_{α/2} in place of z_{α}. This is an approximation since it ignores the possibility of a type III error. However, for large treatment effects, it will not usually introduce any serious error.
Where n_{1} = n_{2} the formula simplifies to:

n 
= 
4(z_{α} + z_{β})^{2} σ^{2} 

δ^{2} 
