Why is this the second derivative here? Let $F\colon\mathbb{R}^{2}\to\mathbb{R}$ and $f\colon\mathbb{R}\to\mathbb{R}$
be two $\mathcal{C}^{1}$ functions. Lets say we have a neighborhood
of a point $\left(x_{0},y_{0}\right)$ such that for every $\left(x,y\right)$
we have $F\left(x,y\right)=0$ if and only if $y=f\left(x\right).$
So we can say that in this neighborhood we have $F\left(x,f\left(x\right)\right)=0$
and if we let $g\colon\mathbb{R}\to\mathbb{R}^{2}$ be defined by
$g\left(x\right)=\left(x,f\left(x\right)\right)$ then
$F\left(g\left(x\right)\right)=0$ and therefore
\begin{align*}
0 & =\left[F\left(g\left(x\right)\right)\right]'=D_{F\circ g}\left(x\right)=D_{F}\left(g\left(x\right)\right)\cdot D_{g}\left(x\right)=\\
 & =\left(\frac{\partial F}{\partial x}\left(x,f\left(x\right)\right),\frac{\partial F}{\partial y}\left(x,f\left(x\right)\right)\right)\cdot\begin{pmatrix}1\\
f'\left(x\right)
\end{pmatrix}=\\
 & =\frac{\partial F}{\partial x}\left(x,f\left(x\right)\right)+\frac{\partial F}{\partial y}\left(x,f\left(x\right)\right)\cdot f'\left(x\right)
\end{align*}
$$
\Rightarrow\qquad f'\left(x\right)=-\frac{\frac{\partial F}{\partial x}\left(x,f\left(x\right)\right)}{\frac{\partial F}{\partial y}\left(x,f\left(x\right)\right)}
$$
Im trying to compute $f''\left(x\right)$. I was thinking it
would be something like
$$
f''\left(x\right)=-\frac{\frac{\partial^{2}F}{\partial x^{2}}\left(x,f\left(x\right)\right)\cdot\frac{\partial F}{\partial y}\left(x,f\left(x\right)\right)-\frac{\partial F}{\partial x}\left(x,f\left(x\right)\right)\cdot\frac{\partial^{2}F}{\partial x\partial y}\left(x,f\left(x\right)\right)}{\left[\frac{\partial F}{\partial y}\left(x,f\left(x\right)\right)\right]^{2}}
$$
but I know it is wrong. The correct answer is
$$
f''\left(x\right)=-\frac{\left[\frac{\partial^{2}F}{\partial x^{2}}\left(x,f\left(x\right)\right)+\frac{\partial^{2}F}{\partial x\partial y}\left(x,f\left(x\right)\right)\cdot f'\left(x\right)\right]\cdot\frac{\partial F}{\partial y}\left(x,f\left(x\right)\right)-\frac{\partial F}{\partial x}\left(x,f\left(x\right)\right)\cdot\left[\frac{\partial^{2}F}{\partial x\partial y}\left(x,f\left(x\right)\right)+\frac{\partial^{2}F}{\partial y^{2}}\left(x,f\left(x\right)\right)\cdot f'\left(x\right)\right]}{\left[\frac{\partial F}{\partial y}\left(x,f\left(x\right)\right)\right]^{2}}
$$
and I don't understand why.
Any help please?
 A: The point is that $$\frac{\partial}{\partial x}\left(\frac{\partial F}{\partial x}(x,f(x))\right) \color{red}{\neq}\frac{\partial^2F}{\partial x^2}(x,f(x)), $$but$$\frac{\partial}{\partial x}\left(\frac{\partial F}{\partial x}(x,f(x))\right) =\frac{\partial^2F}{\partial x^2}(x,f(x))\cdot 1+\frac{\partial^2F}{\partial x\partial y}(x,f(x))\cdot f'(x) $$instead. Similar for the other derivative.
A: To answer the question in the comments (and indirectly, the problem):
Consider the functions $$G: \mathbb{R}^2 \to \mathbb{R}, \ G: (x,y)^T\mapsto G(x,y) \\ H:\mathbb{R}\to\mathbb{R}^2, \ H: x\mapsto (H_1(x),H_2(x))^T$$
Then, $G\circ H: \mathbb{R}\to\mathbb{R}, \ G\circ H: x\mapsto G(H_1(x),H_2(x))$. The chain rule$^1$ states that
$$ (G\circ H)'(x) = (G'\circ H)(x)\cdot H'(x) $$
where $(\cdot) '$ is the $m\times n$ matrix of partial derivatives $\partial_j(\cdot)_i$ of a function $(\cdot):\mathbb{R}^n\to\mathbb{R}^m$ and $(\cdot)' = \partial(\cdot)$ for $n = m = 1$.
So, $$G'(x) = ( \partial_1G(x,y),\partial_2G(x,y) ), \\ (G'\circ H)(x) = (\partial_1 G(H_1(x),H_2(x)),\partial_2G(H_1(x),H_2(x)), \\ H'(x) = (\partial H_1(x),\partial H_2(x))^T$$ Multiplying, we see that
$$ \partial (G\circ H)(x) = \partial_1 G(H_1(x),H_2(x))\partial H_1(x) + \partial_2 G(H_1(x),H_2(x))\partial H_2(x)$$
Let $H_1 = E$ (the identity function), $H_2 = f$, and $G = \partial_1 F$. Then,
$$\partial_k G = \partial_k \partial_1 F \\ \partial H_1 = 1 \\ \partial H_2 = \partial f$$
and so
$$ \frac{\partial}{\partial x} \left(\frac{\partial F}{\partial x}(x,f(x))\right) = \\ \partial(\partial_1 F\circ (E,f))(x) = (\partial_1\partial_1 F\circ (E,f))(x) + (\partial_2\partial_1 F\circ (E,f))(x)\cdot\partial f(x) \\ = \frac{\partial^2F}{\partial x^2}(x,f(x)) + \frac{\partial^2 F}{\partial y\partial x}(x,f(x))\cdot f'(x)$$



*

*Spivak, Calculus on Manifolds pp. 19, "2-2 Theorem (Chain Rule)"

