The best linear approximation of a real function infinitely times differentiable is given by:
$$ f(x) = f(x_0) + f^{(1)}(x_0)(x-x_0) + \frac{f^{(2)}(\xi_x)}{2}(x-x_0)^2 = \\ f(x_0) + f^{(1)}(x_0)(x-x_0) + r_1(x) $$
What happens if I make $x_0 = g(x)$? you can assume is infinitely times differentiable. Is there a way to write such expansion? Is it gonna look like
$$ f(x) = f(g(x)) + f^{(1)}(g(x))(x-g(x)) + r_1(g(x)) $$
Or would it look like something $$ f(x) = f(g(x)) + f^{(1)}(g(x))g^{(1)}(x)(x-g(x)) + \hat{r}_1(g(x)) $$
I believe is the second one, but I'm not entirely sure. Is there a theorem I'm not aware of that maybe I should read through?