 Sometimes we desire that the average rate of change for a function f can be computed on the interval a to a plus h. What does that even mean? Let's unravel that for a second. Suppose we have the x-axis right here, x-axis, and we have some fixed point on there, we'll call it a. Now, if we were to perturb the x-coordinate a little bit to the left or a little bit to the right of a, let's go to the right just for the sake of illustration. Let's say that the distance, the distance from a to this new point, let's call that distance h. If that's the case, then this other point is none other than a plus h. After all, if you take the absolute value of a minus a plus h, in the end you're going to get h, and so that's the distance between the two. What if we take h to be a really, really, really, really small number? What if we do something like this? Ooh, h is just so small, right? You can't even see it. You've got to be like ant man and zoom in. What if it's really, really small? That means you're really close to a, but you're a little bit to the left or a little bit to the right, depending on this small choice of h. Why would anyone be interested in that? Well, consider the following example, right? We're going to return, we're going to return to this example we did in the previous video. Take the function f of x equals 3x squared, it's a parabola, and I put this on the same scale that the graphic in the previous video looks like. You can see in blue right here, our parabola here. And then consider the fixed point 1, 3. This was a point we were playing around with previously. And so we then considered the point 7, 147. That was just one of the points we saw earlier. And we then computed the secant line, well, the slope of the secant line, which the secant line you can see in orange right here. So we can see that as you move, like as we move this point here, as it gets farther away from x equals 1, the secant slope, excuse me, gets bigger. As you drag this thing closer, go the other direction, right? As you put this point closer and closer, the slope is getting smaller, smaller, smaller. So how close can we get, right? We can get this pretty, pretty close, right? What if the distance between this x-coordinate right here, we have a 1 right here, and this one is 1.31. That's pretty close, right? The difference is only h is 0.31. What if we get closer and closer and closer? How close can we get? Well, we can zoom in the picture a little bit, because whenever you think you got close, it just means shrink the scale and oh, when you shrink the scale, things get farther away. But then we could still bring the point closer, closer, closer, closer, closer, closer, closer, closer, right? Now in this situation, you have A is 1 and h is 0.0286. That's pretty small, right? It's only about 3100s. But we could bring the point even closer, closer, closer, closer, closer, closer, closer, right? That looks really close, but again, if you just zoom in, zoom in, zoom in, there's always a huge gap between the numbers. If we go to the right scale, but you can always zoom, zoom, zoom, zoom, zoom, zoom, right? You can get closer, closer, closer, zoom in some more, closer, closer, closer, closer, right? So now we're only four 10,000s away from the point. And always in this situation, we can compute the slope of the secant line. So I'm going to zoom back out to the scale we had moments ago. Boy, we got our lost in the, I think, in the quantum realm for a while there. Okay, we're good again. So come back to this scale. When you look at this scale, the two points look like they're hovering on top of each other, right? The white point 1.0004 looks like it's identically over 1.3. We know that's not the case because there is a difference of the X coordinates, but they look like they're, they look like they're the same point. So when you zoom out farther, that orange line, which was a secant line, it actually looks like what we call a tangent line. What is a tangent line? A tangent line is a line that touches the graph only at a single location. Just one location do they touch. And we get a tangent line. This isn't really the tangent line. This is a secant line, 1 and 1.0004, something like that. They're different points, but it looks like a tangent line. But notice there is a slight problem. If we actually want the tangent line, we could slide H so that H is zero. And let's do that on the computer right there. What happened when H is zero? You'll notice that the tangent line, the secant line disappeared, right? Where did the line go? Well, when you ask the computer, where's the line? It's like, well, I can't compute it right. Because if you look at the equation for the line right here, we'll talk some more about this in the future. But you get Y minus F of 1 equals the slope, which is the average rate of change, F of 1 plus H minus F of 1 over H. Notice the denominator here, H, this is just 1 plus H minus 1. So you're going to get, this simplifies just to be an H in the bottom. And then you get X minus 1, right? This gives us this equation right here. The problem is if H is zero, the average rate of change would require that you divide by zero, which is no good. We can't divide by zero. That's not a number. And that's why the computer gets confused when H equals 1. But if we pick a number that's really close to zero, right? If we go back to 000001, we get something that's really close to zero, but it's not zero. And therefore, it looks like we could kind of guess what the slope of that line would be of tangency. And so this is a critical idea right here when it comes to this average rate of change. In physics, they're often interested in this quantity, which we refer to as the instantaneous rate of change. What's the rate of change at a moment? X equals zero. Because if you're driving a car down the road and you get pulled over by a police officer and the police officer is like, you were going 90 miles in a school zone. That's only supposed to be 20 miles per hour. And you're like, but officer, my average speed was only 15 miles per hour. Did you see how long I'll stop that traffic stop? That cross guard had that stop sign for a really long time. The police officer is not going to care about your average speed. He's going to care about your speed at that instant. He shot you with the speed gun. And the speed gun said you were going 90 miles per hour. Average rate of change is important to estimating a function, but better than that is a notion about instantaneous rate of change. And it turns out that if we slightly modify our average rate of change formula to this, this gives us a power to compute instantaneous rate of change. Let me illustrate on the next example. We're going to keep on using the same function. f of x equals 3x squared. Compute the value f of 3 plus h minus f of 3 over h. We want to simplify this quantity. So you'll notice that when you look at this average rate of change, delta y over delta x here, you get f of 3 plus h minus f of 3 over h. Well, what does f of 3 plus h mean? It just means you replace the x in the formula with 3 plus h. So you get 3 times 3 plus h squared minus f of 3. Well, f of 3 will just be 3 times 3 squared. This will also be above h. And let's see, like 3 squared times 3. We did that earlier. That's a 27. You'll get 3 times, well, we'll leave it alone for a second, 3 plus h squared minus 27 over h. Because if you want to calculate the instantaneous rate of change, you want to figure out what happens when h goes to zero in the denominator. But we can't plug in h equals zero because that would make the thing undefined. It turns out there's a very nice algebraic trick we can do. If we simplify this fraction magically, or I should say, method magically, the h is going to disappear. Now this will be accomplished by expanding the numerator. Take the 3 plus h squared and foil it out. 3 plus h times 3 plus h. If you do the foil technique, you're going to get first 9, outside 3h, inside 3h, last h squared minus 27. This all sits above the h still. Distribute the 3 and combine like terms on these things. You're going to end up with 3 times 9, which is 27. You have a 3h plus a 3h, which is a 6h, times that by 3, you get 18h. And then you're going to get, that should be an h squared right there, because you have h times h. You're going to get 3 times h squared, and then minus a 27, like so. Notice in the numerator there's a 27, minus a 27, they cancel. Looking at the numerator, this is where the math and magic comes into play here. You have 18h over 3h squared over h. We want to get rid of that h in the bottom. Notice in the numerator that everything is actually divisible by h. You have an 18h, you have an h squared. What if we were to factor out that h? If we did that, we'd have h times 18 plus 3h over h. And now you can see that the h cancels out, and this equals 18 plus 3h. Now, in previous lectures, I was telling you things like, oh, when you have a function that's a rational function, when you simplify it, you have to remember the original denominator, the original domain, right? So the original domain told us that, oh, h can equal 0. But we're kind of in the situation where we're like, but please, please, Dr. Missildine, can I let h equal 0? Well, in this formulation right here, h cannot equal 0. But in this simplified form right here, h could equal 0? What would prohibit us from plugging in h equals 0? You plug in h equals 0, the 3h would disappear, and you'd be left with this great magical number, 18. What is this 18 measuring? 18 is measuring the instantaneous rate of change, that as we allow h to go to 0, the slope of the tangent line would equal 18 units, so 18 vertical units per horizontal unit. And so by simplifying to a form where h equals 0 is actually allowed, we can fix the broken denominator. The original function, its domain did not allow 0, but because of this algebraic simplification, we now have a function for which it should be equal to the original function. It's not except at 0, but they only differ by what happens at h equals 0, so what we're going to do is the original function was a bucket with a hole in it. The hole was leaking when h equals 0. Well, guess what? We're going to slap a patch on it, ba-boom-boom, and we fill in the hole, and we say, oh, at h equals 0, we want the function to equal 18. We can fix the hole by patching it up, and what we've now done here is called calculus. Calculus is the technique of plugging in the holes that occur with our functions. Many of our functions have problems with their domains and ranges. Calculus is the surgery we do to fix the broken parts of our function. And so that's how we can transition from average rate of change to instantaneous rate of change. It's called calculus. But as you can see from this example here, calculus actually relies a lot on algebra. If one is going to be successful in a calculus course, it is imperative that you have algebraic skills. Basically, every part of this problem was algebra. You look at this thing, it's like algebra, algebra, algebra, algebra, algebra, algebra, algebra, no, no, no, no, here was calculus. This very last step was the only part where calculus came into play. The rest of it relied upon algebra, and that is why it's so important that Daniel Son learns how to wax on and wax off by painting the fence, by sanding the deck. He's learning the skills he needs, which when applied properly will help him defeat the Cobra Kai in the All-Valley tournament. That's our goal after all, isn't it? We want to defeat the Cobra Kai. That's where calculus comes into play, but in order to do that, we need to understand all of the other tools that go into that. And so I wanted to show you this in this video to give you a little bit of understanding of where we're trying to go, and in the subsequent videos, I'll show you some other examples of simplifying difference quotients.