# Thread: A case where the chain rule fails

1. ## A case where the chain rule fails

I've had people ask me why we cannot differentiate functions of the form $y = f(x)^{g(x)}$ using the chain rule, such as $y = x^x$. We know that we must resort to logarithms and thus differentiate it implicitly to actually get anywhere.

But my question: how would you explain why the chain rule fails on functions of the form $y = f(x)^{g(x)}$?

2. ## Re: A case where the chain rule fails

I've had people ask me why we cannot differentiate functions of the form $y = f(x)^{g(x)}$ such as $y = x^x$.
I am not sure I understand this sentence, but one can apply the chain rule if the function f(x), which is to be differentiated, is obtained from some function h(y) by substituting another function g(x) for y: f(x) = h(g(x)). How do you obtain $f(x)^{g(x)}$ by substituting something for x in $x^x$?

3. ## Re: A case where the chain rule fails

I've had people ask me why we cannot differentiate functions of the form $y = f(x)^{g(x)}$ using the chain rule, such as $y = x^x$. We know that we must resort to logarithms and thus differentiate it implicitly to actually get anywhere.

But my question: how would you explain why the chain rule fails on functions of the form $y = f(x)^{g(x)}$?
You CAN use the Chain Rule, it's just more difficult...

\displaystyle \begin{align*} y &= f^g \\ y &= e^{\ln{\left( f^g \right)}} \\ y &= e^{g\ln{f}} \end{align*}

Now make the substitution \displaystyle \begin{align*} u = g\ln{f} \end{align*} so that \displaystyle \begin{align*} y = e^u \end{align*} and we have

\displaystyle \begin{align*} \frac{du}{dx} &= g\,\frac{d}{dx}\left( \ln{f} \right) + \ln{f}\,\frac{d}{dx}\left( g \right) \\ &= g\,\frac{d}{df}\left( \ln{f} \right) \frac{df}{dx} + \ln{f}\,\frac{dg}{dx} \\ &= \frac{g}{f}\,\frac{df}{dx} + \ln{f}\,\frac{dg}{dx} \\ \\ \frac{dy}{du} &= e^u \\ &= e^{g\ln{f}} \\ &= e^{\ln{\left( f^g \right)}} \\ &= f^g \\ \\ \frac{dy}{dx} &= f^g \left( \frac{g}{f}\,\frac{df}{dx} + \ln{f}\,\frac{dg}{dx} \right) \end{align*}

4. ## Re: A case where the chain rule fails

I've had people ask me why we cannot differentiate functions of the form $y = f(x)^{g(x)}$ using the chain rule.
We know that we must resort to logarithms and thus differentiate it implicitly to actually get anywhere.

But my question: how would you explain why the chain rule fails on functions of the form $y = f(x)^{g(x)}$?

The Chain Rule is not at fault . . . we are!

We can differentiate $y \:=\:x^4$ by the Power Rule: . $\frac{d}{dx}(x^n) \:=\:nx^{n-1}$
. . where base $x$ is variable and exponent $n$ is constant.

We can differentiate $y \:=\:2^x$, by the Exponential Rule: . $\frac{d}{dx}(b^x) \:=\:b^x\ln b$
. . where exponent $x$ is variable and base $b$ is constant.

Note that one part is a variable and the other part is a constant.

With $y \:=\:x^x$, we have a variable base and a variable exponent.
Neither the Power Rule nor the Exponential Rule can be applied.

We must "hammer" the function into a form where the basic Rules can be applied.
(So we apply logs, then use Implicit Differentiation, etc.)

6. ## Re: A case where the chain rule fails

we can...but we have to be "sneaky" about it:

note that f(x)g(x) = eln(f(x))g(x)

= (hok)(x), where:

h(x) = ex
k(x) = ln(f(x))g(x)

note that k(x) = u(x)g(x), where u is also a composition of functions:

u = vof, where:

v(x) = ln(x).

so the first thing to do, is compute u'(x) = v'(f(x))(f'(x)) = f'(x)/f(x) (we used the chain rule, here)

now we calculate k' by using the product rule:

k'(x) = u(x)g'(x) + u'(x)g(x) = ln(f(x))g'(x) + (f'(x)/f(x))g(x).

now, at long last, we calculate (f(x)g(x))' = (hok)'(x), by using the chain rule a second time:

(hok)'(x) = h'(k(x))k'(x) = ek(x)k'(x) = eln(f(x))g(x)(ln(f(x))g'(x) + f'(x)g(x)/f(x))

= f(x)g(x)(ln(f(x))g'(x) + f'(x)g(x)/f(x))

*****

some observations:

for the definition of f(x)g(x) to even make sense, and for the term ln(f(x)) to make sense in the derivative, we need f(x) > 0 for all x.

we could consider f(x)g(x), as a function of two variables, f and g, each of which is a function of x.

the chain rule in for 2-variable case is (calling our function f(x)g(x), say t(x)):

dt/dx = (∂t/∂f)(df/dx) + (∂t/∂g)(dg/dx).

∂t/∂f considers g = g(x) as a constant, so ∂t/∂f = g(x)f(x)(g(x) - 1) = g(x)f(x)g(x)/f(x)

∂t/∂g considers f = f(x) as a constant, so ∂t/∂g = f(x)g(x)(ln(f(x)).

df/dx and dg/dx are just f'(x) and g'(x), so putting this all together we get:

dt/dx = g(x)f(x)g(x)f'(x)/f(x) + f(x)g(x)(ln(f(x))g'(x).

we can take out a common factor of f(x)g(x), getting:

dt/dx = f(x)g(x)(ln(f(x))g'(x) + f'(x)g(x)/f(x)), just as we obtained before.