cos^2(1-2x+x^2)
would this be sin^2(1-2x+x^2)*(-2+x^2)?
If $\displaystyle y = \cos^2 (x^2-2x+1)$ then let $\displaystyle u = x^2-2x+1 $ so $\displaystyle y = \cos^2 u. $ Let $\displaystyle v = \cos u$ so $\displaystyle y = v^2$. Now the chain rule
$\displaystyle
\frac{dy}{dx} = \frac{dy}{dv} \cdot \frac{dv}{du} \cdot \frac{du}{dx}
$
Put in the pieces and back substitute.