episode 11 derivatives of polynomials so last time we took a function and we defined the derivative of that function with respect to X as f prime of x equals the limit as H goes to 0 of f of X plus h minus f of X divided by H we made an appeal to geometry and we look for the tangent line to the curve y equals f of X at the point X f of X and F prime gives us the slope of that tangent line right the thing that we're taking the limit of in the definition is the slope of a secant line and then in the limit that secant line becomes the tangent line it's the instantaneous rate of change of the function f with respect to X the process of finding F prime is known as differentiation and F prime is defined as a limit not all limits exist and so if that limit does exist at a particular value of x f is said to be differentiable there in a few minutes we'll talk about the significance of a function not being differentiable at a particular value of x the second question on the first test and the second question on the final exam will be to state the definition of f prime and then I'll ask you to use it to find the derivative of a function we looked at some other notation for writing down the derivative of F so if y equals f of X we could write its derivative is f prime or Y prime or we could use the differential operator D over DX that just says find the derivative with respect to X of whatever function follows the result of that could be written as dy over DX or just dy DX that's not a fraction so how do we find the derivative of a function really at the moment we only have one tool the definition but we used that definition to find the derivatives of three different functions last time the derivative of x squared plus one was 2x the derivative of 1 over X was minus 1 over x squared and then the derivative of the square root of x was 1 over 2 square root of x so if we can remember these we never have to really use the definition for these things again and that's really what differentiating is all about it's realizing hey this function has a particular form I've already differentiated something like that before and I remember how to do it so we'll get started today with this with polynomials so the first important thing that's going to help us out here is to realize that if C is a constant the derivative of C is zero I hope this is obvious the instantaneous rate of change of something that doesn't change needs to be zero so what's the derivative of 2 pi well 2 pi doesn't have an accident so it's derivative is 0 the differential operator is is known as a linear operator because it satisfies these two properties if C is a constant and we know how to find the derivative of F then the derivative of C times F is just C times F Prime that's one property the other property for a linear operator is that if you know how to find the derivative of F and you know how to find the derivative of G then you can find the derivative of their sum or difference really easily the derivative of F plus or minus G is just F prime plus or minus G prime these two properties together make the differential operator a linear operator and it's basically just because the limit operator itself was also a linear operator now quick proof of the sum difference rule we just plug in the definition of the derivatives and that's the limit as H goes to 0 of f of X plus h plus or minus G of X plus h minus f of X plus or minus G of X divided by H right just rearrange the addition or subtraction in the top of the fraction there and then split that fraction up at the plus or minus and the first limit there is just the definition of the derivative of F and in the second one is just the definition of the derivative of G right so the derivative of F plus or minus G is f prime plus or minus G prime this will be second nature to you and what it does is it allows us to differentiate this thing very quickly what's the derivative of the square root of 3 divided by X minus eight square root of x plus 15 the sum and difference rules allow us to split that up into three different derivatives and then two of those derivatives have a constant in them right the square root of 3 over X is the square root of 3 times 1 over X hey and I know what the derivative of 1 over X is and then the second term is just minus 8 times the derivative of the square root of x also something that I've previously found and then the third term is 15 a constant I know what its derivative is right so this is going to be the square root of 3 times minus 1 over x squared minus 8 times 1 over 2 square root of x plus 0 so that's minus square root 3 over x squared minus 4 over the square root of x and then what's the derivative of x squared this is definitely not the best proof of that but it's the easiest one that we can do right now because we can write x squared as x squared plus 1 minus 1 and I've already found the derivative of x squared plus 1 that was 2 X and negative 1 is a constant so it's derivative is 0 so the derivative of x squared is 2x there is a much better way of doing that and it's a much more general way let's think about taking the derivative of X to the N where n is any positive integer well the first positive integer would be 1 so let's start there the derivative of X to the first power right that would be the derivative of X just plug in the definition that's the limit as H goes to 0 of X plus h minus X divided by H well X minus X those cancel H over H also cancels leaving us with 1 so the derivative of X is 1 important thing to remember we just found that the derivative of x squared was 2x so there's no reason to do that again now let's try 3 what's the derivative of X cubed so that's going to be the limit as H goes to 0 of X plus h cubed minus x cubed divided by age all right so X h-cubed that's X plus h times X plus h times X plus h we need to foil that out or remember the expansion formula and so this is the limit as H goes to 0 of X cubed plus 3x squared h plus 3x h squared plus h cubed minus x cubed and then divide by H hey X cubed minus X cubed that adds to 0 so what we're left with in the top three x squared H plus 3x H squared plus h cubed everything in the top has an H in it so I can factor that out I need to be able to do that to cancel the 1 the bottom to get rid of the 0 over 0 problem H over H is 1 all right so I have the limit as H goes to 0 of 3 x squared plus 3x h plus h squared I just plug in H equals 0 and I'm left with 3x squared it's the derivative of x cubed is 3x squared now can we do this in a more general way for any n the key is knowing how to expand X plus h to the N power so I've got the the first 3 powers of in there if I do it for X plus h to the fourth power I get X to the fourth plus 4 X cubed H plus 6 x squared + H squared + 4 X H cubed + H to the fourth let's see if we can pick up a pattern here and use that to get x + H to the fifth power x + H to the N power is gonna have n plus 1 terms so go ahead and write down five pluses they'll have a power of X in them it will start with X to the N and it will decrease unto X to the zero power right next to the 0 is 1 and then they also all have an H in them the power of H starts at H to the zero power and increases to H to the N so the first and last terms will have a coefficient of 1 now I just need to get the other coefficients that's the tricky part the reason I've got it arranged in this kind of triangular table here is that I can look to the two terms above it and just add them to the coefficient so for the X to the fourth H term the two coefficients above that would be one into four so add those together I get five and then it's gonna be symmetric so because the X to the fourth h term had a five the X H to the fourth term will also have a five and then the other two terms I would get by looking at the terms above those 4 plus 6 is 10 that's X plus h to the fifth power in general X + H to the N is X to the N + n X to the n minus 1 times H power plus some terms that all have at least h squared in them the coefficient of the I term is actually known it's done there using the factorial but it's irrelevant the only things that matter are that the first two terms are known and all the other terms have at least an h squared in them because if I plug that in I now have the limit as H goes to 0 of X to the N + n X to the N minus 1 times h plus terms that have an H squared in them minus X to the N so my X to the N and the minus X to the N are the only terms don't have an ancient so those cancel each other out and then everything that's left has at least one agent so I can factor that out and that'll get rid of the H in the bottom so what I'm left with is the limit as H goes to 0 of n X to the N minus 1 plus terms that are proportional to H so when they take the limit as H goes to 0 all of those other terms will go to 0 and I'm left with n X to the N minus 1 this is known as the power rule the derivative of X to the N power is n X to the N minus 1 so write X to the first power that's 1 X to the 1 minus 1 power so that's one we already saw that the derivative of x squared this is the better way to do that x squared would be 2 X to the 2 minus 1 powers that would be 2 X to the first power or 2x and then again we saw X cubed was 3 x squared the derivative next to the fourths 4x cubed the derivative of X to the fifth is 5x to the fourth the derivative of X to the sixth is 6x to the fifth and so forth this should become really easy now the proof that we used only works for n being a positive integer but there are two other functions that we have found the derivative of that do fit this pattern right the derivative of 1 over X 1 over X is X to the negative 1 power if we applied the power rule that would be minus 1 times X to the minus 1 minus 1 power or minus X to the minus 2 power or minus 1 over x squared and that is its derivative we already found that right so the power rule works for things like that and then the square root of x also fits this pattern square root of x is X to the 1/2 play the power rule it's going to be 1/2 X to the 1/2 minus 1 powers that would be 1/2 X to the minus 1/2 power or 1 over 2 square root of x yeah so the power rule actually works for n being any real number we don't quite have the skills to prove that that works for any real number but it does what we can prove that later so this makes differentiating any polynomial very easy right so if we have f of X equals 6 X to the fifth minus 3x to the 4th plus 9 X minus 2 what's F prime a that's the sum of four terms three of those terms have a constant multiple right so I can think of it as six times the derivative of X to the fifth minus three times the derivative of X to the fourth plus nine times the derivative of X minus the derivative of two so that's going to be six times five x to the fourth minus three times four x cubed plus nine times one minus zero so 30 X to the fourth minus 12x cubed plus nine we don't need to go into this detail every time but I want you to understand that that's why this is the derivative of f do another example y equals x to the 9 over 3 minus 2x to the 7th over 5 plus 1 plus the square of 5 over 2 that's plus the golden mean right so again right we just have the constant 1/3 times X to the 9th minus the constant 2/5 times X to the seventh plus the derivative of a constant right so that's just going to be one third 9 X to the 8th minus 2/5 7 X to the sixth plus 0 so that's 3x to the 8th - 14 fifths X to the sixth power any polynomial pretty easy now what about this if G of X is the absolute value of x what is G prime so we need to think about this as a piecewise function the absolute value of x is x if X is greater than or equal to 0 and then it's minus X if X is negative so we have to address these three cases separately what happens when X is positive what happens in the next is negative and then we have to look individually at the place where those two pieces meet so they have to treat zero separately so when x is positive the function G of X is just X and we know what is it when it's derivative is right is just 1 so G prime of X is 1 if X is greater than 0 and case 2 is very similar if X is negative then G of X is just minus X that's minus 1 times X so G prime here would be negative 1 now we're going to worry about what happens when x is 0 when x is 0 we have to use the limit definition so when we plug in that we get that G of 0 is 0 and G of 0 + H is just the absolute value of H so it's the limit as H goes to 0 of the absolute value of H divided by H we've looked at this limit before the two one-sided limits disagree when we approach 0 from below we have negative when we approach zero from above we have positive one so this limit doesn't exist which means G of X is not a differentiable function at zero so G prime is 1 if X is positive negative 1 if X is negative and it's not anything if X is zero another way of writing this would just be X divided by the absolute value of x so G of X is defined for every number it's continuous but G prime is undefined at x equals 0 if we think about the graph of this function this makes a little more sense right when X is negative we have a straight line with slope negative 1 when X is positive we have a straight line with slope positive 1 and then where they meet at 0 we have a corner and that it doesn't really make sense to talk about the tangent line at that corner how is it attached right there's nothing that really pins its value down I can make an equally strong argument that it should have slope negative 1 or 1 so the line can't exist so this is an example of a function that is not differentiable at a value there are couple of other ways that a function can fail to be differentiable if a function has a discontinuity like 1 over x squared does at x equals 0 then the function will not be differentiable there if f of X equals 1 over x squared that would be X to the negative 2 power that's undefined at 0 well its derivative we just use the power rule and we get that its derivative is minus 2 over X cubed also undefined at 0 so that shouldn't be too surprising another way is what we just looked at we have a corner so this function is key so the absolute value function is continuous but it's not differentiable there because the tangent line isn't defined there's a different way that that can happen which we call it cusp if we look at a function like f of X equals the fifth root of x squared that would be X to the 2/5 power we use the power rule here we get 2/5 X to the minus three fifths power that would be 2/5 minus one so that's two over five times the fifth root of x cubed f of X is defined at 0 it's defined for every real number but f prime is undefined at zero actually if we take the limit as X approaches zero from below we go to negative infinity from above we go to positive infinity the tangent line here is also undefined because we get this place this thing called a cusp it comes to a very sharp point and no tangent line can be defined there's a third class of not differentiable functions that I want to tell you about things that have a vertical tangent line select the cube root of x at x equals zero is the canonical example here write the derivative of the cube root of x or X to the one-third would be 1/3 X to the minus 2/3 power so that would be 1 over 3 times the cube root of x squared that function is also undefined at 0 the cube root is defined for every value of x if we take the limit as X approaches 0 left prime it goes to positive infinity so we have a vertical tangent line at x equals 0 so that's another way that the derivative can fail to exist now there's a subtle relationship between the differentiability of a function and its continuity if f of X is not continuous at X then f of X is also not differentiable at X we saw this with 1 over x squared was undefined so there means it's not continuous and so its derivative is not defined either in order to define F prime of 0 we have to know F of 0 and if that's undefined F prime of 0 is 2 the contrapositive of this is also true if f of X is differentiable at X then we know that f of X must have been continuous at X the inverse of this is not true if we know that f of X is continuous we don't know anything about its differentiable 'ti right we've seen three examples the absolute value of x the fifth root of x squared and the cube root of x these are all continuous for all real numbers but they're all not differentiable at 0 so the continuity of a function does not imply differentiable ax t but it does go in the other direction if you know it's differentiable you know what it must have been continuous so let's look at a couple of piecewise functions let's let f of X equal 3x minus 5 if X is less than or equal to 2 and X minus 1 if X is greater than 2 is this a continuous function at 2 and is it differentiable at 2 well it's got to be continuous in order to be differentiable so let's check its continuity we need the limit as X approaches 2 of f of X to equal F of 2 f of 2 we plug in 2 and we get 1 and then that's also the limit as X approaches 2 from below the limit as X approaches 2 from above is also 1 therefore f of X is continuous at x equals 2 and it could be differentiable but we don't know that it is we have to check it we need to think about the derivative of this piecewise function away from 2 it's just the line so when X is negative 2 it's the line 3x minus 5 so it's derivative is 3 when X is greater than 2 it's 2 it's the line x minus 1 so it's derivative is 1 but when X is 2 we have to think about the definition and that's gonna have to one-sided limits that disagree if we approach from below f prime would be approaching 3 if we approach from above F prime would be approaching 1 those disagree so f prime of 2 does not exist right so f prime is not differentiable at 2 it is 3 if X is negative 1 if X is positive and it's not anything if X is 2 another quick example let's let f of X equal x squared plus 3x minus 5 of X is less than 1 and 5 X minus 6 if X is greater than or equal to 1 is it continuous at 1 and is it different achievable again we need to check the continuity we plug in we get both the limit as X approaches 1 of f of X and f of 1 or negative 1 so it is continuous got to think about its differentiability when X is less than 1 it's a parabola so we just use the power rule there F prime is 2 X plus 3 if X is negative if X is positive the function is a line and so it's derivative it's just 5 so we need to think about what happens at 1 we basically just take the one-sided movements of f prime that will evaluate this in this limit and we get that both of those are 5 so hey those exist right so this piecewise function was pieced together in a way such that F prime of 1 was defined so it's both continuous and differentiable at 1 F prime of X would be the piecewise function 2x minus 3 if X is less than 1 and 5 if X is greater than or equal to 1