Derivative of $H(x)=[f(x)]^{x^2+1}-[\cos(2x)]^{g(x)}$ for differentiable, positive $f(x), g(x)$ I found this question in the review of a chapter that covered derivatives, implicit differentiation, related rates, inverse functions, one-to-one functions, derivatives of higher order.

Let $f,g: \mathbb{R}\rightarrow(0,\infty)$ be differentiable functions.  Find the derivative of
  $$H(x)=[f(x)]^{x^2+1}-[\cos(2x)]^{g(x)} .$$

I derived it as follows:
$$(x^2+1)[f(x)]^{x^{2}}+2\sin(2x)g(x)[\cos(2x)]^{g(x)-1}$$
I strongly believe that there is something else required to differentiate this function but I am not sure what I should be looking for.  I thought about isolating $f(x)$ and $g(x)$ and representing each in terms of $x$ and then substituting into $h(x)$ before differentiating but I'm not sure if this is required and how to accomplish this.
 A: Hint For differentiable, positive functions $a, b : \Bbb R \to (0, \infty)$, we can write $$a(x)^{b(x)} = \exp [b(x) \log a(x)] .$$
Then, we can apply the chain rule, the product rule, and the rule $\frac{d}{du} \log u = \frac{1}{u}$.
Alternatively, we can take the logarithm of both sides of $y(x) := a(x)^{b(x)}$, implicitly differentiate to get an equation $\frac{y'(x)}{y(x)} = \cdots$, solve for $y'(x)$, and substitute for $y(x)$ to write $y'(x)$ in terms of $a(x)$, $b(x)$, and their derivatives.
A: HINT Both terms are currently wrong. You just need to do it more carefully. Chain rule only works for constant powers of $x$ so won't work here. I would take logs of each term separately and then differentiate.
A: let $u(x)=f(x)^{x^2+1}$ and $v(x)=cos(2x)^{g(x)}$
Then $H{'}(x)= u^{'}(x)-v{'}(x)$
now you can do implicit differentiation to find $u^{'}(x)$ and $v{'}(x)$
$log(u(x))=(x^2+1)log(f(x))$
$\frac{1}{u(x)}u{'}(x)=(x^2+1)\frac{f^{'}(x)}{f(x)}+ 2xlog(f(x))$
therefore $u{'}(x)=(f(x))^{x^2+1}((x^2+1)\frac{f^{'}(x)}{f(x)}+ 2xlog(f(x)))$
$v^{'}(x)$ can be found in similar way
A: Observe that when $cos(2x)$ is negative, $[cos(2x)]^{g(x)}$ is not necessarily always defined. In general it will yield complex numbers.
But when everything is well defined, you can put $F(x) = [f(x)]^{x^2 + 1}$ and $G(x) = [cos(2x)]^{g(x)}$. Then $H = F - G$ and $H' = F' - G'$.
Compute $F'$ and $G'$ separately using logarithmic differentiation and combine.
Can you take from there?
