[Math] Derivative of function composed with itself

derivativespartial derivative

I don't know hot to differentiate a simple function composed with itself.

Let $f_{a}(x)$ be a function of $x$ and $a$:

$$f_{a}(x)=ax$$

Here $x$ will be always fixed (e.g. a point) and $a$ is considered parameter. The derivative with respect to $a$ is obviously $x$.

Now what about another derivative at $x$ with respect to $a$ of this function:

$$f_{a}(f_{a}(x))=f_{a}(ax)=a^{2}x$$

The derivative should be therefore:

$$\frac{\partial}{\partial a}f_{a}(f_{a}(x))=\frac{\partial}{\partial a}a^{2}x=2ax$$

But using chain rule:

$$\begin{align}\frac{\partial}{\partial a}f_{a}(f_{a}(x)) &= \frac{\partial f_{a}}{\partial f_{a}(x)}\cdot\frac{\partial f_{a}(x)}{\partial a} \\ &= \frac{\partial f_{a}}{\partial f_{a}(x)}\cdot x\end{align}$$

From this we know that $\frac{\partial f_{a}}{\partial f_{a}(x)}$ must be equal to $2a$. But how to get to this?

I know the chain rule is probably used improperly here. What rule applies in this case? Or how to restate the problem so that we can have such composition?

Best Answer

$$f_a(x)=f(a,x)=ax$$ $$f_a(f_a(x))=f(a,f_a(x))=f(a,f(a,x))=af(a,x)=a^2x$$ $${\partial\over\partial a}f(a,x)={\partial(ax)\over\partial a}=x$$ $${\partial\over\partial x}f(a,x)={\partial(ax)\over\partial x}=a$$ $${\partial\over\partial a}f(a,f(a,x))={\partial\over\partial a}f(a,u)$$ where,$$u=f(a,x)=ax$$ Then: $${\partial\over\partial a}f(a,u)={\partial(au)\over\partial a}+{\partial f(a,u)\over\partial u}{\partial u\over\partial a}=u+ax=ax+ax=2ax$$