If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

# Definite integral of piecewise function

AP.CALC:
FUN‑6 (EU)
,
FUN‑6.B (LO)
,
FUN‑6.C (LO)
Sal evaluates definite integral of a piecewise function over an interval that goes through the two cases of the function.

## Want to join the conversation?

• hello,

I don't understand why we can split the integral in two distinct integral.

the first from -1 to 0 and the second from 0 to 1.

f(x) = x+1 for value of x < 0

so f(x) = x+1 is not defined for 0

what I am missing ?

thanks

best regards

please forgive my approximate English, I'm French.
(26 votes)
• It is one of the properties of the definite integral. The definite integral is just the area under the function point x=a to x=b. Now if you pick a point x=c between (a,b) and draw a line there, wouldn't the area from a to b is the same as a to c plus c to b? It's easier to see with a graphical illustration. So try to do that.
(14 votes)
• My apologies if this sounds like a stupid question, but since it is x<0, then why are we writing the integral from -1 to 0 if it is less than 0? We could have written it from -1 to 0 if it was x<or equal to zero. So, what am I doing wrong?
(8 votes)
• Hi Oliver,

I don't think you really answered redsondeathstroke40's question ^^
I understand the principle of cutting two functions and glueing them back together.
However, what makes it possible to use F(-1) - F(0) as the area under the curve for the first equation, since this equation doesn't include 0 ?

Now, I think I get it : since the result of both equations for x=0 happens to be 0, it doesn't change the result to operate in this way. But wouldn't this lead to a mistake if it weren't the case ?
(7 votes)
• At seconds, wouldn't it be better to take the limit as some arbitrary letter (I used "n") approaches zero for the top bound of the first definite integral in that pair? I ask because the way the function is defined says "x+1" is not defined for x=0, but cos(pix) is.
(4 votes)
• At I am confused about why 1/π is used instead of of π . Please, help!
(7 votes)
• So, in the last derivative expression that Sal gives (d/dx[sin(pix)] = picos(pix)), we know that if we have a picos(pix) somewhere, we can easily go to the antiderivative of sin(pix). However, the problem is that we have no coefficient of pi in our integral.

This is okay though! We can add in a coefficient of pi, as long as we counteract it with a 1/pi. This is because pi x 1/pi just equals 1 and we're not changing our integral if we're multiplying by one.

Since we now have a pi as a coefficient, we can substitute in sin(pix) for picos(pix) and the 1/pi will just stay as a remnant from our earlier manipulation.

It is a little bit more straightforward if you use actual u-substitution, so I definitely recommend tackling the integral that way if you know how to.
(5 votes)
• At , x+1 is not define at x = 0, is it okay to take the integral of f(x) at the interval [-1, 0]?
(4 votes)
• that's one of the properties of definite integrals.

it is easier to see if we visualize both parts of the function at x=0.

the limit of x+1 as x approach 0 is 1.

cos(πx)=1 when x=0.

this means we have a continuous function at x=0.

now, sal doesn't graph this, but you can do it to understand what's going on at x=0.

if we have 3 x'es a, b and c, we can see if a(integral)b+b(integral)c=a(integral)c.

in this case we have a=-1, b=0 and c=1.

so the integrals can be added together if the left limit of x+1 and the right limit of cos(πx) is equal at x=0.

i hope this was a little helpful!
(3 votes)
• Would the definite integral of this piecewise function still be the same if the function weren't defined at x=0?
(2 votes)
• It depends what happens at x=0. If there is a vertical asymptote, then you might still be able to find that area anyway... think about it again after you've studied convergent series. If it's a removable discontinuity, then removing one point from the function is subtracting an area of 0 from the total, and it should still be the same answer as if it were defined at 0.
(4 votes)
• I saw in one of the videos the that when you are taking the definite integral from a to b, a and b are included. In this video Sal uses 0 for the upper bound for the first integral. If the piecewise function defines using x + 1 only for x < 0, why are we allowed to use 0 for the upper bound? Thanks in advance!
(2 votes)
• We are allowed to use zero as the upperbound because the function is continuous at x = 0. The limit as the piecewise function approaches zero from the left is 0+1=1, and the limit as it approaches from the right is Cos(Pi*0)=Cos(0)=1. We separate the integral from -1 to 1 into two separate integrals at x=0 because the area under the curve from -1 to 0 is different than the are under the curve from 0 to 1. The functions evaluated at x=0 are the same, so adding the two definite integrals after we evaluate them at their A's & B's gives us the total area of the piecewise function from -1 to 1. I hope that helps!
(3 votes)
• how do you know what numbers to split the definite integral into
(2 votes)
• if the integral from 0 to 2 of a function = 0, and the integral from 1 to 3 = 0, why doesnt the integral from 0 to 3 equal 0?
(1 vote)
• Consider the piecewise function that equals -1 for x in [1, 2], and equals 1 otherwise. Look at the areas you're asking about. What do you see?
(3 votes)
• I understand what definite integrals are but what are indefinite integrals ?
(1 vote)
• An indefinite integral is the same thing as an antiderivative which is a function identical to this:
If `g(x) = ∫f(x)dx` then
`g(x) = ∫(from 0 to x)f(x)dx`.
In other words, it's the opposite of a derivative.
(2 votes)

## 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.