<s>[INST] How can a binomial coefficient can be approximated by using Stirling's formula? I've met some difficulties with such question:
How can we approximate a binomial coefficient by using a Stirling's factorial approximation.
I've evaluate a little bit and got this
How can I transform the right side of this equation for getting estimation like (1 + ?/n + O(1/n^2))
 [/INST] Another case is when
$k$ is a constant times $n$.
Let
$k = a n $
where $0 < a < 1$,
so $k/n = a$.
Then
$\begin{align}
\binom{n}{k}
&=\frac{n!}{k!(n-k)!}\\\\
&\approx. \frac{\sqrt{2\pi n}(\frac{n}{e})^n} {\sqrt{2\pi k}(\frac{k}{e})^k \sqrt{2\pi (n-k)}(\frac{n-k}{e})^{n-k}}\\\\
&=\frac{1}{\sqrt{2\pi k}(k/n)^k \sqrt{1-(k/n)}(1-(k/n))^{n-k}}\\
&=\frac{1}{\sqrt{2\pi k(1-k/n)}a^{an} (1-a)^{n-an}}\\
&=\frac{1}{\sqrt{2\pi n a(1-a)}(a^a(1-a)^{1-a})^n}\\
\end{align}
$
For example,
if $a = 1/2$,
since
$a(1-a) = 1/4$
and
$a^a (1-a)^{1-a}
=(1/2)^{1/2}(1/2)^{1/2}
=1/2
$,
this becomes
$\binom{n}{n/2}
\approx \frac{1}{\sqrt{2n\pi/4}(1/2)^n}
= \frac{2^n}{\sqrt{n\pi/2}}
$.
For another example,
if $a = 1/3$,
since
$a(1-a) = 2/9$
and
$a^a (1-a)^{1-a}
=(1/3)^{1/3}(2/3)^{2/3}
=\frac{(2^2)^{1/3}}{3}
=\frac{4^{1/3}}{3}
=(4/27)^{1/3}
$,
this becomes
$\binom{n}{n/3}
\approx \frac{1}{\sqrt{2n\pi(2/9)}(4/27)^{n/3}}
= \frac{3(27/4)^{n/3}}{2\sqrt{n\pi}}
$.
</s>