To differentiate #cos(x^2-4x)#, we have to apply the chain rule:
#color(green)((f @ g)'(x) = f'(g(x)) * g'(x))#
In other words:
1) Get the derivative of the outer function, and plug in the inner function...
2) Then multiply that by the derivative of the inner function.
In #cos(x^2-4x)#, the outer function is #cos x# and the inner function is #x^2 - 4x#.
The derivative of #cos x# is #-sin x#, so we get:
#d/dx cos(x^2-4x)#
#= -sin(x^2 - 4x) * d/dx (x^2 - 4x)#
Next we solve #d/dx (x^2 - 4x)# using the power rule:
#color(green)(d/dx x^n = nx^(n-1))#
#-sin(x^2 - 4x) * d/dx (x^2 - 4x)#
#= -sin(x^2 - 4x) * (2x - 4)#
In summary:
#d/dx cos(x^2-4x)#
#= -sin(x^2 - 4x) * d/dx (x^2 - 4x)#
#color(blue)(= -sin(x^2 - 4x) * (2x - 4))#