Start  So you're trying to figure out, So we're doing backwards of derivatives, we're doing integrals.
And integrals can be used for a variety of things, but one of the main things they can be used for is summations. By the way Shannon, how much of that Thanksgiving thing did you get on video? Shannon: *none of it* Aw, my youtube fame just vanished! Oh no, I guess I'll have to keep this job a little but longer. Ok, well you can start whenever you're ready. Shannon: * I did*. Um, ok, probably just as well. 
0:32  Alright, so you can use integrals to do sums, summations.
Ok, well why would you care about sums? Well you want to add things up, that's what a sum is. And lots of times, I want to add up lots of things. For example, you're going to price stocks in finance class. Stocks are discrete, you get pieces of stock, and get issued dividends. And one way you come up with a long term evaluation of a stock, is by sort of extrapolating what you think it's dividends will stream over a period of time and using that to calculate the price. 
1:04  So what does that mean? Let's say you have stock in something ordinary, like Verizon.
Verizon issues a quarterly dividend, and you get a check. If you have 100 shares, you might get, lets say $4. And $4 isn't [?] it's not a lot of money, but remember if you have 1,000,000 shares, it starts to turn into real money. Um and then you get that ever quarter. You get your share of Verizon. And it's dividend in theory will go up. It will go up with inflation, 
1:32  it will go up because Verizon will do better.
And you want to add the stream of dividends up. So G.E. announced today that they're going to reduce their dividend. That's going to dramatically affect G.E's stock prices. Because either the dividend is going to go down for a period of time and its going to be lower, or, it's just going to have a blip. If it's just a blip, it doesn't really have much of an affect because G.E. is an 120 year old company and probably not going anywhere. 
2:02  But, if you think it is going to have problems, that's what you do.
So, you can add up the stock prices, now because these are what they call discrete, you only get them quarterly, you don't need to use an integral. You use an integral when you want to add up an infinite set of these. However, you could use an integral, the truth is you could probably get pretty close either way if you're doing General Electric. This thing does not want to stay on. 
2:30  So how do we add things up to do approximations?
So one of the problems you have with integrals is you can differentiate anything. You cannot integrate anything. There are many functions you can't integrate, and so you use approximations to figure out what the integral would be. And one way to do an approximation is by doing a sum of rectangles. So as I said last time, suppose you just had a curve, and you want to find the area under the curve and the x axis. So you want to find this region. 
3:07  You could say, well, I know that if I take a rectangle, here, and, I find the area that rectangle, then it's less than the area of the region.
So that's not very good, but I could bracket by doing the rectangle above and the rectangle below and sort of going half way between them. And that'd be about right, so I could do better if I did it with more rectangles. 
3:31  So I could say, cut this into a pair of rectangles.
Which means my error is this region. I am not adding up that region. You say, ok, instead of a pair of rectangles, let me do 4 rectangles. Why don't I cut it into 4 rectangles? Now how do you find the are of a rectangle? The area of a rectangle is base*height. 
4:04  So I take this region and cut it into 4 identical intervals.
And then that will give you the base of of each of these rectangles. So to find the height, the height is the y value. So what I do is I take one of the 2 points on the interval, either the left or the right, I'm going to take the left point, and go up to where the curve is and use that to establish the height of the rectangle. Now I go over say, for all these intervals, I go here and I go up to the curve and across. Like this. 
4:42  Ok? That gives me 4 rectangles. Now if I add up the are of those 4 rectangles,
It's already close to the area under the curve, we're still off, we will have these little regions, under here, they're less.
But if I did this again, and I did the rectangles above the curve, I'd probably get close. Now how do I do the rectangles above the curve? 
5:03  You take the interval and instead of going to the left side of the interval, going up until you hit the curve and go across, you go to the right side and go across.
Ok? Now I'm over estimating the area. And if I average the 2, I'm going to start to get pretty close. So let's see how we can do that mathematically. And instead of 4 rectangles, of course you could do 8 , they'd be thinner, but then I'd have to add up 8 of them, and then I'd say why not a billion? 
5:38  Ok, and then they'd be very very thin and there would be a billion of them, but I'd have very tiny error. Yes?
So the question is when it's under is it less, but when it's above is it more? That's right, if the curve is going up. If it's going down, it's the other way around. So you just, for now, just think about using the left side of each interval and the right side of each interval. 
6:02  So when I say interval, so let's pick a curve like y = x^2+3, so first of all what does that look like?
That's a parabola, and since we're only concerned about the first quadrant, it starts and 3 and just kind of goes up, just like those pictures. We can make a better curve, as I mess up the board, like that. Ok? 
6:34  And I mean, find the area under this from x=0 to x=4.
So I want to know what's the area under that. Well, this rectangle is 3*4 =12, so it's certainly more than 12. And 4^2+3 =19, so it's certainly less than 4*19. 
7:01  So it's somewhere in the middle.
So you say, ok, I'm going to use 4 rectangles. 4 is a nice number, it's not too stressful. So I'm going to cut this xaxis at 1,2 and 3. Now how am I going to find the rectangles. Well let's see. Well first of all, when x is 1, 1^2+3 =4, When x=2, 2^2+3=7, 
7:30  When x=3, 3^2+3=12.
So now I have what will be the heights, ok? And you say, alright, and you take this first interval from 01, so the width of that rectangle is going to be 1, and the height is if I go up to f(0), and go across and draw a rectangle. So it's 1*f(0), which we know if 3, but we'll fill that in in a minute. And we say, ok, next rectangle. 
8:01  And you go to the left side of the interval from 12, which is 1, draw up till you hit the curve and go across.
So the width again is 1, and this time is at f(1). That's the height of the rectangle. You see how I'm getting these numbers? Ok? The x value is well I choose to take the interval from 04 and cut it into that many pieces. And this 1, is the width of each one of those rectangles. 
8:30  And the height is found by evaluating the function at the left end point of each of those cuts in the x axis.
So the next one, you go up to 2 and across, And for the last one I go up to 3 and go across. Ok? So to get the height of each rectangle, you're going to use the y value and the y value is where you hit the curve. 
9:08  Now I add these up. So what is f(0), f(0) is 3,
f(1)=4, f(2) =7, and f(3)=12.
And I add that up and I get 26. 
9:31  Well, the area's about 26.
It's bigger than 26, because I know I'm not getting the whole area. I'm missing all of that. So how can I do better? Well as I said I can cut it into more rectangles, I could cut it into 8 rectangles, or 16 rectangles, they don't have to be multiples of 4. You could cut them in to 20, 30, 50, 100, you could use a computer, you cut it into 100 rectangles, it'll be very accurate. 
10:01  You want by tiny bits. Imagine this is cut into 100 of these. Every little rectangle coming closer to the curve.
As you get closer and closer and zoom in on the curve, it starts to look like a line, it stops looking like a curve. You say, ok, but I want to do better with just 4 rectangles. Well, now, let's do it again, and instead of picking the left hand side of each interval, we'll pick the right hand point. 
10:30  We got those y values by evaluating points of the function.
Alright, now let's do rectangles again, but this time let's do the right hand rectangles. So these are called left hand rectangles or left end point rectangles, And we abbreviate that LHR, And when you use right hand rectangles, well the width of each of these rectangles is still going to be 1, but now I go across at 1, I go to the curve and then go down. 
11:10  And that gives you the height. So the first one's width is 1, and the height is f(1).
Now I repeat, I go up to 2, and go across. And I go up to 3 and across, 
11:32  And 4 and across.
So certainly over estimated this time. But let's see what that comes out to. f(1) =4, f(2)=7, f(3)=12 and f(4)=19. 
12:04  Now I get 42. So using right hand rectangles,
Or RHR, I get 42.
So since a good guess would be halfway in between 26 and 42, which is 34, we'll do more on Wednesday, 
12:35  And then Wednesday, you can come up with the exact number, but we'll focus on doing these for now.
Ok? So a good guess is halfway between those 2 numbers. Which, by the way doing halfway between those 2 numbers is doing trapezoids, if you were curious We'll worry about that later. So we understand the general principle? So let's have you practice one. Let's put this up here so everybody can see it. 
13:17  Notice, I pick nice easy numbers, everything's an integer,
Of course this could get messy, you could go from 01, with 4 rectangles and the width of each rectangle would be 1/4.
You'd have to start plugging in fractions. Very rapidly you say this isn't fun anymore. You switch to a calculator or a computer. 
13:37  But we'll do another easy one. Let's say you have the curve
And we want to estimate the area under the curve using 4 LHR, and 4 RHR.

14:10  And the curve, looks just like our other one. It looks like a parabola, because it is a parabola. Ok? Take a minute, see how you do.
I should put that in, I mean it's not automatically equal to 0 after all. Alright, let's do this. 
14:33  So we want to estimate the area from 04, our rectangles will be at 1,2 3 and 4.
Ok? Just like the last problem. That's going to be our 4 rectangles. The width of each of those is 1, the height of the first one, so if we're doing LHR, 
15:06  So it would be 1*f(0)+1*f(1)+1*f(2)+1*f(3).
By the way notice, first of all we're multiplying by 1 each time, but you could factor that 1 out. Since they all have the same width you could pull that out. Cause we're going to do one in a minute where the width is not 1, and you can simplify the arithmetic. 
15:36  So f(0)=1, f(1)=3, f(2)=9, anf f(3)=19.

16:01  So after you get the f values out of the equation 2x^2+1,
Ok? So I plug in the x coordinates to get the y values. And I use the x coordinates starting at the left most end point and count up until 1 before the right hand end point
So that's 32.
And if I wanted to do the right hand rectangles, 
16:30  It's the same idea, except now we're getting the rectangles at the right side of the interval, and we go up and across.
As I said, this will over estimate. So we know that the area is more than 32, now we can find what it's less than. So this will be 1, well what's the right end of 01, 1. And what's the right end of 12? 2. And then 3 and then 4. 
17:06  So this is 1*(3)+1(9)+1(19)+1(33)
That's 64.

17:30  So a good guess would be halfway between those 2, which is 48.
Ok, now let's do this and make it slightly more difficult. Because I know you guys want it to be more difficult. The function y=x^2+x+1 Estimate the area, from x=2 to x=4, using 4, let's just do LHR for the moment. That's a little messier. 
18:15  So x^2+x+1 is still just going to be a parabola shape,
And now we're going to go from 2 to 4.
Using 4 rectangles. 
18:37  So our x coordinates are more annoying.
We start at 2, we go to 4, we cut that into 4 pieces, so 4 equal pieces is 2, 5/2, 3,7/2 and 4. And then you get each rectangle by taking the left end. So what's the left end of 2 and 5/2? 2, and then go across. 
19:03  And then from 5/2 to 3, you take the left side, that's 5/2, and go across.
And then from 3 to 7/2, And then from 7/2 to 4. So the width of each of these is 1/2. You have 1/2*f(2)+1/2*f(5/2)+1/2*f(3)+1/2*f(7/2) 
19:50  And what is f(2)? 2^2+2+1=7.

20:00  f(5/2)=(5/2)^2+5/2+1 = 39/4 f(3)=3^2+3+1=13 And f(7/2) = (7/2)^2+(7/2)+1 = 67/4 
20:36  So this becomes, (7/2)+(39/8)+(13/2)+(67/8)
Which is let's see, 186/8.
Or 93/4. Ok? That's a messy number, right? Now of course you could use a calculator, right and I probably messed up, maybe I didn't. 
21:09  Ok? If I give it to you on an exam, you won'e be able to use a calculator. So either I would say stop here,
Ok? Or we say something like set it up, or we have to give you easy numbers, we'll give you integers.
I don't think it's unreasonable to ask you to square 1/2, but you know, this could be x^3, or log or e or one of those things. Then you really just can't do it. 
21:36  Ok? Then you need to use the computer.
Yeah so you get the idea. It doesn't have to be integers, it doesn't have to be from 04, you could go from 22.1. You could use 12. Ok? So the width of these can start to get very obnoxious and the y value can get very difficult. But let's just have you practice setting one up. 
22:01  So if I give you, y=x^3+2x, estimate the area from x=3 to x=5, using 4 LHR and 4 RHR. I only want you to set it up. I just want you to show that you can find the correct pieces.

22:40  Ok? Don't try to calculate it, I don't care what it comes out to.
Again, x^3+2x is just going up, and we're going from 35. So you're going to want to cut that into 4 pieces. 
23:00  So what's halfway between 3 and 4? 7/2.
4+5 is 9, so 9/2, so 3, 3.5, 4, 4.5, and 5. So we'll see if you know what you're doing. Ok, so how wide is each of these rectangles? Each of these rectangles is 1/2 wide. So to do the LHR, 
23:38  You have a width of 1/2*f(3)+1/2*f(7/2)+1/2*f(4)+1/2*f(9/2) 
24:02  Ok? That's all I would want to see. I don't need you to work out what those numbers are. Because (9/2)^3+2(9/2) is 881/8.
I think that's right, I could be wrong. Notice though, you could factor out the 1/2. And you would have f(3)+f(7/2)+f(4)+f(9/2) 
24:31  Ok? So one thing you could do to simplify these is they're always the same width, so you could factor with width out of the problem, then you only have to write it once.
So if you were setting up the computer program or the more complex calculation, what happens is at some point you turn this into an integral. And then taking this out, makes like a lot easier. So if we're doing the right hand rectangles, The width again is 1/2, 
25:02  But now instead of starting at 3 and finishing at 9/2, I'm going to start at 7/2 and finish at 5.
So I'm going to have (1/2)[f(7/2)f(3)+f(9/2)+f(5)] and again, I don't really care what the number is. Ok? Notice, 3 parts of this are the same, only the left end differs and the right end differs. 
25:32  Everything in the middle is the same calculation.
So once you have one of these, you can see how theres some sort of error built in. Because this one is using your lower number to give you an under estimate, and this one is using the higher number. Now, somebody asked earlier, so left hand is always less and right hand is always bigger? Well, not necessarily. Depends on what the curve looks like. 
26:07  Suppose you had a curve where you're going down. Like that.
Ok, now when you draw the rectangles, Well, bad example, sorry. Going down this way. Ok? And now, the left hand rectangles are over estimating. 
26:36  And the right hand rectangles are giving you rectangles that are under the curve.
So if the curve was going up from right to left, then the left will under estimate it. Ok? And of course, we could have a curve that's doing both, then some of the rectangles will under estimate, and some of the rectangles will over estimate. 
27:07  That's why it's nice to have 2 systems, an under and an over.
Ok? Because when you put them together you can usually get a very accurate estimate. But you don't really want to have to always calculate twice, so the other way that you get more accurate is that you just do more rectangles. So, let me pick another example, 
27:33  To go back to our x^2+3 example,
Let's say I went from 04 but I wanted to use a lot of rectangles. So 8.
So now each one would have a width of 1/2, 3/2, 5/2, 7/2, 
28:12  So you can see I'm starting to have less error.
And then this would be, each of these has a width of 1/2, And I would have (1/2)[f(0)+f(1/2)+f(1)+f(3/2)+f(2)+f(5/2)+f(3)+f(7/2)] and that would be my left hand rectangles. 
28:48  But now I have 8 of them.
And if I was doing a right hand side, I'd have 1/2, thats the width of all of them, 1/2[f(1/2)+f(1)+f(3/2)+f(2)+f(5/2)+f(3)+f(7/2)+f(4)] ok? So they start to have many more terms in common. 
29:24  And they're only different by the end term each time. Ok?
Ok? So this will give me a better estimate just using 8. I could do 16, as I said I could do 100, you could even make a little computer program and do it in excel or your calculator or whatever. 
29:37  And you could do n=100, and by 100 you're going to be incredibly accurate.You don't really need to do left and right.
You could just do left or just do right, and what will happen is algebraically we don't do that in this class, You say what if I just had an infinite number of them and they're infinitely thin, because I'm cutting them into an infinite number of pieces. So of course you can't use infinity, but you could take a limit, so you could say, let's cut it into n rectangles, 
30:04  come up with a formula.
Ok? the width of each of these is the whole interval divided by n, because there's n of them. The height well, I'd start at some value, cut it into n pieces. So I have to add all of those up. So if I took the limit of that, it turns into the integral. So that's what we're gonna do. You'll see we'll do more of that next class, that's the magic jump, is going from doing it in discrete pieces of rectangles 
30:31  into doing it in an infinite number of pieces
and getting the integral. Just like with the derivative, we would take smaller and smaller pieces of the curve for the tangent line and secant line,
and then we'd do an infinitely thin difference between 2 points to do the secant line, and that gives you the tangent line.
So these 2 are linked. We won't get into that, but the derivative and integral are linked and as you saw, when you're integrating you're doing the anti derivative. 
31:01  So this infinity concept links the 2 of them together. This cutting things into infinitely narrow pieces.
Ok, so I can see you guys are all getting a little sleepy, so we'll pick up on Wednesday. 