The only rigorous familiarity I have with calculus involves single variable real functions of the form $\mathbb R \to \mathbb R$. In a recent problem I worked on, I defined the following functions:
\begin{align} &(1) \quad f:\mathbb R \times \mathbb R \to \mathbb R, \text{ where }(x,y)\mapsto\sqrt{(x-x_1)^2+(y-y_1)^2} \\&(2)\quad g: \mathbb R \to \mathbb R \times \mathbb R, \text{ where }\theta\mapsto \left(\cos(\theta)\cdot r_0+x_0,\sin(\theta)\cdot r_0+y_0\right) \end{align}
After the definition, I carried out the composition $f \circ g$. I am interested in finding the derivative of this function for an optimization-related pursuit.
If $f$ and $g$ were both defined as $\mathbb R \to \mathbb R$, I would carry out the chain rule as is traditionally taught: $(f\circ g)(x)=f'\left(g(x)\right)g'(x)$.
Clearly, my functions do not satisfy the relevant criteria for the above case...and I am not really sure what to do.
When we write the composition in terms of $\theta$, we get:
$$\left(f\circ g\right)(\theta)=\sqrt{\left(\cos(\theta)\cdot r_0+x_0-x_1\right)^2+\left(\sin(\theta)\cdot r_0+y_0-y_1\right)^2} \quad (*)$$
Suppose, for a second, that someone told me to take the derivative of the function:
$$T: \mathbb R \to \mathbb R, \text{ where } \theta \mapsto\sqrt{\left(\cos(\theta)\cdot r_0+x_0-x_1\right)^2+\left(\sin(\theta)\cdot r_0+y_0-y_1\right)^2}$$
I would say, "No problem". However, in the case of $(*)$, if we interpret the function as a composition, then I am not really sure what it means to take the derivative of a functions of the form $\mathbb R \times \mathbb R \to \mathbb R$ or $\mathbb R \to \mathbb R \times \mathbb R$.
When providing the readers with my specific example, it is clear that $f \circ g = T$, so, presumably, $(f\circ g)'=T'$. Instead, suppose I only knew the most general things about my $f$ and $g$ functions: domain and range. i.e. suppose I knew nothing about the specific mapping rule.
Is it a sufficient proof to say that any composition of the form $f_1 \circ f_2 \circ \cdots \circ f_n$ that has domain $\mathbb R$ and codomain $\mathbb R$ must necessarily have an equivalent representation as a function $g$ of the form $g: \mathbb R \to \mathbb R$, where $\theta \mapsto f_1 \circ f_2 \circ \cdots \circ f_n (\theta)$?
In which case, despite my knowledge being restricted to single variable calculus of the form $\mathbb R \to \mathbb R$, I can find the derivative of $f_1 \circ f_2 \circ \cdots \circ f_n$ simply by taking the derivative of $g$? That is to say that the domain of $f_2, f_3, \cdots, f_n$ and the codmains of $f_1, f_2, \cdots , f_{n-1}$ can be literally anything and it is still business as usual (within the framework of single variable $\mathbb R \to \mathbb R$ function calculus), right?