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.

# Applying the chain rule graphically 1 (old)

Sal solves an old problem where the graphs of functions f and g are given, and he evaluate the derivative of g(f(x)) at a point. Created by Sal Khan.

## Want to join the conversation?

• Isn't the distance from 2.5 and 4, 1.5 not 3?
• Definitely it is.
Sal actually is considering the boxes as distance from a point to point.
Since a box has a length of 0.5 units, the total distance is 1.5 units.
• Wouldn't it be easier to understand the slope of f(x) at 2.5 if Sal had explained it in terms of values of x and y instead of in terms of boxes on the graph? At , Sal correctly stated,, "for every 3 that we run, we go up 2" and then he drew lines that went 3 BOXES to the right (from x=2.5 to x=4) and 2 BOXES up (from y=1 to y=2). I think some people were confused because going 3 boxes to the right is only going 1. 5 in terms of x and going 2 boxes up is only going up 1 in terms of y. The slope is indeed 2/3, but as Sal drew it was 1/1.5 (2-1/4-2.5) instead of 2/3.
• It really doesn't matter if you use 2/3 or 1/1.5. They both simplify to the same thing. Also, since the y-axis is proportional to the x-axis, all you really have to do is count boxes. As long as the proportion of each axis is equal, just counting boxes will give you the same answer as calculating the numbers involved. I hope this makes sense.
• So as long as the functions are continuous, or limited to a range where neither function change, is it possible to first solve for g(f(x)) = G(x) and then take the derivative like normal?

In this case, for the range 1 < x < 3, which includes x = 2.5, the functions look like:
f(x) = (2/3)x - 2/3
g(x) = 2x - 1

g(f(x)) = 2(*f(x)*) - 1
= 2((2/3)x - 2/3) - 1
= (4/3)x - 7/3
= G(x)

G(x) = (4/3)x - 7/3
Therefore G'(x) = 4/3 for all x, within the range 1 < x < 3

I also tried: G(x) = g(f(x))
f(x) = x^2
g(x) = 3x^2
and solved for G'(2)

Unless I did something wrong it seems to work here too. Is that correct? And does it hold true in general and with all functions?
• As long as the functions are equivalent, their derivatives will be, so yes you can use this method. Sometimes it will be easier, but once you get the hang of the chain rule it becomes really easy to use.
• Is it possible to take the derivative of ANY graph, even if we don't have a mathematical definition such as x^2 of 7x^23+69x/5x? What if you have a graph with random variables or a graph made out of noise? Like the graphs here: https://www.khanacademy.org/computing/cs/programming-natural-simulations/programming-noise/a/perlin-noise
In the introduction Sal was talking about finding the instantaneous rate of change of runner. How do you that if a runner doesn't move in the kind of curve you can define by a function?
• No, it is not possible to find a derivative for all functions at all points. Sometimes the derivative fails to exist even though the function is defined. Here are some major requirements for a function to be differentiable at some point x=c :
f(c) must be defined
f(x) must be continuous at x=c
lim h → 0⁺ [ f(x+h) - f(x) ] / h = lim h → 0⁻ [ f(x+h) - f(x) ] / h
(in other words, the left and right hand sides of the limit that is the definition of a derivative must be exactly equal)

If any of these is not met, the function is not differentiable at x=c

Random data or noise is not continuous and not necessarily even defined at the necessary points. Thus, it cannot be differentiated.
• Its given that G (x) = g (f (x) ) and G'(x) = g'(f (x) ) * f'(x). Lets suppose at some point X, the derivative is not defined for one of those functions...i.e. either g'(f (x) ) or f'(x) ....while the other is defined. So shall it be concluded that G'(x) wont be defined too ??
• how come f prime is 2/rds explain
(1 vote)
• f prime of x Simply means the slope of f(x) at that value of x. So, in this case, the value of x was 2.5, and at 2.5, we can see that the slope is 2/3, meaning that at that point, for every 2 it goes vertically, it goes 3 horizontally.
(1 vote)
• so since 1/1.5=1/(3/2)=2/3 Sal can use the box instead of the number since they all lead to the same rate of change?
(1 vote)
• what if the graph of f(x) and g(x) are not a straight line, say a curve, what will happen to the f'(2.5) and g'(2.5)?
(1 vote)
• It might be a bit harder to find the derivative, but the same process with chain rule would be used.
(1 vote)
• dose it make a difference that he is using a scale that each tic is not 1, but .5?
(1 vote)
• Nope. The numbers are still the same, just be careful to count each tic as .5, not one.
(1 vote)
• Is the derivative of 2.5 not 0? Why?
(1 vote)

## Video transcript

Consider the functions f and g with the graphs shown below. If capital G of x is equal to lowercase g of lowercase f of x, what is the value of capital G prime of 2.5.? So G of x is a composition of g and f. So it's g of f of x, or lowercase g of f of x. And they don't graph capital G of x here. They just give us the graphs of lowercase g of x and lowercase f of x. This is the graph of lowercase f of x. This is a graph of lowercase g of x. So let's just try to think how we could evaluate this and then see if they've given us the right information here. So let me just rewrite a lot of what they've already told us. They've already told us that capital G of x is equal to lowercase g of f of x. So if we wanted to take the derivative of capital G of x-- and we do want to think about what the derivative of capital G of x is, because they want us to evaluate the derivative at x is equal to 2.5. So let's do that. Let's take the derivative of both sides of this. So if we take the derivative of the left hand side, we end up with G prime of x. And on the derivative on the right hand, since we have a composition here of two functions, we would apply the chain rule. So this is going to be the derivative of g with respect to f. So we could write that as g prime of f of x times the derivative of f with respect to x. So times f prime of x. So if we want to evaluate what G prime of 2.5 is, then every place we see an x here, we have to start with 2.5 in there. So let's try to do that. So G prime of-- and I'll do this in white so it sticks out-- G prime of 2.5 is going to be equal to lowercase g prime of f of 2.5 times f prime of 2.5. So let's think about what these would evaluate to. What is f of 2.5? Well, when x is equal to 2.5-- let me just get a color you can actually see. When x is equal to 2.5, our function here is equal to 1. So f of 2.5, so we know that f of 2.5 is equal to 1. Let me write that down, f of 2.5 is equal to 1. And we also need to figure out what f prime of 2.5 is. So f-- let me write it this way-- f prime of 2.5 is equal to. Now what is f prime of 2.5? That's just essentially the slope of the tangent line at the function when x is equal to 2.5. So it's really just the slope right over here. And at least right over at this part of the function, it's actually a line. And the slope is actually very easy to spot out. If we were to go from this point to this point here-- and I'm just picking those points because those are on kind of integer-valued coordinates-- we see that for every three that we run, we go up two, or that we rise two for every three that we run. Or that our change in y over change in x is 2/3. So the slope of the function right over there is 2/3. So this is equal to 2/3. And so we can substitute back in here, f of 2.5 is equal to 1. And this right over here is equal to 2/3. Now, we're not done yet. Now we have to evaluate, what is G prime of 1? So when x is equal to 1, this is the function g. We're not evaluating g of 1. We're evaluating g prime of 1. So what is the slope of the line here? Well, our change in y over change in x is 2/1. If we go one in the horizontal direction, we go up two in the vertical direction. Change in y over change in x is 2/1. So g prime-- let me write this down-- g prime of 1 is equal to 2. So this whole thing evaluates to 2. And so this simplifies-- let me scratch that out-- the simplifies to 2 times 2/3, which is equal to 4/3. So we could write G prime of 2.5 is equal to 4/3. And this is a pretty neat problem, because we didn't get to see the actual function definition from G of x. But just using the chain rule and the information they're giving us, we were able to figure out what the value of this derivative is when x is equal to 2.5.