My textbook has the following exercise I'm currently trying to complete:
Calculate $\lim_{n \to \infty} \frac{1}{n^2}\sum_{k=1}^{n} \sqrt{n^2 - k^2}$ with Riemann sums.
After playing with it for a bit I arrived at this:
$$\lim_{n \to \infty} \frac{1}{n^2}\sum_{k=1}^{n} \sqrt{n^2 - k^2} = \lim_{n \to \infty} \frac{1}{n^2}\sum_{k=1}^{n} \sqrt{n^2\left(1 - \frac{k^2}{n^2}\right)} = \lim_{n \to \infty} \frac{1}{n}\sum_{k=1}^{n} \sqrt{1 - \frac{k^2}{n^2}}$$
From here on I didn't really know what to do and so I looked the solution up and it simply says, that this can be interpreted as the following integral:
$$\int_{0}^{1} \sqrt{1-x^2}\,dx$$
Solving this integral is easy, since its just a quarter of the unit circle and therefore evaluates to $\frac{\pi}{4}$, but I just don't really understand how the book simply arrived at this integral.
In general, if $f$ is Riemann integrable: $$\int_0^1 f(x)\,dx=\lim_{n\to\infty}\frac1n\sum_{k=1}^n f\left(\frac kn\right)$$ where the right side is the limit of Riemann sums.
When you have $f(x)=\sqrt{1-x^2},$ the right side is exactly what you got for your limit.
The integral from $a$ to $b$ is more complicated::
$$\int_a^b f(x)\,dx =\lim_{n\to\infty}\frac{b-a}{n}\sum_{k=1}^n f\left(a+k\frac{b-a}n\right)$$
The reason it is the integral from $0$ to $1$ is that $$0<\frac1n<\frac2n<\cdots<\frac nn=1$$
We are using values $x$ between $0$ to $1$ to estimate the area under the curve for that integral range.