# Interesting Differentiation Technique

@HansEngler Left the following response to this question regarding "bad math" that works,

Here's another classical freshman calculus example:

Find $\frac{d}{dx}x^x$.

Alice says "this is like $\frac{d}{dx}x^n = nx^{n-1}$, so the answer is $x x^{x-1} = x^x$." Bob says "no, this is like $\frac{d}{dx}a^x = \log a \cdot a^x$, so the answer is $\log x \cdot x^x$." Charlie says "if you're not sure, just add the two terms, so you'll get partial credit".

The answer $\frac{d}{dx}x^x = (1 + \log x)x^x$ turns out to be correct.

In this comment, @joriki asserts that this is not "bad math" but rather a legitimate technique,

You get the derivative of any expression with respect to $x$ as the sums of all the derivatives with respect to the individual instances of $x$ while holding other instances constant.

I had never previously seen such a technique so naturally I tested it on a few examples, including $\frac{d}{dx} \left( x^{ \sin x}\right)$, etc. and it provided the correct result. The following three questions arose,

$\ \$ 1. What is the proof of its is validity?
$\ \$ 2. Are there any examples where this technique outshines standard methods?

-
It's the multivariable chain rule. See Case 1 here. –  David Mitra Jul 9 '13 at 1:12

Look at $y = f(u(x),v(x))$: $$\frac{dy}{dx} = \frac{\partial f}{\partial u}\cdot\frac{du}{dx}+\frac{\partial f}{\partial v}\cdot\frac{dv}{dx}$$ Now, note that $x^{\sin x}$ can be written as: $$y=x^{\sin x} = f(x,\sin x), \ f(u,v) = u^v$$ So that: $$\frac{dy}{dx} = \frac{\partial f}{\partial u}\cdot\frac{du}{dx}+\frac{\partial f}{\partial v}\cdot\frac{dv}{dx}= vu^{v-1} \cdot\frac{du}{dx} + \log u \cdot u^v \cdot\frac{dv}{dx}$$ In fact, this holds for any number of terms (since so does the chain rule), where each time we only look at the derivative by $x$ of only one of the terms, multiply those by the "internal" derivative, and sum them all up.
I relied on something similar to this in a published paper. There's an identity that, in the concrete instance where the number of independent variables is $3$, says \begin{align} & \phantom{{}=} \frac{\partial^3}{\partial x_1\,\partial x_2\,\partial x_3} e^y \\[10pt] & = e^y\left(\frac{\partial^3 y}{\partial x_1\,\partial x_2\,\partial x_3} + \frac{\partial^2 y}{\partial x_1\,\partial x_2}\cdot\frac{\partial y}{\partial x_3} + \frac{\partial^2 y}{\partial x_1\,\partial x_3}\cdot\frac{\partial y}{\partial x_2} + {}\right. \\[10pt] & \left.\phantom{{}= e^y\quad{}} + \frac{\partial^2 y}{\partial x_2\,\partial x_3}\cdot\frac{\partial y}{\partial x_1} + \frac{\partial y}{\partial x_1}\cdot\frac{\partial y}{\partial x_2}\cdot\frac{\partial y}{\partial x_3} \right) \end{align}
The point is there's one term for each partition of the set of variables. Having proved this, one can go on to say that $$\frac{d^3}{dx^3} e^y = e^y\left( \frac{d^3 y}{dx^3} + 3\frac{d^2y}{dx^2}\cdot\frac{dy}{dx} + \left(\frac{dy}{dx}\right)^2 \right),$$ simply by saying that's the special case in which all three variables are the same. The proof is the same, but it's clearer when one first treats the variables as distinguishable. When it's written in that form, one can see that there's just one term for each set partition, and all the coefficients are $1$, so that the coefficients in the form with indistinguishable terms have a combinatorial interpreation as the number of set partitions corresponding to a given integer partition.
Similarly \begin{align} & {}\qquad\frac{\partial^3}{\partial x_1\,\partial x_2\,\partial x_3} (uv) \\[10pt] & = u\frac{\partial^3 v}{\partial x_1\,\partial x_2\,\partial x_3} + \frac{\partial u}{\partial x_1}\cdot\frac{\partial^2 v}{\partial x_2\,\partial x_3} + \frac{\partial u}{\partial x_2}\cdot\frac{\partial^2 v}{\partial x_1\,\partial x_3} + \frac{\partial u}{\partial x_3}\cdot\frac{\partial^2 v}{\partial x_1\,\partial x_2} \\[10pt] & \phantom{{}=} + \frac{\partial^2 u}{\partial x_1\,\partial x_2}\cdot\frac{\partial v}{\partial x_3} + \frac{\partial^2 u}{\partial x_1\,\partial x_3}\cdot\frac{\partial v}{\partial x_3} + \frac{\partial^2 u}{\partial x_2\,\partial x_3}\cdot\frac{\partial v}{\partial x_1} + \frac{\partial^3 u}{\partial x_1\,\partial x_2\,\partial x_3}\cdot v \end{align} This time, there is one term for each subset of the set of variables. Each coefficient is $1$. Then one can make all variables indistinguishable, and collect like terms, and then each coefficient is the number of subsets of a specified size.