<s>[INST] If $y=x^{2}$ then what is $\frac{d}{d y}\left(\frac{d y}{d x}\right)$? Here's what I did:
$\begin{array}{l}
y=x^{2} \\
\Rightarrow \frac{d y}{d x}=2 x
\end{array}$
and we know that
$x=\pm \sqrt{y}$, let's take the $+$ for the sake of the example.
so $\frac{d y}{d x}=2 \sqrt{y}$
so $\begin{array}{c}
\frac{d}{d y}\left(\frac{d y}{d x}\right)=
\frac{1}{\sqrt{y}}
\end{array}$
But on Wolfram Alpha it gives $0$ because it switches automatically from $\frac{d} {dy} $ to $\frac{\partial}{\partial y}$.
But still$\begin{array}{c}
\frac{\partial }{\partial y}\left(\frac{d y}{d x}\right) \end{array} = \begin{array}{l}
\frac{\partial}{\partial y}(2 \sqrt{y}) 
=\frac{1}{\sqrt{y}}
\end{array} $
I'm so confused by when can I take derivatives or partial derivatives.
 [/INST] By the chain rule,
$$\frac{d\frac{dy}{dx}}{dy} = \frac{d\frac{dy}{dx}}{dx} \cdot \frac{dx}{dy} = 2 \cdot \frac{\operatorname{sgn}(x)}{2\sqrt y}$$
since $y(x)=x^2\implies x(y)=\pm\sqrt y$.
</s>