Spivak Calculus ch 10, Differentiation: for $S(x)=x^2$, why is it better to differentiate $S \circ (\sin\circ S)$ rather than $(S \circ\sin) \circ S$? Consider the function $f(x)=\sin^2(x^2)$.
This is a triple composition $S \circ \sin \circ S$, where $S(x)=x^2$. Apparently we can write this as either $$(S \circ \sin) \circ S\tag{1}$$ or $$S \circ (\sin \circ S)\tag{2}$$
From Spivak's Calculus, chapter 10 on Differentiation, page 174:

The derivative of either expression can be found by applying the Chain
Rule twice; the only doubtful point is whether the two expressions
lead to equally simple calculations. As a matter of fact, as any
experienced differentiator knows, it is much better to use the
second.

$$(S \circ \sin)(x)=(\sin(x))^2$$
$$((S \circ \sin) \circ S)(x)=(\sin(x^2))^2$$
$$((S \circ \sin) \circ S)'(x) = (S \circ \sin)'(S(x))\cdot S'(x)=2\sin(x^2)\cos(x^2) \cdot2x\tag{3}$$
$$(\sin \circ S)(x)=\sin(x^2)$$
$$(S \circ (\sin \circ S))(x)=(\sin(x^2))^2$$
$$(S \circ (\sin \circ S))'(x)=S'((\sin \circ S)(x))\cdot (\sin \circ S)'(x)=2\sin(x^2)\cdot \cos(x^2)2x\tag{4}$$
The difference between the differentiations in $(3)$ and $(4)$ is clear: in $(3)$ you first differentiate a function involving a square and a sine, and then you differentiate a square function; in $(4)$ you first differentiate a square function, and then you differentiate a sine and a square function.
In this particular example, both ways seem easy enough. I imagine Spivak's comment about one way being better refers to other more complicated functions. Why did he say is it much better to use the differentiation as in $(4)$?
 A: Consider how one might go about differentiating a triple composition that one encounters. Looking at
$$h\Bigl(g\bigl(f(x)\bigr)\Bigr)$$
(which is the $S\circ(\sin\circ S)$ analogue) I would first do the derivative of the outermost/first function $h$, evaluate it at the composition $g\circ f$, and then proceed with the derivative of $g\circ f$. And so, if I wanted to do only one derivative at a time, it would look as follows:
$$\begin{align*}
\frac{d}{dx} h\Bigl(g\bigl(f(x)\bigr)\Bigr) &= h'\Bigl( g\bigl(f(x)\bigr)\Bigr)\Bigl(g\bigl( f(x)\Bigr)\Bigr)'\\
&= h'\Bigl( g\bigl(f(x)\bigr)\Bigr) g'\bigl( f(x)\bigr) \bigl(f(x)\bigr)'\\
&= h'\Bigl( g\bigl(f(x)\bigr)\Bigr) g'\bigl(f(x)\bigr) f'(x).
\end{align*}$$
I have: (i) proceeded left-to-right, outermost-to-innermost function. (ii) Having taken the derivative of my first function, I will no longer deal with that first part of the expression, I will only "unwind" the stuff to the right. And (iii) With some practice, I may be able to do it directly, just writing out that
$$\Bigl( h\bigl(g(f)\bigr)\Bigr)' = h'(g(f))g'(f)f',$$
without having to backtrack. Just: derivative of first function evaluated at next, then derivative of the next function evaluated at the next, etc.
By contrast, let's say that I want to do the chain rule by thinking of the composition as $(h\circ g)\bigl(f(x)\bigr)$; this is the analogue of your $(S\circ \sin)\circ S$ expression. This would mean first doing the following:
$$\frac{d}{dx}(h\circ g)\bigl( f(x)\bigr) = (h\circ g)'(f(x))f'(x)$$
and then doing the derivative of $h\circ g$; so that's $h'\circ g$ evaluated at $f(x)$, times $g'$ evaluated at $f(x)$.
Here we are working right-to-left (not how we usually scan a formula or write it), and innermost-to-outermost. It also means doing a bit of a backtrack, and being sure not to get confused when computing $(h\circ g)'(f(x))$ so as not take the derivative of $f(x)$ at some point. More information to keep track of. Whereas in the previous one, we had a kind of "differentiate and forget it" progression, here it appears we don't, as we write it out.
And here we have the functions written as a composition. If we have the functions written out, using for example radicals or exponentiation, then identifying the "innermost function" to perform the chain rule as
$$(\text{bunch of functions})\circ f$$
may not be immediately obvious, while identifying the "outermost function" is usually much easier. For example, to do the derivative of something like
$$\sqrt{(x^3+2)^2 - \sin(x) + \cos^2(x)},$$
doing it from the outside in, as Spivak suggests, means dealing with the square root first, then dealing with the expression $(x^3+2)^2-\sin(x)+\cos^2(x)$, which in turn will have us figure out the derivative of $(x^3+2)^2$, $\sin(x)$, and $(\cos (x))^2$. Trying to do it with "the other way" is much more complicated.
So in general it is much easier to deal with compositions as associated to the right, $h\circ(g\circ (f\circ k))$, because of how we read and write functions, and how this makes us use the Chain Rule sequentially, left-to-right, outermost-to-innermost, and once we've dealt with the function $h$, we won't have to "deal" with it again, we just carry the factor $h'(u)$ around. The other way, we have to work right-to-left, and backtrack, and perhaps have to think hard about how to organize the compositions.
