 In this video, we're gonna compute the derivative of a polynomial function f of x equals 2x cubed plus 4x. We're gonna do this from the definition of the derivative. That is, we're gonna compute it, the derivative as a limit of a difference quotient. And then once we've computed the derivative of f, we'll use it to calculate f prime of two, f prime of negative one. In fact, we could use it to compute any slope of a tangent line to this cubic polynomial. So let's start with the function itself. What does the derivative mean after all the definition? We see that f prime of x, by definition, is the limit as h approaches zero of f of x plus h minus f of x all over h. And so we need to simplify the difference quotient because if we just plug in h equals zero in here, you're gonna look in the numerator, you're gonna get an f of x minus an f of x, which is a zero. And then since h is zero, you're gonna get zero. You always see this with derivatives. If you just try to plug in h equals zero, you're gonna get the indeterminate form zero over zero. So we have to work to simplify this expression first. And so taking piece by piece, let's first make sure we understand what f of x plus h means right here. So it can be useful to remember the function when you see like this f of x notation. Sometimes I prefer to think of it as f of blank right here where the x is just meant to be a symbol to be put in later, right? It's just a placeholder. So when you see f of x, think of f of blank, right? So you get two times blank cubed plus four times blank. There's a blank that's left for something else to be plugged in. So we could plug in x plus h like so. That's what we could do to fill in the blank. We could just fill it in with an x, right? f of x, that's all that that means. And so we fill in the blank based upon what we need to put in there. So our first goal is to gonna put in the x plus h into the blank right there. And so our limit would look like as h goes to zero. f of x plus h, we're gonna get two times x plus h cubed plus four times x plus h. Then we need to subtract from it f of x, which that's just gonna be the two x cubed plus four x, sorry for squishing it there. And this all sits above the h right there. So we need to simplify, multiply out the numerator. And so the hardest part here is gonna come from multiplying out the x plus h cubed. Again, that's the most complicated thing right here. And so what we're gonna get is we're gonna get two times, well, if you take x plus h cubed, that's gonna multiply out to be x cubed plus three x h, well, sorry, three x squared h plus three x h squared plus h cubed, right? Keep on going. You're gonna distribute the four, you got a four x plus a four h. And then subtract from that the two x cubed plus four x. Again, this all sits above an h. Now you might be wondering how in the world did you multiply out x plus h cubed so quickly? Well, it turns out in calculations like this, especially for these difference quotients, where you have to plug in x plus h, the so-called binomial theorem is a super duper awesome tool you can use right here to simplify these expansions of things of the form x plus h to the nth power. So if you take x plus h to the nth power, what that means is x plus h times x plus h times x plus h, all the way up to x plus h, we have n of them all together, right? And so when you look at all the possible combinations, you have an x times an x times an x times x, you have an x times an h times an x times an x times an h, you have all the combinations. What you're gonna do is you're gonna look on all the possible ways that you can combine x and h, in this case to be three, that's the n right here. So how many ways can you combine the letters x and h to get a three? Well, you could take three x's, so x times x times x, that's an x cubed, you could take two x's and one h, you could take one x and two h's, or you could take three h's right there. So you have those possibilities, notice the power of x is descending, right? So you went from three to one, you didn't write anything there, that's the first power, and then the last one you have, you don't see an x because that's the zero's power. So you see the powers of x, start at three and go all the way down to zero, and converse the powers of h, start at zero and ascend up to three. So one's going down, one's going up, the total sum of the powers is always equal to three in this situation. So that's kind of predictable, but what are the coefficients? One, three, three, one, how did I know that? This is where I think the funnest part of the binomial theorem comes from. It comes from the so-called Pascal's Triangle, Pascal's Triangle, which is a recursive triangle, very useful in computing these things. So what you do is you start off with a one, then you draw a one and a one, and every line you're gonna start and end with a one. And then the subsequent numbers in the sequence are created by taking the two numbers above it and adding it together. So one plus two is three, two plus one is three, right? So the next line, you get one, four, six, four, one, you get one, five, 10, 10, five, one. Where do these numbers come from? One plus four is five, four plus six is 10, four plus six is 10, it's a palindrome, each line's a palindrome like so. And so then the coefficients in the binomial expansion will be the coefficients in the associated row right there. So the coefficients are gonna be one, three, three, one. So if I wanted to do, for example, x plus h to the fifth, then this would look like x to the fifth plus five x to the fourth h plus 10 x cubed h squared plus 10 x squared h cubed plus five x h to the fourth plus one h to the fifth. Cause I'm just gonna take the coefficients on the bottom of Pascal's triangle right there. Pretty neat trick, it comes in useful as you're gonna be trying to compute these limits of difference quotients. That is if you have to calculate the derivative of a polynomial, this binomial theorem, super, super helpful, use Pascal's triangle to help you out here. So the next thing to do is distribute the two onto all of these pieces, make sure I got them all there. Not copying down the limit, it's important to make sure you write down the limit here cause this is a limit calculation here. We're gonna get two x cubed plus six x squared h plus six x h squared plus two h cubed. We get a four x and we get a four h and then we get a negative two x cubed minus a four x all over h right here. Now the nice thing when it comes to these difference quotients, if you take all the terms that came from the f of x, they're gonna subtract from something that came from the f of x plus h part. And so you'll notice that there's a two x cube which cancels with the negative two x cubed. There's gonna be a four x which cancels with the negative x. So everyone in the f of x faction canceled with something in the f of x plus h faction. So now let's write down who survived that massacre cause we had the x's all just gambit right there. We get six x squared h plus six x h squared plus two h cubed plus a four h all over h. You'll now notice that everything in the numerator that didn't cancel out is actually divisible by h. We could factor out the h, I mean look at it here. You have a factor of h, two factors of h, three factors of h, a factor of h right there. We can factor out the h leaving behind a six x squared plus a six x plus a two, sorry, a six x h. We get, I'm gonna write this on the next line so it doesn't get too crowded. We'll put it down here. So we get the limit as h goes to zero, factor out the h. So that left behind the six x squared cause we took away the h. Then we're gonna get a six x h. We took away one of the h's. Then you get a two h squared. Again, we took away one of the h's. And you're left with a plus four. This all sits above the h. Now the common factor of h in the numerator cancels with the h in the denominator for which then this limit we see is gonna be the limit as h goes to zero. We're gonna get six x squared plus six x h plus two h squared plus four. Now, because we're no longer divided by eight, we're not longer divided by h, there's no concern if h goes to zero. If we were just to substitute in h equals zero, we end up with a six x squared cause that doesn't depend on h whatsoever. We're gonna get a six x times zero. We're gonna get a two times zero squared and we get a plus four, which will simplify just to be six x squared plus four. And so this right here is the derivative of our original function. Recall y equals two x cubed plus four x. So now that we've computed the derivative, we're now in a position where we can evaluate the derivative to find specific tangent lines if we wanted to. So we were assured with doing f prime at two. So this will just be function evaluation at this point. We get six times two squared plus four. Two squared of course is four times six is equal to 24 plus another four you end up with 28. So the slope of the tangent line when x equals two would be 28. On the other hand, we are supposed to also do f prime at negative one, which this will look like six times negative one squared plus four. Negative one squared is gonna give you a positive one times it by six will give you a six plus a four. Then we see that the slope of the tangent line here would be 10. So once you get the derivative calculated, finding specific instantaneous rates of change or specific tangent slopes is easy peasy stuff. It's really the simplification of the difference quotient which is purely just a pre-calculus skill there that really makes that that's the hardest part when it comes to computing derivatives like we saw in this case with finding the derivative of a polynomial.