Derivative of $f(x, g(x))$ with respect to $x$ Both $f$ and $g$ are $C^1$ functions and no other assumption. My attempt
\begin{align*}\frac{df}{dx} &= \frac{\partial f}{\partial x}\frac{dx}{dx} + \frac{\partial f}{\partial g}\frac{dg}{dx} \\
&= \frac{\partial f}{\partial x} +  \frac{\partial f}{\partial g}\frac{dg}{dx}\end{align*}
But this does not look correct, how can $\frac{df}{dx}$ is equal to itself plus some other term?
*note: I want to find $\frac{df}{dx}$ exactly which means treat $f$ as a function of $x$ only, not $\frac{\partial f}{\partial x}$.
 A: Your expression is correct.  The key is that "$d\neq \partial$".  That is to say, $\frac{d}{dx} f(x,g(x))$ means the derivative of the one-variable function $f(x,g(x))$, whereas $\frac{\partial}{\partial x} f$ means the derivative of the two-variable function $f(x,y)$ with respect to its first argument.
It can be helpful to introduce extra symbols for variables when doing these sorts of manipulations.  So e.g. let's write $f=f(u,v)$ when taking partial derivatives.  Then substituting $u=x$ and $v=g(x)$ we have $$\frac{d}{dx} f(x,g(x)) = \frac{\partial f}{\partial u} \frac{\partial u}{\partial x} + \frac{\partial f}{\partial v}\frac{\partial v}{\partial x} = \frac{\partial f}{\partial u} + \frac{\partial f}{\partial v}\frac{\partial g}{\partial x}$$
Alternatively, sometimes you see the notation $D_1 f$ to indicate "partial derivative of f with respect to its first argument", and similarly for $D_2$. In this notation, you could write $$\frac{d}{dx} f(x,g(x)) = D_1 f(x,g(x)) + D_2 f(x,g(x)) g'(x)$$
A: That's not $\frac{df}{dx}$, that's $\frac{df(x,g(x))}{dx}$. Actually $\frac{df}{dx}$ makes no sense, since $f$ is a function of two variables.
A: I also had the same confusion before : )
Note $f$ has two inputs, let us define the partial derivatives with respect to the first and second entry as $\partial_1 f$ and $\partial_2 f$.
The reason I like these notations above is that as you have noticed, $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ would be confusion here.
Thus, we have
$$\frac{d}{dx}f(x, g(x)) = \partial_1 f(x, g(x))\frac{dx}{dx}(x) + \partial_2 f(x, g(x)) \frac{dg}{dx}(x).$$
