Sample size needed to show difference of means is smaller than $y\%$ The unpaired $t$-test is commonly used to reject the null hypothesis that two sample means are equal.
However, suppose one wants to prove that the sample means are no different than some given maximal difference, i.e. we want to reject the hypothesis $|\mu_1-\mu_2|>y\%$. Moreover, suppose we have an a priori estimate of the pooled sample variance $\sigma^2$.
How can one calculate the minimal sample size needed $n$ so that we can reject this hypothesis with a given power?

A possible approach:
Using the CDF of the student-$t$ distribution:
$$F(t)=1-\frac{1}{2}I_x(\nu/2,1/2),\quad x \equiv \frac{\nu}{\nu+t^2}$$
The $p$-value for the hypothesis $H_0:|\mu_1-\mu_2|>y$ assuming equal sample sizes and average standard deviation $\sigma$ is:
$$t=\frac{\mu_1 - \mu_2}{\sigma\sqrt{2/N}} $$
$$P(H_0)=2-2F\left(\sqrt{\frac{N}{2}}\frac{y}{\sigma}\right)$$
If one is given a priori values of $y$ and $\sigma$ in terms of percentages of the expected value, one can then calculate $N$ for a given $p$-value. This answer is incomplete as it does not give $N$ explicitly nor does it give the dependence of $N$ on the power.
