Question about compact sets in $\mathbb{R}$

62 Views Asked by At

Suppose I am given a function $f$ on $\mathbb{R}$ and I'm asked to show that

$ \int_K f(x) \,dx < \infty$ for any compact set $K \subset \mathbb{R}$.

Would it be enough to only consider the closed bounded intervals $[a,b]$? Would then prove it for all compact sets $K$?