The main tool you have at your disposal for finding the derivative of this function is the chain rule, which tells you that you can differentiate a function that depends on a variable #u#, which in turn depends on another variable #x#, by
#color(blue)(d/dx(y) = d/(du)(y) * d/dx(u)#
You're also going to use the power rule, which allows you to calculate the derivative of a variable #x# raised to the power #a# by
#color(blue)(d/dx(x^a) = a * x^(a-1))#
Other derivatives that will come in handy
#d/dx(sinx) = cosx#
and
#d/dx(cosx) = -sinx#
So, looking at your initial function
#y = sin^2(cos(3x))#
you can predict that you're going to use the power rule once and the chain rule twice.
Use the chain rule to express the derivative of #sin^2(cos(3x))# in terms of #u = cos(3x)#
#d/dx(y) = d/(du)sin^2u * d/dx(u) " "color(purple)((1))#
Now focus on #d/(du)(sin^2u)#. You're going to have to use the chain rule again, only this time for
#sinu = u_1#, which implies that
#sin^2u = u_1^2#
This is equivalent to
#d/(du)(sin^2u) = underbrace(d/(du_1) * u_1^2)_(color(blue)("power rule")) * d/(du)u_1#
#d/(du)(sin^2u) = 2u_1^(2-1) * d/(du)(sinu)#
#d/(du)(sin^2u) = 2sinu * cosu#
Now go back to equation #color(purple)((1))#
#y^' = 2sinu * cosu * d/dx(u)#
Next, focus on #d/dx(u) = d/dx(cos(3x))#. Use the chain rule again, but this time use #cos(u_2)# and #u_2 = 3x# to get
#d/dx(cos(3x)) = d/(du_2)cos(u_2) * d/(dx)(u_2)#
#d/dx(cos(3x)) = -sinu_2 * 3d/dx(x)#
#d/dx(cos(3x)) = -sin(3x) * 3#
Take this back to equation #color(purple((1))# to get
#y^' = 2sinu * cosu * (-3 * sin(3x))#
Remember that #u = cos(3x)#, which means that you have
#y^' = -3 * 2 * sin(cos(3x)) * cos(cos(3x)) * sin(3x)#
#y^' = color(green)(-6 * sin(3x) * sin(cos(3x)) * cos(cos(3x)))#