I evaluate the following limit with Riemann integral
$\displaystyle u_n=\frac{1}{n}\sum_{k=1}^n \log(1+\frac{k^2-2k+2}{n^2}),\:\ $$\lim _{n\to \infty } u_n=lim _{n\to \infty\ }\frac{1}{n}\sum_{k=1}^n \log(1+\frac{k^2-2k+2}{n^2})=lim _{n\to \infty\ }\frac{1}{n}\sum _{k=1}^nf\left(\frac{k}{n}\right)$$=\int _0^1\:f\left(x\right)dx$
I know what it is about but at the final I always have problem because I don't know to get the function... and if I put a function how verify if that is correct? I'm total confused Please make me to understand that, I apreciate! For example, I get this function: f:[0,1]-->R, f(x)= ln(1+x), how I verify if that is correct, because if I put k/n instead x we obtain ln(1+k/n) but we have $$log(1+\frac{k^2-2k+2}{n^2})$$ we must have same value?
In general how we find the function ? how we understand which is function?
If $f\colon[0,1]\to\mathbb{R}$ is integrable, then, using the definition of the integral as the limit of Riemann sums, $$ \int_0^1f(x)\,dx=\lim_{n\to\infty}\frac1n\sum_{k=1}^nf(x_k), $$ where $$\frac{k-1}{n}\le x_k\le\frac{k}{n}.$$ Typical choice in applications is $x_k=k/n$. But the choice is arbitrary as long as $x_k\in[(k-1)/n,k/n]$. In your problem $f(x)=\log(1+x^2)$ and $$ x_k=\frac{\sqrt{k^2-2\,k+2}}{n}=\frac{\sqrt{(k-1)^2+1}}{n}, $$with $$ \frac{k-1}{n}<\frac{\sqrt{(k-1)^2+1}}{n}<\frac{k}{n}. $$ Thus $$ \lim_{n\to\infty}\frac{1}{n}\sum_{k=1}^n \log\Bigl(1+\frac{k^2-2k+2}{n^2}\Bigr)=\int_0^1\log(1+x^2)\,dx. $$