If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Derivative of sin(ln(x²))

AP.CALC:
FUN‑3 (EU)
Sal differentiates sin(ln(x²)) by applying the chain rule twice. Created by Sal Khan.

Want to join the conversation?

  • blobby green style avatar for user isaias
    At , could you also write g'(h(x)) as (x^2)^-1, which would by the power rule would turn out to be -(x^2)^-2 . Am I wrong?
    (13 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Tate S. Srey
      Close, but wrong.

      1). You're solving a different problem. You're trying to get the derivative of 1/(x^2), which as you stated can be rewritten as (x^2)^-1. But Sal was getting the derivative of ln(x^2).... but to continue on with (x^2)^-1, and why the derivative of that isn't -(x^2)^-2...

      g(x) = x^-1, h(x)=x^2 derivative of g(h(x)) = g'(h(x))*h'(x) by the Chain Rule
      you forgot to multiply by h'(x).
      So you got half of that correct, g'(x) = -1(x)^-2, by the Power Rule.
      and g'(h(x)) = -1(x^2)^-2
      h'(x) = 2x, also by the power rule.
      By the Chain Rule the derivative is of (x^2)^-1 is -1((x^2)^-2)*2x, you forgot the 2x.

      2). The inner composite sal was solving is ln(x^2), not (x^2)^-1.
      g(x) = ln(x), g'(x) = 1/x
      h(x) = x^2, by the power rule, h'(x) = 2x
      g'(h(x)) = 1/x^2, or (x^2)^-1
      g'(h(x))*h'(x) = (1/(x^2))*2x = 2/x

      And that's just the derivative of the inner composite.

      Hope that helped.
      (31 votes)
  • male robot donald style avatar for user cuberking8
    Can the chain rule be applied backward to anti derivatives?
    (16 votes)
    Default Khan Academy avatar avatar for user
    • spunky sam blue style avatar for user Ethan Dlugie
      Indeed it can. This technique is often referred to as "u-substitution". For example, we know that the derivative of sin^2(x) is 2*sinx*cosx. Now, if I want to take the antiderivative of that, we have
      ∫ 2*sinx*cosx dx I can make the substitution u=sinx and du/dx=cosx or, equivalently, du=cosx*dx
      ∫2*u*du = u^2 + c = (sinx)^2 + c
      (17 votes)
  • leaf red style avatar for user Beaveman Goddard
    what is the composite of a function?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • leafers seed style avatar for user Kristian
      Hello!

      Composition of functions basically means that you replace the placeholder x in f(x) with a function.

      f(x) = x^2, could be rewritten as:
      f("our number") = "our number"^2.

      Similarly, we could replace the placeholder x with a "proper" function. Let me define:
      g(x) = 2x + 2.
      If I were to replace the placeholder x in f(x) with g(x), I would get:
      f(g(x)) = (2x + 2)^2.

      This is basically the same principle as:
      f(5) = 5^2.
      We replaced our placeholder x with 5, and that number becomes squared, since
      f(x) = x^2.

      Composition of functions is when you replace the placeholder in f(x) with another function g(x).

      Finally, f(g(x)) can be written as f o g(x), which can be interpreted as applying the function g to the function f.

      Hope I could help!

      // Kristian
      (19 votes)
  • ohnoes default style avatar for user Cyan Wind
    Can anyone who is proficient in this subject clarify this problem for me? Say, we have d/dx f[g(h(x))] as the example in this video. Is it equivalent to d/d[g(h(x))] f[g(h(x))] * d/d(h(x)) g(h(x)) * d/dx h(x)?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Daniel Schneider
      Not quite. It should be:
      d/dx(f(g(h(x))) = f'(g(h(x))) * g'(h(x)) * h'(x) , where I'm using the "prime" notation for the derivative instead of d/dx. One way to think about it is that the Chain Rule "chains" together the derivatives of whatever functions are being composed. So if you have the composition of three functions f, g, and h, you should expect your derivative for f(g(h(x))) to be the product of three derivatives (as shown above). Hope that helps!
      (7 votes)
  • aqualine seed style avatar for user Papa Bearrr
    Is there a recursive formula that can give us an arbitrary or even infinite number of functions to be chained together to be derived? In other words, is there a chain rule of _k_ or infinite composition?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user ben.samuel
      Sure, and this is how a computer algebra system handles it. Let's start a little simpler: Say you've got a simple addition, a + b + c + d. And if you only knew how to multiple two numbers, you could approach it as a + (b + (c + d))). That's called "reduction," where you take many operations and break them into parts.

      Here's where it gets tricky: f(g(x)) can be viewed as f • g, and f(g(h(x))) is like f • (g • h), where the dot • is called "function application". We take away the x’s because we're dealing with the functions themselves as values.

      That makes it a bit more obvious that the chain rule is an operation on that application, it's just saying, (f • g)’ = (f’ • g) ⨉ g’ so we're just moving some symbols around.

      And then if I have (f • (g • (h • i)))’, you can see how you'd just churn through it from the outside in:

      q = (g • (h • i))
      (f • (g • (h • i)))’ = f’ • (g • (h • i))) ⨉ (g • (h • i))’
      (g • (h • i))’ = g’ • (h • i) ⨉ (h • i)’
      (h • i)’ = h’ • i ⨉ i’

      And then substitute back in:
      (g • (h • i))’ = g’ • (h • i) ⨉ (h’ • i ⨉ i’)
      (f • (g • (h • i)))’ = f’ • (g • (h • i))) ⨉ g’ • (h • i) ⨉ h’ • i ⨉ i’

      Anyway, if you had an arbitrary array of functions k[1], k[2], k[3]..., it looks like your rule would be:

      (k[1] • k[2] • k[3] … k[n])’ = ∏ k[i]’ • k[i-1] • k[i-2] … k[1] where i goes from 2 to n

      Or in more traditional notation:

      d/dx (k[1](k[2](k[3](...k[n](x)…)))) = ∏ k[i]’(k[i-1](k[i-2](…k[1](x)…))) where i goes from 2 to n
      (3 votes)
  • blobby green style avatar for user nitesh316
    i have a doubt.. can we take the derivative of ln (2x) with chain rule? or its just 1/2x.. how do you build the composite function??
    (1 vote)
    Default Khan Academy avatar avatar for user
  • leaf grey style avatar for user Hugo
    In the exercise that follows, how is that

    2•csc(x)•sec(x) + 2x•-csc(x)•cot(x)•sec(x) + 2x•csc(x)•sec(x)•tan(x)

    is becoming

    2•csc(x)•sec(x) - 2x•csc^2(x) + 2x•sec^2(x)

    ?

    I mean, what happened to cot(x) and tan(x)?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Hugo
      I found out what happened. If anyone is lost, it comes from:

      sin(x) = cos(x)tan(x)
      cos(x) = sin(x)cot(x)
      tan(x) = sec(x)sin(x)
      csc(x) = cot(x)sec(x) <--------
      sec(x) = tan(x)csc(x) <--------
      cot(x) = csc(x)cos(x)
      (2 votes)
  • starky sapling style avatar for user sarhqrx
    I'm pretty confused because every website I've read has said that the derivative of ln(x^2) is actually 2x/x^2 (which is what I got too) but Sal wrote that it was 1/x^2.. am I just wrong? or did Sal forget the 2x?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • mr pink red style avatar for user Miranda Bumstead
    At Sal says that the derivative of lnx is 1/x. How does that work? And would it be similar for finding the derivative of a log?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • orange juice squid orange style avatar for user Vikram Agrawal
    Can't we just use 2ln(x), instead of ln(x^2), based on the properties of logarithms, and save ourselves an extra chain rule step?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • stelly green style avatar for user The #1 Pokemon Proponent
      Of course, you get the same derivative value for both. It's perfectly alright as a method but not from a graphical standpoint and shouldn't the derivative value be supported by the graph? You have to remember that even though the value of ln(x^2) is 2ln(x), as functions, the two are different. The derivative of ln(x^2) at -1 is -2. This makes sense even on the graph. But does it make sense for 2ln(x) to have a slope of -2 at negative one. Can 2ln(x) even attain that value?
      Since the functions ln(x^2) and 2ln(x) have different domains, they are essentially different functions.
      (2 votes)

Video transcript

So now we're going to attempt to take the derivative of the sine of the natural log of x squared. So now we have a function that's the composite of a function, that's a composite of another function. So one way you could think of it, if you set f of x as being equal to sine of x, and g of x being the natural log of x, and h of x equaling x squared. Then this thing right over here is the exact same thing as trying to take the derivative with respect to x of f of g of h of x. And what I want to do is kind of think about how I would do it in my head, without having to write all the chain rule notation. So the way I would think about this, if I were doing this in my head, is the derivative of this outer function of f, with respect to the level of composition directly below it. So the derivative of sine of x is cosine of x. But instead of it being a cosine of x, it's going to be cosine of whatever was inside of here. So it's going to be cosine of natural log-- let me write that in that same color-- cosine of natural log of x squared. I'm going to do x that same yellow color. And so you could really view this, this part what I just read over here, as f prime, this is f prime of g of h of x. This is f prime of g of h of x. If you want to keep track of things. So I just took the derivative of the outer with respect to whatever was inside of it. And now I have to take the derivative of the inside with respect to x. But now we have another composite function. So we're going to multiply this times, we're going to do the chain rule again. We're going to take the derivative of ln with respect to x squared. So the derivative of ln of x is 1/x. But now we're going to have 1 over not x, but 1 over x squared. So to be clear, this part right over here is g prime of not x. If it was g prime of x, this would be 1 over x. But instead of an x, we have our h of x there. We have our x squared. So it's g prime of x squared. And then finally, we can take the derivative of our inner function. Let me write it. So we could write this is g prime of h of x. And finally, we just have to take the derivative of our innermost function with respect to x. So the derivative of 2x with respect to-- or the derivative of x squared with respect to x is 2x. So times h prime of x. Let me make everything clear. So what we have right over here in purple, this, this, and this are the same things. One expressed concretely, one expressed abstractly. This, this, and this are the same thing, expressed concretely and abstractly. And then finally, this and this are the same thing, expressed concretely and abstractly. But then we're done. All we have to do to be done is to just simplify this. So if we just change the order in which we're multiplying, we have 2x over x squared. So I can cancel some out. So this x over x, 2x over x squared is the same thing as 2 over x. And we're multiplying it times all of this business. So we're left with 2 over x. And this goes away. 2 over x times the cosine of the natural log of x squared. So it seemed like a very daunting derivative. But we just say, OK, what's the derivative of sine of something with respect to that something? Well, that's cosine of that something. And then we go in one layer, what's the derivative of that something? Well, in that something we have another composition. So the derivative of ln of x, or ln of something with respect to another something, well that's going to be 1 over the something. So we had gotten a 1 over x squared here, that squared got canceled out. And then finally, the derivative of this innermost function, it's kind of like peeling an onion. The derivative of this inner function with respect to x, which was just 2x. Which we got right over here. This was 1 over x squared. This was 2x before we did any canceling out. So hopefully that helps clear things up a little bit.