What am I doing wrong? I am trying to prove the integral test for series, but got a strange result.
Assume that $f$ is decreasing and positive.
Because the series can be imagined as the area-sum of $1$-wide rectangles of height $f_n$ and each of those rectangles can be expressed as a constant integral on a $1$-wide interval where $f_n=f(n)$ is the constant when integrating $dx$:
$$\sum_{n=1}^\infty f_n = \sum_{n=1}^\infty \int_n^{n+1}f(n)\,dx$$
Instead of $f(n)$ we can use the function value $f(x)$ from either end of the 1-wide interval so either floor or ceiling of $x.$
If we use the floor then the height is the left of the interval in this case always $n.$
If we use the ceiling then the height is the right of the interval in this case always $n+1$ so we should start from $n=0$ not $n=1$ to get the same sum:
$$\sum_{n=0}^\infty\int_n^{n+1}f(\lceil x\rceil)\,dx = \sum_{n=1}^\infty f_n = \sum_{n=1}^\infty\int_n^{n+1} f(\lfloor x\rfloor)\, dx$$
Obviously, $$a_1 + \sum_{n=1}^\infty a_{n+1} = \sum_{n=0}^\infty a_{n+1}.$$
Therefore, we have
$$f(1) + \sum_{n=1}^\infty \int_n^{n+1} f(\lceil x\rceil)\, dx = \sum_{n=1}^\infty f_n = \sum_{n=1}^\infty \int_n^{n+1} f(\lfloor x\rfloor)\, dx.$$
Since we have a function of $x$, we can concatenate the sum of integrals into a single integral:
$$f(1) + \int_1^\infty f(\lceil x\rceil)\, dx = \sum_{n=1}^\infty f_n = \int_1^\infty f(\lfloor x\rfloor)\, dx$$
Because $f$ is decreasing we know that $f(\lceil x\rceil)\leq f(x)\leq f(\lfloor x\rfloor),$ therefore
$$f(1) + \int_1^\infty f(x)\, dx \leq \sum_{n=1}^\infty f_n \leq \int_1^\infty f(x)\, dx$$
$$f(1) + \int_1^\infty f(x)\, dx \leq \int_1^\infty f(x)\, dx$$
$$f(1) + A \leq A$$
What happened? $f$ was positive!
 A: Let $S=\sum\limits_{n=1}^\infty f_n$. You state correctly that $f(1)+U=S=V$, where
$$U=\int_1^\infty f(\lceil x\rceil)\,\mathrm dx,\qquad V= \int_1^\infty f(\lfloor x\rfloor)\,\mathrm dx,$$
and you then note correctly that, the function $f$ being nonincreasing, $f(\lceil x\rceil)\leqslant f(x)\leqslant f(\lfloor x\rfloor)$ for every $x$. So far, so good. 
But the conclusion of all this is that
$$
U\leqslant\int_1^\infty f(x)\, \mathrm dx\leqslant V,
$$
thus,
$$
\int_1^\infty f(x)\, \mathrm dx\leqslant V=S=f(1)+U\leqslant f(1)+\int_1^\infty f(x)\, \mathrm dx,
$$
not the other way round.
A: I'm afraid you went wrong when you introduced the inequality at the very end. Indeed, $f(\lceil x\rceil)\le f(x)$ since $f$ is decreasing, so since $$f(1) + \int_1^\infty f(\lceil x\rceil)\, dx = \sum_{n=1}^\infty f_n$$ then $$f(1) + \int_1^\infty f(x)\, dx\geq f(1) + \int_1^\infty f(\lceil x\rceil)\, dx = \sum_{n=1}^\infty f_n.$$ Also, since $f(x)\le f(\lfloor x\rfloor)$ and $$\sum_{n=1}^\infty f_n = \int_1^\infty f(\lfloor x\rfloor)\, dx,$$ then $$\sum_{n=1}^\infty f_n = \int_1^\infty f(\lfloor x\rfloor)\, dx\ge\int_1^\infty f(x)\,dx.$$
You absolutely had the right idea. You just misapplied the inequalities.
