When does linearity of definite Riemann integrals hold? My Calculus text book says if functions $f$ and $g$ are continuous on a closed interval $[a,b]$, then
$$
\int_a^b (f(x)+g(x)) \, dx=\int_a^b f(x) \, dx+\int_a^b g(x) \, dx
$$
where the integrals are in the Riemann sense.
However, there are many important applications for functions with discontinuities.
Does this identity also apply in all cases where all three integrals exist? If not what other constraints are needed to include functions with discontinuities?
*** Update ***
I think I have an example where excluding discontinuities is relevant.
$
\int_0^{\infty } \left(\sin (x) \cos \left(\frac{1}{x}\right)-\sin (x)\right) \, dx
$ is well defined but
$
\int_0^{\infty } \sin (x) \cos \left(\frac{1}{x}\right) \, dx-\int_0^{\infty } \sin (x) \, dx
$ involves two integrals that don't exist. It seems the sufficient conditions used in my text book are not met in this example because sin(x) is not continuous at $\infty$.
The correct theorem in the setting of Riemann integration is the following:

If $f,g:[a,b]\to\Bbb{R}$ are Riemann-integrable over $[a,b]$, then $f+g$ is also Riemann-integrable over $[a,b]$, and in this case we have
\begin{align}
\int_a^b(f+g)&amp;= \int_a^bf+\int_a^bg.
\end{align}

A proof should be available in any good textbook (for example it's in Spivak's Calculus book). Of course, continuous functions are Riemann-integrable so you can apply this result to continuous functions. There are of course also many Riemann-integrable functions which are not continuous; the thereom holds for these functions as well. As you can see from the theorem statement, there is no mention of continuity at all!
If we integrate via Lebesgue, then the same equality holds for discontinous functions, provided $f$ and $g$ are discontinous only on a dense numerable subsetset of their domain. To be fair, the condition of being integrable doesn't depend on continuity: there exists non continous functions which are integrable. As an example you can take the floor function, which is clearly integrable but it has discontinuities on every number in $\mathbb{Z}$, which is not dense in $\mathbb{R}$.