Suppose $f(x)$ is continuous and decreasing on $[0, \infty]$, and $f(n) \rightarrow 0$. Define $\{a_n\}$ by
$$a_n = f(0) + f(1) + ... + f(n-1) - \int^n_0 f(x) dx$$
(a) Prove $\{a_n\}$ is a Cauchy sequence directly from the definition.
(b) Evaluate $\lim a_n$ if $f(x) = e^{-x}$.
I started out by examining $a_{n+1} - a_n$:
$$a_{n+1} - a_n = f(n) - \int_n^{n+1} f(x)dx$$
Then, by the Triangle Inequality:
$$|a_m - a_n| \leq |a_{n+1} - a_n| + |a_{n+2} - a_{n+1}| + ... + |a_{m} - a_{m-1}|$$
and so,
$$|a_m - a_n| \leq \sum_{k = n}^m f(k) - \int_n^{m} f(x)dx$$
And I am lost afterwards. Am I on the right track? How can I use this expression to also prove the limit for $f(x) = e^{-x}$?
Since $f$ is decreasing, for $x \in [k, k+1]$ we have $$f(k+1) \le f(x) \le f(k)$$ so $$f(k+1) \le \int_{k}^{k+1} f(x)\,dx \le f(k)$$
Let $m \ge n \in \mathbb{N}$. We have
\begin{align} a_m - a_n &= f(n) + f(n+1) + \cdots + f(m-2) + f(m-1) - \int_n^m f(x)\,dx\\ &= f(n) - \underbrace{\int_n^{n+1}f(x)\,dx}_{\in [f(n+1), f(n)]} + f(n+1)-\underbrace{\int_{n+1}^{n+2}f(x)\,dx}_{\in [f(n+2), f(n+1)]} + \cdots +f(m-1) - \underbrace{\int_{m-1}^m f(x)\,dx}_{\in [f(m), f(m-1)]}\\ &\le \big(f(n) - f(n+1)\big) + \big(f(n+1) - f(n+2)\big) + \cdots + \big(f(m-1) - f(m)\big)\\ &= f(n) - f(m)\\ &\le f(n) \end{align}
Note that $a_m - a_n \ge 0$.
Since $f(k) \xrightarrow{k\to\infty} 0$, letting $m, n \to \infty$ above gives that $a_m - a_n \xrightarrow{m, n \to \infty} 0$ so $(a_n)_n$ is a Cauchy sequence.
For $f(x) = e^{-x}$ we have:
$$a_n = e^{-0} + e^{-1} + \cdots + e^{-(n-1)} - \int_0^n e^{-x}\,dx = \frac{1 - e^{-n}}{1 - e^{-1}} + e^{-n} - 1 = (e^{-n} - 1)\left(\frac{1}{e^{-1} - 1} + 1\right)$$
Letting $n \to\infty$ above gives
$$\lim_{n\to\infty}{a_n} = -1 + \frac{1}{1-e^{-1}}$$