# Using chain rule to differentiate $f(x)=a(x)b(x)$?

Why can I not apply the chain rule to a product in the following way.

If we have some product:

$$f(x)=a(x)b(x)$$

Consider the multiplication of b by a as another’s function so that:

$$f(b(x))=ab$$

So that

$$\frac{df}{dx} = f’(b)b’(x)$$

Something feels very wrong. But I can’t put my finger on it.

• There may be a $g$ with $g(b(x))=a(x)b(x)$. But you probably don't want to call it "$f$". – David Mitra May 17 at 14:58
• \begin{align} 2a(x)b(x)=a(x)^2+b(x)^2-(a(x)-b(x))^2 \end{align} And you know the derivative of $a(x)^2$ by chain rule. – Bach May 17 at 15:02

## 7 Answers

Write $$\mu(u,v)=uv$$. Then $$\mu_1(u,v) = \frac{\partial\mu}{\partial u}(u,v)= v, \quad \mu_2(u,v) = \frac{\partial\mu}{\partial v}(u,v)= u$$

Now $$f(x)=\mu(a(x),b(x))$$ and so $$f'(x)=\mu_1(a(x),b(x))a'(x)+\mu_2(a(x),b(x))b'(x)=b(x)a'(x)+a(x)b'(x)$$

This is the multiplication rule using the chain rule.

You can't use the chain rule because this is not a composition. Just calling it one does not make it one. For example, suppose $$a(x)=x+1$$ and $$b(x)=x^2$$. Then your first line says $$f(x) = x^2(x+1) = x^3+ x^2$$ so $$f(b(x)) = f(x^2) = (x^2)^3 + (x^2)^2$$ so not the same as "$$ab$$".

• Is there a way to write a product of functions as a composition? – Jake Rose May 17 at 16:14
• Short answer: no. Longer answer: yes, but you have to make things pretty convoluted. See the answer from @lbf . In general, try to think more about the meaning of the derivative as a rate of change, less about which rule to apply. See math.stackexchange.com/questions/3227026/derivative-rules/… – Ethan Bolker May 17 at 17:48

If $$f(x)=a(x)x$$ (it looks as if this is what you have in mind), then $$f\bigl(b(x)\bigr)$$ is equal to $$a\bigl(b(x)\bigr)b(x)$$, instead of $$a(x)b(x)$$.

Also re-interpreting as per David Mitra's comment, that you are looking for some function $$g$$ such that $$g(b(x)) = a(x)b(x)$$ (where $$g$$ is something different from $$f(x) = a(x)b(x)$$).

Your problem here is that then $$a(x) = \frac {g(b(x))}{b(x)}$$. I.e., the value of $$a(x)$$ depends on that of $$b(x)$$. What happens when $$b(x_1) = b(x_2)$$ but $$a(x_1) \ne a(x_2)$$? For example, suppose $$b(x) = c$$ for some constant $$c$$, but $$a(x) = x$$? Clearly no such $$g$$ can exist.

So you cannot turn every product into a composition of single variable functions. However, as lhf has pointed out, multiplication itself is a multivariate function, and the product rule is actually just an application of the multivariate chain rule.

Alternatively, if we know the chain rule and the derivative of the logarithm as well as the fact that $$\log(ab)=\log(a)+\log(b)$$, we get that \begin{align} \left(\log(f(x)g(x)\right) &= \left(\log(f(x))+\log(g(x))\right)'\\ &= \frac{f'(x)}{f(x)}+\frac{g'(x)}{g(x)} \end{align} But we also have that \begin{align} \left(\log(f(x)g(x)\right) &= \frac{\left(f(x)g(x)\right)'}{f(x)g(x)} \end{align}

Based on the remark given by David Mitra in the comments, you are considering: $$g(b(x))=a(x)b(x)$$ which implies we must have $$g(x)=a(b^{-1}(x))x$$ Finding the derivative of this $$g$$ will be a bit messy. $$\frac d{dx}g(x)=a'(b^{-1}(x))\cdot\frac 1{b'(b^{-1}(x))}\cdot x+a(b^{-1}(x))$$ and so plugging in $$b(x)$$ and applying the chain rule gives us: \begin{align} \frac{d}{dx}g(b(x))&=\left(a'(x)\cdot\frac 1{b'(x)}\cdot b(x)+a(x)\right)\cdot b'(x)\\ &=a'(x)b(x)+a(x)b'(x) \end{align}

• Have you not inherently used the product rule when you differentiated g? – Jake Rose May 17 at 16:12
• @JakeRose: Explicitly I have indeed. Then I might not be sure what you were asking, sorry for that. – String May 17 at 16:14

## If you can find such a composition $$A\circ b = a(x)b(x)$$, then the chain rule gives you the product rule. You can find $$A\circ b$$ just if b is invertible.

• Because $$a(x)$$ and $$b(x)$$ are both functions of $$x$$, you might not be able to find a "multiplication function" $$A$$ that lets you write the product $$a(x)b(x)$$ as a chain rule composition $$A(b(x))$$.

This is because $$A$$ only sees the output of the function $$b(x)$$. It doesn't see what $$x$$ is. If it can't see what $$x$$ is (or figure it out based on the value of $$b(x)$$), then it can't compute $$a(x)$$ and so it can't compute $$a(x)b(x)$$.

• When you can recover the value of $$x$$ from the value of $$b(x)$$, we say that $$b$$ is invertible.

• If $$b$$ is invertible, then it has an inverse $$b^{-1}$$ which recovers the value of $$x$$. So, if $$y=b(x)$$ then $$b^{-1}(y) = x$$.

If $$b$$ is invertible, then you can define the function $$A(y) \equiv a(b^{-1}(y)) \cdot y$$.

• Then notice that by definition, $$A(b(x)) = a(b^{-1}(b(x))) \cdot b(x) = a(x)b(x)$$, exactly as we want it. We have written $$a(x)b(x)$$ as a chain rule composition $$A(b(x))$$.

• When we take the derivative using the chain rule, we find that $$\frac{d}{dx}A(b(x)) = a^\prime(x)b(x) + a(x)b^\prime(x)$$, exactly as you want. Though because the definition of $$A$$ depends on a product, you either have to use the product rule anyways to differentiate it, or use the limit definition of the derivative to compute it.

## In multivariable calculus, the chain rule directly gives you the product rule.

What you might be looking for, after all, is a way to use the chain rule as a fundamental tool for proving all of the other rules such as the product rule. You can do this with multivariable calculus.

• The multiplication function is $$M(u,v) = uv$$. Its derivative is $$DM(u,v) = \langle v, u\rangle$$.

• If your two functions are $$a(x)$$ and $$b(x)$$, then their product is $$g(x) = a(x)b(x)$$.

• We can write $$g$$ as a composition: $$g(x) = M(a(x), b(x))$$.

• The derivative of $$g$$ is therefore the derivative of $$M(a(x), b(x))$$---and we can compute this latter derivative using the chain rule.

• By the chain rule,

$$\begin{eqnarray*} D\left[M(a(x),b(x))\right] &= DM( a(x), b(x))\bullet D\langle a(x), b(x)\rangle\\ &= \langle b(x), a(x)\rangle \bullet \langle a^\prime(x), b^\prime(x)\rangle\\ &= b(x)a^\prime(x) + a(x)b^\prime(x) \end{eqnarray*}$$