# Plug-in problem for computing the stationary points

For a function $f(x,y)$, the stationary points are those points s.t. $\left\{ {\begin{array}{*{20}{c}} {\frac{{\partial f}}{{\partial x}} = 0} \\ {\frac{{\partial f}}{{\partial y}} = 0} \end{array}} \right.$. If the second equation has ${\frac{{\partial f}}{{\partial y}} = 0} \Rightarrow y=g(x)$, then it can be plugged into the first equation and we have $\frac{∂f}{∂x}=0⟺{\frac{{\partial f}}{{\partial x}}(x,g(x)) = 0}$ (first do the partial derivative, then plug $y = g(x)$ in).

My confusion is, can we first plug $y=g(x)$ into $f$ and then solve ${\frac{{\partial f(x,g(x))}}{{\partial x}} = 0}$? My feeling is that $\frac{{\partial f(x,g(x))}}{{\partial x}} = 0$ is not equivalent to $\frac{{\partial f}}{{\partial x}}(x,g(x)) = 0$. Can anyone help provide a counter example? An is there any special situation where such plug-in holds?

• I don't know what problem you're exactly working on, but if a definition says something about a function $f(x,y)$, $x$ and $y$ are assumed to be independent of each other; thus, you take the partial derivative first and then you plug the formula for $y$ in. – Pythagoricus Jan 14 '17 at 17:00
• @Pythagoricus Thanks for your comment. This is not what I am asking. I am asking for a counter example that we cannot "first plug in and then compute the partial derivative", which would yield a wrong solution for stationary points. Also I wanna know if there is any special cases when such "first plug-in" would be ok. Because I am currently reading a lecture note whose solution of a problem uses such a surprising "first plugin, then taking derivative", which I think is wrong. – River Jan 14 '17 at 17:09

What is actually happening here is that you have to solve a system of two equations, namely $\{ \partial f / \partial x = 0 \ \& \ \partial f / \partial y = 0 \}$, in order to find the set of all stationary points of $f$. When you optain the solution $y=g(x)$ of the second equation, as you assert in your original post, then you don't need to solve $\partial f / \partial x = 0$ per se; you can simply restrict $f$ to the greatest possible set in which $y=g(x)$ is true.
To be more specific: Let's suppose that $f$ is defined on the reals, then, since you know that $y$ is allways equal to $g(x)$, insted of taking $\partial f / \partial x = 0$ you consider $\partial h / \partial x = 0$, where $h$ is the restriction of $f$ on the set $$\{ (x,y) \in \mathbb{R} | y = g(x) \}.$$