Prove that the integral $\int_1^\infty f(x)\, dx$ and series $\sum f(n)$ both converge or both diverge? If f is monotonic decreasing for all $x \ge 1$ and if $\lim \limits_{x \to +\infty}f(x) =0 $,
Prove that the integral $\int_1^\infty f(x)\,dx$ and series $\sum f(n)$ both converge or both diverge?
I try this exercise at 10.24 of book tom apostol's calculus like this:
Let $S_n=\sum f(n)$ and $T_n=\int_1^nf(x)\,dx$, since f is monotonic decreasing we can get
$$
S_n-S_1\le T_n \le \int_1^a f(t)\,dt \le T_{n+1} \le S_n \\
Where\, a \in [n,n+1]
$$
As $a \to +\infty$, $n \to +\infty$, so $\int_1^{\infty} f(x)\,dx$ same convergence or divergence as $T_n$ which also has same as $S_n$. So we have proved.
I am not sure what I have try is correct or not. Any help will be appreciated.

Let $$F(x)=\int_{1}^{x}f(t)dt,\forall\ x\geq\ 1.$$When $n\leq x\leq n+1$ we have $$a_{n+1}=f(n+1)\leq f(x)\leq f(n)=a_{n}$$ since $f$ is monotonic decreasing.
Thus we have $$a_{n+1}\leq\int_{n}^{n+1}f(t)dt\leq a_{n}$$which means$$S_{n}\leq a_{1}+F(n),F(n)\leq S_{n-1},$$where $S_{n}=\sum\limits_{k=1}^{n}a_{k}.$
So we can conclude that the integral $\int_{1}^{\infty}f(x)dx$ and series $\sum\limits_{n=1}^{\infty}a_{n}$ both converge or both diverge since $S_{n}$ and $F_{n}$ are both monotonic increasing.
