---
tag: W9T63J9RF3
kind: proof
name: Proof of the comparison test for improper integrals
msc: [40A10]
proves: 0FR1BDKK10
uses: [0VCTBJMEJF, 0Y12QYTJK3, 05RCDKHZM6, 0MBWQKM8QR, 080RWVVSB6, 0BTMQ04556, 0AXWET80YW, 0M8TGGP9JP]
sources:
  - url: https://www.macmillanlearning.com/studentresources/highschool/mathematics/rogawskiapet2e/additional_proofs/proof_of_comparison_test_for_improper_integrals.pdf
    locator: Lemma 2 and proof of Theorem 1
---

## Proof

We show that $b \mapsto \int_a^b f$ is increasing and bounded, so it has a limit by the completeness of $\R$.

1. For $b > a$, let $F(b) = \int_a^b f(x) \, dx$ and $G(b) = \int_a^b g(x) \, dx$. They exist by hypothesis.
2. If $h \colon [c, d] \to \R$ is Riemann integrable with $h \ge 0$, then $\int_c^d h \ge 0$. Indeed, the [[linearity of the integral|080RWVVSB6]] gives $\int_c^d 0 \, dx = 0 \cdot \int_c^d h = 0$. Then the [[monotonicity of the integral|0MBWQKM8QR]] gives $\int_c^d h \ge 0$.
3. $F$ is increasing. Let $a < b < b'$. By the [[additivity over intervals|05RCDKHZM6]], $F(b') = F(b) + \int_b^{b'} f$. By step 2 and $f \ge 0$, $F(b') \ge F(b)$. In the same way, $G$ is increasing.
4. For $b > a$, $F(b) \le G(b)$, by the monotonicity of the integral and $f \le g$ on $[a, b]$.
5. Now assume that $\int_a^\infty g$ converges. By the definition of the [[improper integral|0VCTBJMEJF]], $G(b) \to L$ as $b \to \infty$, where $L = \int_a^\infty g(x) \, dx$.
6. Claim: $G(b) \le L$ for all $b > a$. Suppose that $G(b_0) > L$ for some $b_0 > a$, and let $\varepsilon = G(b_0) - L > 0$.
7. By the definition of the [[limit at infinity|0Y12QYTJK3]], there is $M$ with $\abs{G(b) - L} < \varepsilon$ for all $b > M$.
8. Take $b > \max(M, b_0)$. By step 3, $G(b) \ge G(b_0) = L + \varepsilon$. So $G(b) - L \ge \varepsilon$, which contradicts step 7. This proves the claim.
9. By steps 4 and 6, $F(b) \le L$ for all $b > a$. So the set $S = \set{F(b) : b > a}$ is nonempty and bounded above by $L$.
10. Let $s$ be the [[supremum|0BTMQ04556]] of $S$. It exists by the [[completeness axiom|0AXWET80YW]]. Since $L$ is an upper bound of $S$, $s \le L$.
11. Claim: $F(b) \to s$ as $b \to \infty$. Let $\varepsilon > 0$. By the [[approximation property of the supremum|0M8TGGP9JP]], there is $b_1 > a$ with $s - \varepsilon < F(b_1) \le s$.
12. For $b > b_1$, step 3 and the definition of $s$ give $s - \varepsilon < F(b_1) \le F(b) \le s$. So $\abs{F(b) - s} < \varepsilon$ for all $b > b_1$, which proves the claim.
13. By step 11, $\int_a^\infty f(x) \, dx$ converges and equals $s$. By step 10, $\int_a^\infty f(x) \, dx = s \le L = \int_a^\infty g(x) \, dx$.
14. Finally, assume that $\int_a^\infty f$ diverges. If $\int_a^\infty g$ converged, then steps 5 to 13 would show that $\int_a^\infty f$ converges. So $\int_a^\infty g$ diverges.

## Idea

For a nonnegative function, the integral up to $b$ can only grow as $b$ grows. If it stays below a fixed bound, it must settle at its supremum, by the completeness of the real numbers. The convergent integral of the larger function provides this bound.
