Find the nth derivative of the two given functions:
$$\tag{II}x^{2}\sin^{2}\left(2x\right)$$ $$\tag{I}\sin^{2}\left(3x\right)\cos\left(5x\right)$$
For the first case I'm going to generalize the nth derivative of $\sin^{2}\left(ax\right)$,where $a$ is a real number, also I'm using the famous identity $\cos\left(x\right)=\sin\left(x+\frac{\pi}{2}\right)$:
consider the function $\sin^{2}\left(ax\right)$,the consecutive derivative of the given function are as follows:
$$\frac{d}{dx}\sin^{2}\left(ax\right)=2\sin\left(ax\right)\cos\left(ax\right)a=a\sin\left(2ax\right)$$
$$\frac{d^{2}}{dx^{2}}\sin^{2}\left(ax\right)=2a^{2}\cos\left(2ax\right)=2^{\color{red}1}a^{\color{red}2}\sin\left(2ax+\frac{\color{blue}1\pi}{2}\right)$$
$$\frac{d^{3}}{dx^{3}}\sin^{2}\left(ax\right)=2^{2}a^{3}\cos\left(2ax+\frac{\pi}{2}\right)=2^{\color{red}2}a^{\color{red}3}\sin\left(2ax+\frac{\color{blue}2\pi}{2}\right)$$
$$\frac{d^{4}}{dx^{4}}\sin^{2}\left(ax\right)=2^{{3}}a^{{4}}\cos\left(2ax+\frac{2\pi}{2}\right)=2^{\color{red}3}a^{\color{red}4}\sin\left(2ax+\frac{\color{blue}{3}\pi}{2}\right)$$
Continuing this way we can generalize the nth derivative such that: $$\frac{d^{n}}{dx^{n}}\sin^{2}\left(ax\right)=2^{\left(n-1\right)}a^{\left(n\right)}\sin\left(2ax+\frac{\left(n-1\right)\pi}{2}\right)\tag{1}$$
Using Leibniz formula we have: $$\color{green}{\left(\left(x\sin\left(2x\right)\right)^{2}\right)^{\left(n\right)}}=\sum_{k=0}^{n}{{n}\choose{k}}\left(\sin^{2}\left(2x\right)\right)^{\left(n-k\right)}\left(x^{2}\right)^{\left(k\right)}=$$$$\left(\sin^{2}\left(2x\right)\right)^{\left(n\right)}x^{2}+n\left(\sin^{2}\left(2x\right)\right)^{\left(n-1\right)}2x+n\left(n-1\right)\left(\sin^{2}\left(2x\right)\right)^{\left(n-2\right)}$$
Setting $a=2$ in the relation $(1)$ implies:
$$\color{green}{\left(\left(x\sin\left(2x\right)\right)^{2}\right)^{\left(n\right)}}=$$$$2^{\left(2n-1\right)}\sin\left(4x+\frac{\left(n-1\right)\pi}{2}\right)x^{2}+2nx\left(2^{\left(2\left(n-1\right)-1\right)}\sin\left(4x+\frac{\left(n-2\right)\pi}{2}\right)\right)+n\left(n-1\right)\left(2^{\left(2\left(n-2\right)-1\right)}\sin\left(4x+\frac{\left(n-3\right)\pi}{2}\right)\right)$$
but the formula is just true for $n\ge3$, although the formula $(1)$ is true for all $n\ge1$, I cannot find the problem and still don't know why this error appears,also can soneone explain why my generalized formula is not true for $n=0$? $.......................................................................................$
About the second case using the well-known following formula and also using the the relation $(1)$ in the previous case (setting $a=3$) we have:
$$\color{blue}{\frac{d^{n}}{dx^{n}}\cos\left(ax\right)=a^{n}\cos\left(ax+\frac{n\pi}{2}\right)}$$ $$\color{green}{\left(\sin^{2}\left(3x\right)\cos\left(5x\right)\right)^{\left(n\right)}}=\sum_{k=0}^{n}{{n}\choose{k}}\left(2^{\left(k-1\right)}3^{k}\sin\left(\frac{\left(k-1\right)\pi}{2}+6x\right)\right)\left(5^{\left(n-k\right)}\cos\left(5x+\frac{\left(n-k\right)\pi}{2}\right)\right)$$ but the formula does not work, and I don't know why.