[tex]y=\cos^xx=e^{\ln\cos^xx}=e^{x\ln\cos x}[/tex]
Now differentiate, applying the chain rule on the right hand side.
[tex]\dfrac{\mathrm dy}{\mathrm dx}=e^{x\ln\cos x}\dfrac{\mathrm d}{\mathrm dx}[x\ln\cos x][/tex]
[tex]\dfrac{\mathrm dy}{\mathrm dx}=e^{x\ln\cos x}\left(\ln\cos x-\dfrac{x\sin x}{\cos x}\right)[/tex]
[tex]\dfrac{\mathrm dy}{\mathrm dx}=e^{x\ln\cos x}\left(\ln\cos x-x\tan x\right)[/tex]
[tex]\dfrac{\mathrm dy}{\mathrm dx}=\cos^xx\left(\ln\cos x-x\tan x\right)[/tex]