# Chain rule with triple composition

We are supposed to apply the chain rule on the following function $f$:

$$f(x) = \sqrt{x+\sqrt{2x+\sqrt{3x}}}$$

I assumed we could rewrite this as $$f(x) = g(h(j(x)))$$ However, I was not sure how to define the functions $$g(x), h(x), j(x)$$ Any help would be appreciated.

• Well, it is easy, you just use $j(x)=\sqrt{x+\sqrt{2x+\sqrt{3x}}}$, $h(x)=\sqrt{x}$, $g(x)=x²$... Just kidding! Commented Nov 14, 2014 at 15:30

It seems more realistic to write your function as a composition of two functions, instead of three. However, if you do successfully rewrite your function as the composition of three functions then $$[g(h(j(x)))]'=g'(h(j(x))\cdot h'(j(x)) \cdot j'(x)$$ or for a finite collection of differentiable functions $\{f_i \}_{i=1}^n$, the derivative of their composition is $$\left[f_1 \circ f_2 \circ \dots \circ f_n\right]' =\prod_{i=1}^n \left(f'_i\circ f_{i+1} \circ \dots \circ f_n\right)$$

I would simply do something like this: \begin{align} g(x) &= \sqrt{x}\\ h(x) &= x+\sqrt{2x+\sqrt{3x}} \end{align} so that $f(x) = g(h(x))$. Then by the chain rule $$f'(x) = g'(h(x))h'(x) = \frac{1}{2\sqrt{h(x)}}h'(x)$$ Then we apply the chain rule to find $h'(x)$. $$h'(x) = 1+\frac{1}{2\sqrt{2x+\sqrt{3x}}}(2x+\sqrt{3x})'$$ Then $$(2x+\sqrt{3x})' = 2+\frac{1}{2\sqrt{3x}}(3x)'=2+\frac{3}{2\sqrt{3x}}.$$

Finally we get that $$f'(x)=\frac{1}{2\sqrt{x+\sqrt{2x+\sqrt{3x}}}}\left(1+\frac{1}{2\sqrt{2x+\sqrt{3x}}}\left(2+\frac{3}{2\sqrt{3x}}\right)\right)$$ Which I'm sure can be simplified somewhat, please tell me anyone if I made any errors in this computation.

• I just did exactly the same thing (not noticing that new answers had been posted while I was writing mine) and got exactly the same answer, so I don't think we made any mistakes. Commented Nov 14, 2014 at 15:52
• @Simpson17866 That's awesome! I think if I would ever do a problem like this again, I should write it on paper first, because keeping track of the LaTeX and computations at the same time was slightly difficult :-)
– Eff
Commented Nov 14, 2014 at 15:57
• Yes, yes it was Commented Nov 14, 2014 at 19:55

Do it in steps. Let $j = \sqrt{3x}$

Then $f = \sqrt{x + \sqrt{2x + j}}$

Let $h = {\sqrt {2x + j}}$

And so on.

$\displaystyle \frac {\mathrm df}{\mathrm dx} = \frac {\mathrm df}{\mathrm dg}\frac {\mathrm dg}{\mathrm dh} \frac {\mathrm dh}{\mathrm dj}\frac {\mathrm dj}{\mathrm dx}$

edit: of course, the other answers are just as correct, but I find it easier to introduce more variables and then substitute them in when you're done.

• There is an issue with your point: if $h(x)=\sqrt{2x+j}$, then $h(j(x))=\sqrt{j(x)+j²}$. Commented Nov 14, 2014 at 15:44
• If it bothers you, then consider $f(x) = f(x, g, h, j)$. As long as you apply the chain rule enough times and then do the substitutions when you're done. Commented Nov 14, 2014 at 15:46
• What I mean is, you should explicitely describe the way you construct, otherwise it will lead to confusion to any person that is not well versed. Commented Nov 14, 2014 at 15:47
• If you explain the answer better, and I like yours more, I'll glad to upvote yours and delete mine. Commented Nov 14, 2014 at 15:50

1) $j(x) = 2x + \sqrt{3x}$

$j'(x) = 2 + \frac{\sqrt{3}}{2\sqrt{x}}$

2) $h(x) = x + \sqrt{2x + \sqrt{3x}} = x + \sqrt{j(x)}$

$h'(x) = 1 + \frac{1}{2*\sqrt{j(x)}} * j'(x)$ $=1 + \frac{1}{2*\sqrt{2x + \sqrt{3x}}} * (2 + \frac{\sqrt{3}}{2\sqrt{x}})$

3) $g(x) = \sqrt{x + \sqrt{2x + \sqrt{3x}}} = \sqrt{h(x)}$

$g'(x) = \frac{1}{2*\sqrt{h(x)}} * h'(x)$ $=\frac{1}{2*\sqrt{x + \sqrt{2x + \sqrt{3x}}}} * (1 + \frac{1}{2*\sqrt{2x + \sqrt{3x}}} * (2 + \frac{\sqrt{3}}{2\sqrt{x}}))$

Taking @Eff awesome start point

$$f = \sqrt{x + \sqrt{2x + \sqrt{3x}}}$$ as

$$f^2 - x = \sqrt{2x + \sqrt{3x}}\implies \left(f^2-x\right)^2 - 2x = \sqrt{3x}$$

and then do implicit differentiation to get $f'$? maybe