# Implicit differentiation of Product of Two Functions of $y$

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$?

• you need to use the product rule. Since $y$ is a function of $x$, so is each of $e^y$ and $\cos^2 y$, and hence the function $e^y\cos^2 y$ is a product of two functions of $x$. – John Martin May 27 '16 at 17:24

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$.
If we assume $y=y(x)$, so $y$ is a function of $x$, then we can take the implicit derivative and use the product rule on $e^y$ and $\cos^2y$, and the chain rule on $\cos^2y = (\cos y)^2$. Then we get $$\frac{d}{dx}e^y\cos^2y = e^y y'\cos^2y - e^y 2\cos y\sin y y'$$ We factor out $e^y\cos y y'$ to obtain an answer of $$e^y \cos y y'(\cos y - 2\sin y).$$
When you have products or quotients, you can make life simpler considering logarithmic differentiation $$z=e^y \cos^2(y)\implies \log(z)=y+2\log\big(\cos(y)\big)$$ Differentiating with respect to $x$ $$\frac 1 z \frac{dz}{dx}=\frac{dy}{dx}-2 \frac{\sin(y)}{\cos(y)}\frac{dy}{dx}=\big(1-2\tan(y)\big)\frac{dy}{dx}$$ Multiplying both sides by $z$, then $$\frac{dz}{dx}=e^y\big(1-2\tan(y)\big)\cos^2(y)\frac{dy}{dx}=e^y\cos(y)\big(\cos(y)-2\sin(y)\big)\frac{dy}{dx}$$