Compute the limit of an integral This is a nice calculus problem, which seems not to be easy. 
Compute the limit: $$\lim_{n\rightarrow\infty}n\left(\frac{1}{2}-(n-1)\int_{0}^{1}\frac{x^n}{x^2+1} dx\right)$$. A solution would really be appreciated!!
 A: We can show that $$
\lim_{n\rightarrow\infty}n\left(\frac{1}{2}-(n-1)\int_{0}^{1}\frac{x^n}{x^2+1} dx\right)=\frac{1}{2}
$$
by first calculating the integral inside of the limit.  Once we have the integral result, we can calculate the limit.  The integral is given by $$
I\equiv\int_0^1 \frac{x^n}{x^2+1} dx=\frac{1}{4}\left(\psi^{(0)}\big(\frac{3+n}{4}\big)-\psi^{(0)}\big(\frac{1+n}{4}\big)\right), \ \Re(n) > -1.
$$
A similar integral is given here(Closed form for $\int_0^\infty {\frac{{{x^n}}}{{1 + {x^m}}}dx }$)
Note also the poly-gamma function is defined by $\psi^{(0)}$ and is given here http://en.wikipedia.org/wiki/Polygamma_function.
Thus we have
$$
\lim_{n\rightarrow\infty}n\left(\frac{1}{2}-(n-1)\int_{0}^{1}\frac{x^n}{x^2+1} dx\right)=\lim_{n\rightarrow\infty}n\left(\frac{1}{2}-(n-1)I\right)=\frac{1}{2}.
$$
The polygamma function is defined as 
$$
\psi^{m}(z)=\frac{d^{m+1}}{dz^{m+1}}\ln \Gamma(z)
$$
where $\Gamma(z)$ is the gamma function.  We can also write
$$
\psi^{(0)}(z)=\psi(z)=\frac{\Gamma'(z)}{\Gamma(z)}
$$
where $\psi(z)$ is the digamma function.
A: A solution without assuming the knowledge of limiting behaviour of special functions:
The catch of this limit is that $x^n$ becomes very flat and zero-ish everywhere except for a steep part at the end. Only there, the $1+x^2$ has any effect when $n$ is large. We can't expand $x$ around $0$ because the series diverges at $x=1$. But we can expand around $1$. Say $u=1-x$. The idea is that $u$ is small where $x^n$ matters at all (essentially we are doing asymptotic expansion).
$$\frac{1}{1+x^2}=\frac{1}{2-2u+u^2}=\frac{1}{2}\frac{1}{1-(u-u^2/2)}=\frac{1}{2}(1+((1-x)-(1-x)^2/2)+((1-x)-(1-x)^2/2)^2+\cdots)$$
We used the geometric expansion, $\frac{1}{1-q}=1+q+q^2+\cdots$ for $q=u-u^2/2$ that represents the lowest order effects of $\frac{1}{1+x^2}$ around $x=1$, where the contribution of $x^n$ is strongest.
We still need to integrate by $x$ (remember, expansion didn't affect the $x^n$ term, just the denominator). So we get
$$\int_0^1 \frac{x^n}{1+x^2}dx=\frac12\int_0^1 x^n+x^n(1-x)-x^n(1-x)^2/2+x^n(1-x)^2+\cdots dx$$
$$\frac{1}{2}\left(\frac{1}{n+1}+\frac{1}{(n+2)(n+1)}+\cdots\right)$$
Other terms don't matter because the power of $n$ terms in the denominator rises with power of $(1-x)$, which can be verified by noticing $\int_0^1 x^n (1-x)^m dx=B(n+1,m+1)=\frac{n!m!}{(n+m+1)!}$, where $B$ is the Beta function.
Now, plug this back in the limit:
$$\lim_{n\to \infty} n\left(\frac{1}{2}-\frac{1}{2}\left(\frac{n-1}{n+1}+\frac{n-1}{(n+2)(n+1)}+\cdots\right)\right)$$
Now we can see that the quadratic term in $n$ is the last one that matters: the next one would limit to $0$ by default. This limit is easily evaluated to
$$\frac{1}{2}\lim_{n\to \infty} n\left(\frac{n+1}{n+1}-\frac{n-1}{n+1}-\frac{n-1}{(n+2)(n+1)}+\cdots\right)$$
$$\frac{1}{2}\lim_{n\to \infty} \left(\frac{2n}{n+1}-\frac{n(n-1)}{(n+2)(n+1)}+\cdots\right)$$
$$\frac{1}{2}\lim_{n\to \infty} \left(2-1\right)=\frac12$$
It's not pretty, but it uses the idea inspired by the behaviour of the functions in the limit, and expansions under the integral sign are pretty standard, you just have to be careful to stay within the convergence radius.
