I'm trying to work through Spivak's Calculus on Manifolds and I've arrived at Differentiation. While I can usually follow his steps, I find myself lost or stuck when I try to do something on my own. So I decided to work through one of his first examples using $Df$ notation instead of $f'$ notation.
My main point, I have confused myself. My question is clearly asked only at the very bottom of this post.
As for the example, I need to calculate the derivative of $f:\mathbb{R}^{2}\to \mathbb{R}$, where $f(x,y) = \sin(xy^2).$
The following rules are available to me:
1) For a point $a$ in the domain of $f$ such that $f(a)$ is in the domain of $g$, $D(g\circ f)(a) = Dg(f(a))\circ Df(a).$
2) For two functions $f,g:\mathbb{R}^{n}\to \mathbb{R}$, $D(fg)(a) = g(a)Df(a) + f(a)Dg(a)$ and $D(f+g)(a) = Df(a) + Dg(a).$
If I have stated either of these rules even slightly incorrectly please be brutally in my face about it.
I'm trying to carefully apply this rules to my function.
If I let $p,s:\mathbb{R}^{2}\to \mathbb{R}$ denote the product function and $s:\mathbb{R}\to \mathbb{R}$ represent the squaring function, I can write:
$f = \sin\circ p\circ (\pi_{1}, s\circ \pi_{2})$, where $\pi_{1}$ and $\pi_{2}$ are the coordinate functions.
Now my derivative of $f$, denoted $Df$, should be a map from $\mathbb{R}^{2}\to \mathbb{R}$, just like $f$ is.
So at a point $(a,b)\in \mathbb{R}^{2}$, I can write
\begin{align*} Df(a,b) &= D\left(\sin\circ p\circ (\pi_{1}, s\circ \pi_{2})\right)(a,b)\\ &= D(\sin)(p\circ (\pi_{1}, s\circ \pi_{2})(a,b))\circ Dp((\pi_{1}, s\circ \pi_{2})(a,b))\circ D(\pi_{1}, s\circ \pi_{2})(a,b) \end{align*}
So I try to calculate this in separate blocks:
\begin{align*} D(\sin)(p\circ (\pi_{1}, s\circ \pi_{2})(a,b)) &= \cos(p\circ (\pi_{1}, s\circ \pi_{2})(a,b))\\ &= \cos(p\circ (\pi_{1}(a,b), [s\circ \pi_{2}](a,b)))\\ &= \cos(p\circ (a, s(b)))\\ &= \cos(p\circ (a, b^2)))\\ &= \cos(ab^2). \end{align*}
But this brings me to my first (among several) points of confusion.
In the equation: $Df(a,b) = D(\sin)(p\circ (\pi_{1}, s\circ \pi_{2})(a,b))\circ Dp((\pi_{1}, s\circ \pi_{2})(a,b))\circ D(\pi_{1}, s\circ \pi_{2})(a,b)$ it appears $D(\sin)(p\circ (\pi_{1}, s\circ \pi_{2})(a,b))$ should be a function, not a number. Can someone point out what my error in thinking is? (answered below)
Continuing on to compute the 3rd block,
\begin{align*} D(\pi_{1}, s\circ \pi_{2})(a,b) &= (D\pi_{1}(a,b), D(s\circ \pi_{2})(a,b))\\ &= (\pi_{1}(a,b), Ds(\pi_{2}(a,b))\circ D\pi_{2}(a,b))\\ &= (a, Ds(b)\circ \pi_{2}(a,b))\\ &= (a, 2b\circ b)\\ &= (a, 2b^2) \end{align*}
Now the middle one:
\begin{align*} Dp((\pi_{1}, s\circ\pi_{2})(a,b)) &= Dp((\pi_{1}(a,b), (s\circ \pi_{2})(a,b))\\ &= Dp(a, b^2) \end{align*}
Now substituting these smaller calculations, the whole thing simplifies down to: \begin{align*} Df(a,b) &= D(\sin)(p\circ (\pi_{1}, s\circ \pi_{2})(a,b))\circ Dp((\pi_{1}, s\circ \pi_{2})(a,b))\circ D(\pi_{1}, s\circ \pi_{2})(a,b)\\ &= \cos(ab^2)\circ \underbrace{Dp(a, b^2)\circ (a, 2b^2)}_{= a\cdot 2b^2 + b^2\cdot a}\\ &= \cos(ab^2)(3ab^2) \end{align*}
Now I will insist that I have something wrong. $Df(a,b)$ should be a map from $\mathbb{R}^{2}\to \mathbb{R}$. But it has collapsed into a single real number.
Spivak calculates the derivative using Jacobian notation, arriving at the conclusion that $f'(a,b) = (b^2\cdot\cos(ab^2), 2ab\cdot \cos(ab^2))$, which naturally is the transformation matrix for a map $\mathbb{R}^{2}\to \mathbb{R}$.
Sorry this problem is so long winded, but I wanted to show all my steps so as to be able to identify the one that went awry.