How to prove $\lim_{n\to \infty}\int_0^1 \frac{x^n}{1+x^n}dx$ = $\int_0^1 \lim_{n\to \infty} \frac{x^n}{1+x^n}dx$? Here is a real analysis question from my practice sheet.

Is $$\lim_{n\to \infty}\int_0^1 \frac{x^n}{1+x^n}dx=\int_0^1 \lim_{n\to \infty} \frac{x^n}{1+x^n}dx?$$

My first thought was they are not equal since  $\lim_{n\to \infty} \frac{x^n}{1+x^n}$  doesn't converge uniformly.
But the solution in my sheet said this equality is correct because $$\frac{1}{2(n+1)} \le \int_0^1 \frac{x^n}{1+x^n}dx \le \frac{1}{n+1}$$
This solution really confused me. Does anyone have ideas how to get this inequality and why it proves the question?
 A: On request of @tired I am putting my comment as an answer.

Note that when $0 \leq x \leq 1$ then we have $$0 \leq x^{n} \leq 1$$ and hence $$1 \leq 1 + x^{n} \leq 2$$ and therefore $$\frac{x^{n}}{2} \leq \frac{x^{n}}{1 + x^{n}} \leq x^{n}\tag{1}$$ for all $x$ with $0 \leq x \leq 1$. Integrating the above with respect to $x$ on interval $[0, 1]$ we get $$\frac{1}{2}\int_{0}^{1}x^{n}\,dx \leq \int_{0}^{1}\frac{x^{n}}{1 + x^{n}}\,dx \leq \int_{0}^{1}x^{n}\,dx$$ or $$\frac{1}{2(n + 1)}\leq \int_{0}^{1}\frac{x^{n}}{1 + x^{n}}\,dx \leq \frac{1}{n + 1}\tag{2}$$ which is the inequality in the question. Using Squeeze theorem we now get $$\lim_{n \to \infty}\int_{0}^{1}\frac{x^{n}}{1 + x^{n}}\,dx = 0\tag{3}$$ Next we analyze the function $$f(x) = \lim_{n \to \infty}\frac{x^{n}}{1 + x^{n}}$$ for $x \in [0, 1]$. Clearly we can see that $f(x) = 0$ for $x \in [0, 1)$ and $f(1) = 1/2$ so that $f$ is bounded on $[0, 1]$ and has a single discontinuity at $x = 1$. It follows that $\int_{0}^{1}f(x)\,dx$ exist and has the value $0$. Hence using $(3)$ we have $$\lim_{n \to \infty}\int_{0}^{1}\frac{x^{n}}{1 + x^{n}}\,dx = \int_{0}^{1}\lim_{n \to \infty}\frac{x^{n}}{1 + x^{n}}\,dx\tag{4}$$ Note that the sequence of function $f_{n}(x) = \dfrac{x^{n}}{1 + x^{n}}$ converges pointwise to $f(x)$ on $[0, 1]$ but the convergence is not uniform (as noted by OP). But this does not necessarily mean that the expected identity $$\lim_{n \to \infty}\int_{0}^{1}f_{n}(x)\,dx = \int_{0}^{1}\lim_{n \to \infty}f_{n}(x)\,dx\tag{5}$$ does not hold. Uniform convergence is only a sufficient but not a necessary condition for $(5)$ to hold and this question serves as a nice example to show that uniform convergence is not necessary for $(5)$ to hold.

Note: All the integrals used above are Riemann integrals. There is a deeper theory of Lebesgue integrals which gives very general conditions (much more widely applicable than uniform convergence) under which $\lim_{n \to \infty}$ and $\int_{a}^{b}$ operations can be interchanged (or we say these operations commute). It is possible to interpret these integrals in the question as Lebesgue integrals and then the desired equality of limit of integral and integral of limit is a direct consequence of Lebesgue's Dominated Convergence Theorem. But I don't think we need to use these tools to deal with the particular question here (at least the wording of the question does not seem to suggest anything about Lebesgue integration).
A: More generally, if $f\in C[0,1]$ then for $n\geq 0$,
$$\lim_{n\to \infty}\int_0^1 x^n f(x^n)dx=0$$
In fact, let $M=\max_{x\in [0,1]}|f(x)|$, then
$$0\leq \left|\int_0^1 x^n f(x^n)dx\right|\leq  \int_0^1x^n | f(x^n)|dx 
\leq M\int_0^1x^n dx =\frac{M}{n+1}\to 0$$
as $n$ goes to infinity. By Squeeze Theorem, the limit of $\int_0^1 x^n f(x^n)dx$ is zero.
P.S. As regards your inequality. We have that $1\leq 1+x^n\leq 2$ for $x\in[0,1]$. Hence
$$\frac{1}{2(n+1)}=\frac{1}{2}\int_0^1 x^n dx\leq
 \int_0^1 \frac{x^n}{1+x^n}dx\leq \int_0^1 x^ndx =\frac{1}{n+1}$$
where we used the monotonicity of the integral: if $f(x)\leq g(x)$ in $[a,b]$ then $\int_a^b f(x)dx\leq \int_a^b g(x)dx$. Again by Squeeze Theorem, the limit of the middle term is zero.
A: Note that $$0\leqslant\frac{x^n}{1+x^n}\leqslant 1  $$ for all $x\in[0,1]$ and all $n$. Since $$\int_0^1 \mathsf dx = 1<\infty, $$
by dominated convergence we have
$$\lim_{n\to\infty} \int_0^1 \frac{x^n}{1+x^n}\,\mathsf dx = \int_0^1 \left(\lim_{n\to\infty}\frac{x^n}{1+x^n}\right)\,\mathsf dx. $$
The pointwise limit of $x\mapsto \frac{x^n}{1+x^n}$ is zero for $\in[0,1)$, so the above integral is zero.
A: Observe that
$$\frac{1}{2(n+1)} \le \int_0^1 \frac{x^n}{1+x^n}dx \le \frac{1}{n+1}\implies\lim_{n\to\infty} \int_0^1 \frac{x^n}{1+x^n}dx=0$$
by the squeeze theorem. Now just observe that for $\;x\in[0,1)\;$ ,
$$\lim_{n\to\infty}\frac{x^n}{1+x^n}=\frac0{1+0}=0$$
Fill in details now.
