 In this video, we'll provide the solution to question 22 for the practice. Final exam for math 1210, in which case we're asked to evaluate the definite integral from 0 to 4 of x squared minus 4x plus 2 with respect to x using the definition of the integral. By definition integral, we're talking about the limit of a Riemann sum. We can use the fundamental theorem calculus to check our answer, but you won't get any credit for using FTC. You do need to use the definition that is limits of Riemann sums like we're going to see right here. So to help get us started, let's consider delta x. Remember, delta x is the length of a rectangle and the general formula is b minus a over n for which b is the top of the interval, a is the bottom right here, so we're going to get 4 minus 0 over n, and it's going to be the variable of the limit we're going to compute in just a moment, so we're going to leave it alone. So this tells us that delta x is 4 over n. Then from here, we need to choose a representative for each interval, this xi star. Now, to make life a little bit easier, we are just going to use xi, the right endpoint, which has the formula a plus i delta x, which a is the same value we had over here, so when that a value is 0, that is a generous token right there, and then delta x, which we did a moment ago, is 4 over n. So our xi is going to look like 4i over n. So again, leave the variables i and n as part of it. So now we're ready to compute the integral, so we have these preliminary things taken care of. So we take the integral from 0 to 4 of x squared minus 4x plus 2 dx, and so now we're just going to write the definition. So this is the limit as n approaches infinity, you do need that limit there for full credit. Take the sum, now the Riemann sum, where i ranges from 1 to n, this n on top is the same n as over here, and so then this is going to be f of xi times delta x. This right here is the definition, this is what that integral is defined to be. Now we're going to plug in the appropriate parts of this thing, so retain the limit symbol, we need to carry that through the entire process until the very end. We're going to take this sum and where i ranges from 1 to n. Now we're going to plug in the specifics of this function. So we have the function f of x, which is given right here, this is our f of x, and so for each x we're going to replace it with an xi. So I'm going to use square brackets to help set this thing apart right here. So we have to take xi squared, which is going to be a 4i over n squared. Then we subtract from it negative 4 times xi, which is 4i over n, and then we're going to add 2 to that. Then we have to times that by delta x, which delta x was 4 over n, and now we go from here. Now when it comes to these Riemann sums, the sum is respective to the variable i. So anything that's not really involving i can basically be taken out, multiples that is, that is respect to the variable of the sum, 4 over n is constant and can come out. So 4n is going to be the same for each and every i. So we're going to factor that out of the process, just to make it a little bit cleaner. We'll come back to it later. Take the limit as n goes to infinity of 4 over n. You can always do that for delta x. Delta x doesn't depend on i whatsoever. And then we take the sum where i ranges from 1 to n. You still use some square brackets. Let's clean this thing up a little bit. We're going to get 16i squared over n squared minus, well this time you get 4 times 4, so 16i over n, and then we get a plus 2. And so now using properties of summation, we're going to break this thing up into three separate sums. So we take the limit as n goes to infinity here of 4 over n. And so now we're going to break it up into three different sums. We're going to get the sum 16 over n squared times the sum i equals 1 to n of i squared. So basically again, I use the fact that n is constant with respect to the summation. So 16n squared was able to come out. Then we're going to get a minus 16 over n and the sum where i goes from 1 to n of just i. And then finally, we're just going to get the sum of 2 as i ranges from 1 to n. And so this is the moment where we're going to use our summation formulas that we have learned previously. And so putting those in here, we're going to get the limit as n goes to infinity of 4 over n. So do these one at a time, so 16 over n squared. So the sum from where i ranges from 1 to n of i squared. Again, this is a formula that you're going to need to know. This is going to look like n times n plus 1 times 2n plus 1 all over 6. For the next one, we are going to take the sum where i ranges from 1 to n of i. That has the general formula of n times n plus 1 all over 2. And then the last one, if you just take the sum of 2 and you do that n times, you're going to end up with, in that case, just a 2n, like so. Now let's try to simplify these things a little bit more. I'm going to finally distribute this 4n onto each of these pieces. And again, my goal is to try to simplify things as much as possible right now before I take the limit as n goes to infinity. I noticed that 6 and 16 do have a common factor of 2. So there's going to be a 3 right here and an 8 left behind there. Also, this one of the n's in the bottom is going to cancel out with this n right here. So then when we distribute the 4 over n, you're going to end up with 4 times 8, which is 32. You're going to get an n plus 1. You're going to get a 2n plus 1 on the top. And in the bottom, you're going to get a 3 times n squared. For the second one, you have n's that cancel, 2 goes into 16, 8 times. You're then going to distribute the 4 over n onto that, in which case you're going to get a negative 4 times 8, which is 32 times n plus 1. And this sits above an n. And then for the last one, you'll distribute the 4 over n. So you get 4 times 2, which is 8n over n, for which then these n's likewise cancel out right here. This is a good place to check your work so far, because if you've done everything correctly, these rational functions should be balanced. So what do you mean by balanced? If you look at the number of n's on the top, that should equal the number of n's on the bottom. So you have two n's on top, you have two n's on the bottom. You have one n right here, one on the bottom. These ones all cancel out. So these are balanced rational functions. This is significant because as n goes to infinity, which is the limit we're considering right here, as n goes to infinity of a rational function, if it's balanced, the limit will equal the ratio of the leading coefficient. So on the top, you see that as n goes to infinity because it's a balanced rational function, you get 32 times 2 over 3. Then you're going to get minus 32. You divide by 1 there, but I'm leaving that off. And then you're going to get an 8 right there, for which, of course, 32 times 2 is 64. So you get 64 over 3. 32, if you times it by 3, you're going to get a negative 96 over 3. And then 8 times by 3 over 3, you're going to get 24 over 3. And if you add those together, you're going to end up with a negative 8 thirds, which is the area under this curve. And if you checked your work using the fundamental theorem of calculus, this would be the exact same value you got.