[tex]y=(\cos7x)^x[/tex]
[tex]y=\exp\left(\ln(\cos7x)^x\right)=\exp\left(x\ln\cos7x\right)[/tex]
By the chain rule,
[tex]\dfrac{\mathrm dy}{\mathrm dx}=\exp\left(x\ln\cos7x\right)\cdot\dfrac{\mathrm d}{\mathrm dx}\left[x\ln\cos7x\right]=(\cos7x)^x\cdot\dfrac{\mathrm d}{\mathrm dx}\left[x\ln\cos7x\right][/tex]
[tex]\dfrac{\mathrm dy}{\mathrm dx}=(\cos7x)^x\left(\ln\cos7x+x\dfrac{-7\sin7x}{\cos7x}\right)[/tex]
[tex]\dfrac{\mathrm dy}{\mathrm dx}=(\cos7x)^x\left(\ln\cos7x-7x\tan7x\right)[/tex]