# Why is it necessary to split the definite integral of a piecewise function into a sum

The second fundamental theorem of calculus (Newton-Leibniz) tells us that:

If $$f$$ is a real-valued function on a closed interval $$[a, b]$$ and $$F$$ is an antiderivative of $$f$$ in $$[a,b]$$ s.t. $$F'(x)=f(x)$$, then $$\int_{a}^{b} f(t) dt = F(b)-F(a)$$

Say we have a real-valued piecewise continuous function $$f(x)$$ defined on $$[a,b]$$ which is made up of intermediate functions $$f_1, f_2, ..., f_n$$ for $$x \in [x_1, x_2) \cup [x_2, x_3) \cup ...\cup[x_n, x_{n+1}]$$

Using the second fundamental theorem of calculus, one may find an appropriate $$F(x)$$ s.t. $$F'(x)=f(x)$$, like

$$F(x) = \begin{cases} \int f_1(x) dx + C_1 &\quad\text{if} \ x \in [x_1, x_2) \\ \int f_2(x) dx + C_2 &\quad\text{if} \ x \in [x_2, x_3) \\ ... \\ \int f_n(x) dx + C_n &\quad\text{if} \ x \in [x_n, x_{n+1}] \\ \end{cases}$$

My question is the following: why is it that when we evaluate $$\int_a^b f(t) dt$$, we must split it into the sum of $$\int_a^{x_i} f(t) dt + \int_{x_i}^{x_{i+1}} f(t) dt + \ ...\ +\int_{x_{i+k}}^{b} f(t) dt$$

instead of simply evaluating $$F(b) - F(a)$$ by selecting the appropriate antiderivatives from the piecewise function?

Example:

$$f(x) = \begin{cases} x+1 &\quad\text{if} \ x \in [0, 2) \\ 1 &\quad\text{if} \ x \geq 2 \\ \end{cases}$$

An antiderivative of $$f$$ would be

$$F(x) = \begin{cases} \frac{x^2}{2}+x + 2 &\quad\text{if} \ x \in [0, 2) \\ x+7 &\quad\text{if} \ x \geq 2\\ \end{cases}$$

Note the constants of integration $$C_1=2$$ and $$C_2=7$$

Clearly, computing $$F(3)-F(1)$$ does not give the area under $$f(x)$$ from $$x=1$$ to $$x=3$$. Even though intuitively it makes sense to break the definite integral into a sum, I am unable to come up with a straightforward reason as to why $$F(3)-F(1)$$ wouldn't give the correct result as long as I respected the conditions of the Newton-Leibniz axiom (maybe I didn't, but please let me know why).

EDIT: For a discontinuous function $$f(x)$$ on an interval $$[a,b]$$ with finitely many discontinuities, why do we need its antiderivative $$F(x)$$ to be continuous in order to apply $$F(b)$$-$$F(a)$$? No matter if it's continuous or not, $$F(x)$$ still won't be differentiable at $$f$$'s discontinuities, and its derivative would still be $$f$$. However, if it's not continuous, $$F(b)$$-$$F(a)$$ would no longer give the area under the curve. Why?

EDIT 2: Lebesgue Integration asserts that that an antiderivative $$F$$ differentiable almost everywhere must be absolutely continuous for $$F(b)$$-$$F(a)$$ (FTC 2) to work. So case closed.

• Well I think it would work if the piece-wise function were continuous. You pointed out the FTC at the start. Note that a function has to be continuous to be differentiable, so the FTC won't hold if F(x) is discontinuous. That's one way to immediately say it won't work. However, it is true that the integral can be broken up into parts, so why not break it up where the function would break the integral?! Commented Feb 5, 2019 at 19:16
• Hi! I think I get it... But why would FTC not hold for a discontinuous antiderivative? The second part of FTC does not assume the continuity of $f(x)$. If it did, I could have simply used the first part of FTC where any antiderivative $G(x)$ of $f(x)$ is $F(x)+c$ where $F(x)=\int_a^x f(t) dt$ and by the first part of FTC, $F'(x)=f(x)$ which means $F(x)$ is continuous (differentiability implies continuity). However, in this case, $f(x)$ is discontinuous (on a finite number of x's) on $[a,b]$, so I can't use FTC 1. Commented Feb 5, 2019 at 20:01
• Right, the second part doesn't specify the continuity of $f(x)$, but you only get to the second part after the first part which said $F'(x)=f(x)$, and that requires that $F(x)$ be differentiable and therefore continuous on the interval. I think that makes sense, but you're doing a good job scrambling my brain! Commented Feb 5, 2019 at 21:40
• Alright, but even if $F(x)$ were continuous by setting the constants according to Yves' answer, it still wouldn't be differentiable at $x=2$. The situation is the same with a discontinuous function, i.e. $F(x)$ would only be piecewise differentiable. Commented Feb 5, 2019 at 21:47
• Yeah, I think you're right that we should say differentiable, not just continuous. But particularly with piece-wise functions, they tend not to be differentiable because of their discontinuity. Though of course it's possible to be continuous but not differentiable as well. Commented Feb 5, 2019 at 23:50

You have to get the correct statement of Fundamental Theorem of Calculus part 2:

FTC Part 2: Let $$f, F$$ be functions from $$[a, b]$$ to $$\mathbb {R}$$ such that $$f$$ is Riemann integrable on $$[a, b]$$ and $$F'(x) =f(x)$$ for all $$x\in[a, b]$$. Then $$\int_{a} ^{b} f(x) \, dx=F(b) - F(a)$$

The result above remains true even if $$F'(x) =f(x) \, \forall x\in(a, b)$$ but then we need to assume continuity of $$F$$ on $$[a, b]$$. In fact one can remove this restriction and get another version of FTC:

FTC Part 2 (ver 2): Let the function $$f:[a, b] \to\mathbb {R}$$ be Riemann integrable on $$[a, b]$$. Let $$F:(a, b) \to\mathbb {R}$$ be another function which is differentiable on $$(a, b)$$ such that $$F'(x) =f(x) \, \forall x\in(a, b)$$. Then limits $$\lim_{x\to a^{+}} F(x), \lim_{x\to b^{-}} F(x)$$ exist and $$\int_{a} ^{b} f(x) \, dx=\lim_{x\to b^{-}} F(x) - \lim_{x\to a^{+}} F(x)$$

Thus in order to use FTC for evaluation of integrals one must ensure that the integral exist. A common sufficient condition for existence of integral is that the integrand should be bounded and possess at most a finite number of discontinuities in the closed interval over which integration is to be performed. And further the integrand must possess an anti-derivative on the corresponding open interval.

Let's then consider the case when integrand $$f$$ possesses a finite number of discontinuities on $$[a, b]$$. Such a function is what one typically calls piecewise continuous function. But such a function may or may not possess an anti-derivative. In particular since derivatives can't have jump discontinuities, if $$f$$ has a jump discontinuity at an interior point of $$[a, b]$$ then $$f$$ can't possess an anti-derivative on $$(a, b)$$.

This is what happens with your example $$f$$ given by $$f(x) =x+1$$ for $$x\in[0,2)$$ and $$f(x) =1$$ for $$x\geq 2$$. Clearly $$f$$ has a jump discontinuity at $$x=2$$ and hence $$f$$ can't possess an anti-derivative on any interval which contains $$2$$ as an interior point. So one can't use FTC to evaluate $$\int_{1}^{3}f(x)\,dx$$. But once you split the interval $$[1,3]$$ into two intervals $$[1,2]$$ and $$[2,3]$$ this problem disappears and $$f$$ possess an anti-derivative on each of the intervals $$(1,2)$$ and $$(2,3)$$. Thus $$F(x) =x+(x^2/2)$$ on $$(1,2)$$ and $$F(x) = x$$ for $$x>2$$ works fine. You can use this $$F$$ to evaluate $$\int_{1}^2 f(x) \, dx$$ and $$\int_{2}^3 f(x) \, dx$$ and add these to get $$\int_{1}^{3}f(x)\,dx$$.

There are examples where $$f$$ is discontinuous but the discontinuity is not of jump kind and it possesses an anti-derivative. Thus if $$f(x) =2x\sin(1/x)-\cos(1/x),x\neq 0,f(0)=0$$ and $$F(x) =x^2\sin(1/x),x\neq 0,F(0)=0$$ then $$F'(x) =f(x)$$ for all $$x$$. And then we can use FTC to get $$\int_{a} ^{b} f(x) \, dx=F(b) - F(a)$$ for all real $$a, b$$.

• Hi! Thanks for the answer! What I was actually looking for was a continuity condition on $F$ to make $F(b)-F(a)$ work, and I found it in Lebesgue integration. Commented Feb 14, 2019 at 21:31

The $$F$$ that you proposed in the example is discontinuous at $$x=2$$ and cannot be the antiderivative of $$f$$ for this reason. Now,

$$G(x) = \begin{cases} \frac{x^2}{2}+x + 2 &\quad\text{if} \ x \in [0, 2) \\ x+4 &\quad\text{if} \ x \geq 2\\ \end{cases}$$

doesn't have this problem and

$$G(3)-G(1)=7-\frac72=\frac72$$ is correct.

You cannot ensure continuity between the pieces without evaluating the piece of the antiderivatives at the endpoints of their interval, and this is perfectly equivalent to splitting the integral.

• Hi! So, if I am correct, a function $G(x)$ can only be an antiderivative of $g(x)$ if it is continuous? My question arose from the fact that the derivative of the $F(x)$ I've mentioned in my post is $f(x)$ itself. Commented Feb 5, 2019 at 19:26
• @alexbrt: check Carser's comment.
– user65203
Commented Feb 5, 2019 at 19:36
• $G$ is not differentiable at $2$. The function $f$ in question can't possess an anti-derivative on any interval which contains $2$ as an interior point. Commented Feb 14, 2019 at 18:03