The problem is with your graph. You have put the 2 in the wrong place,
You have graphed \(cos(x^2)\) INSTEAD OF \((cos\;x)^2\) which is the same as \(cos^2 x\)
Here is what your graph should look like:
https://www.desmos.com/calculator/uxk237heoa
Edit:
You have actually answered the question that you have posted here correctly. I did not notice before.
However, I do not think that you posted the question that you were actually asked.