[MUSIC] We're going to calculate the derivative of x squared with respect to x. maybe a little bit more prosaically, I want to know how wiggling x affect x squared? There's a ton of different ways to approach this. Let's start by looking at this numerically. So let's start off by just noting that 2 sqyared is 4, and I'm going to wiggle the 2 and see how the 4 wiggles. Instead of plugging in 2, let's plug in 2.01. 2.01 squared is 4.0401. And let's just keep on going with some more examples. 2.02 squared is 4.0804. 2.003 squared, say, is 4.012009. Alright, so those are a few examples. I've wiggled the inputs, and I've seen how the outputs are affected. And of course the, all the outputs are close to 4, alright? But they're not exactly 4. When I wiggled the input from 2 to 2.01, the output changed by about .04, and a little bit more, but that'ts a lot smaller. When I wiggled the input from 2 to 2.02, the output changed by about .08, not exactly .08, but pretty close to .08. And when I wiggled from 2 to 2.003, the output changed by about. About .012 and a little bit more, but, you know, it's close. Now look at the relationship between the input change and the output change. The input change by .01, the output change by 4 times as much, about. The input change by .02, the output change by 4 times as much. The input change by .003, the output change by about 4 times as much. I'm going to summarize that. The output change is the input change magnified by 4 times. Right? The input change by some factor. And the output change by about 4 times that amount. Let's see this at a different input point. Instead of plugging in 2, let's plug in 3 and see what happens. So 3^2 is 9, but what's, say 3.1^2? That's 9.61. Or what's 3.01^2? Well, that's 9.0601. maybe wiggle down a little bit. What's 2.99 squared? That's close to 3 but wiggling down by .01. That's 8.9401. Let's see how much roughly the output changed by. When I went from 3 to 3.1 the output changed by Out point 6. When I went from 3 to 3.01, the output changed by about .06, and when I went from 3 down to 2.99, the output when down by about .06 again. Little bit less. Now what's the relationship between the input change and the output change? Well here the input changed by .1, the output change by .6, about 6 times as much. Again, the input change by .01, the output changed by About six times as much. And when the input went down by .01 the output went down by about six times as much. So again, we're seeing some sort of magnification of the output change to the input change, but now it's magnified not by four times But by six times. So the important lesson here is that the extent to which wiggling the input affects the output depends on where you're wiggling. If you're wiggling around 2, the output is being changed by about four times as much. If you're wiggling the input around 3, the output is being change by about six times as much. Instead of doing just a few numerical examples, let's generalize this by doing some algebra. So, I'm starting with x^2 and I'm going to wiggle x and see how x^2 is effected. So, instead of plugging in x, I'll plug in x + something, let's call the change in x, h. Now I want to know, how is this related to x ^ 2? Well I can expand out (x+h)^2, that's x^2+2xh+h^2. So when I wiggle the input from x to x+h, how is the output being affected? Well the output, is the old output value plus this change in output value 2xh+h^2, h^2 is pretty small. When h is small, h^2 is really small so I'm going to throw that away for now. And just summarize this by saying that the output change is 2xh and the input change. Is h. Now the derivative is supposed to measure the relationship between the output change and the input change. So I'm going to take the ratio of the output change to the input change, and 2xh/h=2x, as long as h isn't 0. This is the ratio of output change to input change and that makes sense, right? Think back to what just happened here a minute ago, when we were plugging in some nearby values and seeing how the outputs were affected. When I was wiggling the input around 2, the output was changing by about twice 2. When I was wiggling the input around 3, the output was changing by about twice 3, alright? 2x is the ratio of output change to input change. If the algebra's not really speaking to you, we can also do this geometrically, like drawing a picture. Here's a square of side length x. The area of this square is not, coincidentally, x^2. Now I want to now the derivative of x^2 with respect to x. I want to know how changing x would affect the area of this square. Now to see this here is another square. This is a slightly larger square of side length x+h. h is a small but positive number. So how does the area of this new square compare to the area of this old square? Let me put the old square on top of the new square, and you can see that when I change the input from x to x+h, I gained a bit of extra area. The derivative is recording the ratio of output change to input change. So, I want to know what's the ratio of this new area as compared to just the change in the input H. So, let me pull off the extra area. There is extra area, is this L shaped region. How big is this L shaped region? Well, this short side here, has side length h. This side length here, is also h. This is the extra length that I added when I went from x to x+h. This inside has length x, and this inside edge has length x. Now I want to know the area of this region. To see that, I'm going to get out my scissors and cut this region up into 3 pieces. Now here's one of those pieces. And, here's another one of those pieces. And, here's the third piece. So these are the 2 long thin rectangles, and they've both got height h, and length x. I'm also left with this little tiny corner piece. And that little tiny corner piece has side length h, and the other side is also length h. It's a little tiny square. Well the limit, this little tiny corner piece, is infinitesimal. I'm going to throw this piece away and most of the area is left in these 2 long, thin rectangles. If I rearrange these long, thin rectangles a bit, can put them end to end. They've both got height h. So I can put them next to each other like this. And their base is both length x. So how much area is in this long thin rectangle? Well, it's height h, it's width is 2x. So the area is 2x * h. Now this is the additional area, excepting for that little tiny square, which we gained when I changed the size of the square from x to x + h. So the change in output is about 2 * x * h. The change in input was h, so the ratio of output change to input change Is 2 * x. Maybe what we're doing here seems a little bit wishy washy, not really precise enough. But we can also calculate the derivative of x ^ 2 with respect to x, by just going back to the definition of derivative in terms of limits. Carefully, f of x is x^2. And the derivative of f is by definition the limit as h approaches 0. F of x plus h minus f of x, the change in output divided by h, the change in input. In this case f of x plus h is just x plus h squared and f of x is just x squared. I'm dividing by h. I can expand this out. This is the limit as h approaches 0 of ((x+h)^2-x^2)/h. Now I've got an x^2-x^2, so I can cancel those, and I'm just left with the limit, as h approaches 0, of (2xh+h^2)/h. More good news, in the limit I'm never going to be plugging h=0, so I can replace this With an equivalent function that agrees with it when h is close to but not equal to 0. In other words, maybe a little bit more simply, I'm canceling an h from the numerator to the denominator. So, 2xh over h is just 2x and h^x over h is just an h. Now what's the limit of this sum? Well that's the sum of the limits. It's the limit of 2x as h approaches 0 + the limit of h as h approaches 0. Now as far as wiggling h is concerned, 2x is a constant, so the limit of 2x as h approaches 0 is just 2x. And what's the limit of h as h approaches 0? Well, what's h getting close to when h is close to 0. That's just 0. So, this limit is equal to 2x and that's the derivative of x^2. What that limit is really calculating is the slope of a tangent line at the point x and we can see that it's working. This is the graph of y=x^2. At -4 the slope of the tangent line is -8 At 2, the slope of the tangent line is 4, and, at 6, the slope of the tangent line is 12. There's a ton of different perspectives here. We've been thinking about the derivative of x ^ 2 with respect to x, numerically, algebriaically, geometrically, going back to the definition of derivative in terms of limits, looking at it in terms of slopes of tangent lines. What makes derivatives so much fun is that there just so many different perspectives on this single topic, no matter how you slice it. We've shown that the derivative of x squared with respect to x is 2 times x. Maybe you like algebra, maybe you like geometry, maybe you just like to play with numbers. But now matter what your interests are, derivatives have something to offer you. [MUSIC]