Main content

## Definite integrals of piecewise functions

# Definite integral of piecewise function

AP.CALC:

FUN‑6 (EU)

, FUN‑6.B (LO)

, FUN‑6.C (LO)

## Video transcript

- [Voiceover] So we have
a f of x right over here and it's defined piecewise
for x less than zero, f of x is x plus one, for x is greater than or equal to zero, f of x is cosine of pi x. And we want to evaluate
the definite integral from negative one to one of f of x dx. And you might immediately say, well, which of these versions of f of x am I going to take the
antiderivative from, because from negative one to zero, I would think about x plus one, but then from zero to one I would think about cosine pi x. And if you were thinking that, you're thinking in the right direction. And the way that we can make this a little bit more straightforward is to actually split up
this definite integral. This is going to be equal
to the definite integral from negative one to zero of f of x dx plus the integral from zero to one of f of x dx. Now why was it useful for
me to split it up this way, in particular to split the integral from negative one to one, split it into two intervals
from negative one to zero, and zero to one? Well, I did that because x equals zero is where we switch, where f of x switches
from being x plus one to cosine pi x. So if you look at the interval
from negative one to zero, f of x is x plus one. So f of x here is x plus one. And then when you go from zero to one, f of x is cosine pi x. So cosine of pi x. And so now we just have to
evaluate each of these separately and add them together. So let's take the definite
integral from negative one to zero of x plus one dx. Well, let's see. The antiderivative x plus one is... antiderivative x is x squared over two. I'm just incrementing the exponent and then dividing by that value. And then plus x, and you could view it as
I'm doing the same thing. If this is x to the zero,
it'll be x to the first, x to the first over one, which is just x. And I'm gonna evaluate that at zero and subtract from that, it evaluated at one. Sorry, it evaluated at negative one. And so this is going to be equal to... If I evaluate it at zero, let me do this in another color. If I evaluate it at zero, it's going to be zero squared over two, which is, well, I'll just write it. Zero squared over two plus zero. Well, all of that's just
gonna be equal to zero. It evaluated at negative one. So minus negative one squared. Negative one squared over
two plus negative one. So negative one squared is just one. So it's 1/2 plus negative one. 1/2 plus negative one, or 1/2 minus one, is negative 1/2. So all of that is negative 1/2. But then we're subtracting negative 1/2. Zero minus negative 1/2 is going to be equal to positive 1/2. So this is going to be
equal to positive 1/2. So this first part right over here is positive 1/2. And now let's evaluate the integral from zero to one of cosine pi, I don't need that first parentheses, of cosine of pi x dx. What is this equal to? Now, if we were just trying to find the antiderivative of cosine of x, it's pretty straightforward. We know that the derivative
with respect to x of sine of x is equal to cosine of x. But that's not what we have here, we have cosine of pi x. So there is a technique here, you can call it u-substitution. You can say u is equal to pi x. If you don't know how to do that, you can still try to think this through, where we could say, alright, well, maybe it involves
sine of pi x somehow. So the derivative with respect to x of sine of pi x would be what? Well, we would use the chain rule. It would be the derivative
of the outside function with respect to the inside or sine of pi x with respect to pi x, which would be cosine of pi x, and then times the derivative
of the inside function with respect to x. So it would be times pi. Or you could say the
derivative of sine pi x is pi cosine of pi x. Now, we almost have that here, except we just need a pi. So what if we were to
throw a pi right over here, but so we don't change the value we also multiply by one over pi? So if you divide and
multiply by the same number, you're not changing its value. One over pi times pi is just equal to one. But this is useful. This is useful because we
now know that pi cosine pi x is the derivative of sine pi x. So this is all going to be equal to... This is equal to one. Let me take that one over pi. So this is equal to one over pi times... Now we're going to evaluate. So the antiderivative here we just said is sine of pi x, and we're going to evaluate
that at one and at zero. So this is going to be
equal to one over pi. One over pi, not pi. My hand is not listening to my mouth. One over pi times sine of pi minus sine of pi times
zero, which is just zero. Well, sine of pi, that's zero. Sine of zero is zero. So you're gonna have one over pi times zero minus zero. So this whole thing is just
all going to be equal to zero. So this first part was 1/2, this second part right
over here is equal to zero, so the whole definite integral
is gonna be 1/2 plus zero, which is equal to 1/2. So all of that together is equal to 1/2.