If the expression to be differentiated is a (differentiable) function of another (differentiable) function, then the chain rule must be applied. For example y= f(g(x)), where f and g are both differentiable, then dy/dx = f'(g(x)).g'(x). To simplify this, it can be looked at as a simple substitution:
Let g(x)=u, then, the chain rule states that, dy/dx=(du/dx).(dy/du). For example, should the expression to be differentiated be (cos(x))^2, then let u=cosx, du/dx = -sin(x), y=u^2, dy/du=2u, therefore dy/dx = -sin(x).2(cos(x)).