I am asked to find the derivative of $$e^y\cos^2y$$ with respect to $x$.
I think it is $$y'e^y\cdot2y'\cos y \sin y$$ Since there is no $x$ and $y$ term, such as $xy$, the product rule does not apply(?). However the answer I get from WolframAlpha is $$e^yy'(\cos^2y-\sin2y)$$ which looks like the product rule is used. I haven't found any questions like this online, so maybe it cannot be done and WolframAlpha is interpreting it as something else.
My question is: should I use the product rule or chain rule for questions with the product of two functions of $y$?
To make it clear, you could write $y(x)$ and see that the product rule does indeed apply. You'll also need to use the chain rule. We see \begin{align*} \frac{d}{dx}[e^{y(x)} cos^2(y(x))] &= \frac{d}{dx}(e^{y(x)}) \cos^2(y(x)) + e^{y(x)} \frac{d}{dx} \cos^2(y(x)) \\ &=y'(x) e^{y(x)} \cos^2(y(x) +e^{y(x)} (-2\cos(y(x))\sin(y(x)) y'(x))\\ &= y'(x) e^{y(x)} \cos(y(x)) [\cos(y(x)) - 2 \sin(y(x))]. \end{align*}The product rule would not apply if one of $e^{y}$ or $\cos^2(y)$ did not depend on $x$, but since $y$ depends on $x$, they both do depend in $x$.