A function can be a COMPOSITION of differentiable functions. The key to understanding how to apply the chain rule is to remember that such functions are composed of OUTERMOST functions being applied to INNER functions. Such composite functions are written as
(f ∘ g)x
...or 'f AFTER g', meaning the composite function determines g(x), and uses that result as the input for the function f(x).
To successfully apply the chain rule to find the derivative of such functions, we have to look at a function and break it down into the sequence of OUTER to INNER functions. This is usually accomplished by looking at complex functions a series of complex operations (OUTER functions) applied to a simpler INNER function.
For example: $f\left(g\left(x\right)\right)=\sqrt{5x+2}$
Which can also be written as: $\left(f\phantom{\rule{8px}{0ex}}\circ \phantom{\rule{8px}{0ex}}g\right)x=\sqrt{5x+2}$
Looking at this composite function, the simplest INNER-MOST function is (5x + 2). It's result is then passed to an OUTER operation (function) to apply the square root:
$g\left(x\right)=5x+2\phantom{\rule{30px}{0ex}}\text{and}\phantom{\rule{30px}{0ex}}f\left(x\right)=\sqrt{x}$
Under these conditions, the derivative h'(x), is found using the CHAIN RULE:
$h\text{'}\left(x\right)=f\text{'}\left(g\left(x\right)\right)·g\text{'}\left(x\right)$
In this example, we look for the derivative h'(x) given the compound function:
$y=\sqrt{4x+3}$
Chain Rule - the Basics