I was reading about parametric equations and their derivatives, when I came across the following formula for parametric equations $x=f(t)$ and $y=g(t)$
$$ \frac{\mathrm d^2y}{\mathrm dx^2}=\frac{\mathrm d}{\mathrm dx}\left(\frac{\mathrm dy}{\mathrm dx}\right)= \frac{\frac{\mathrm d}{\mathrm dt}\left(\frac{\mathrm dy}{\mathrm dx}\right)}{\frac{\mathrm dx}{\mathrm dt}}$$
I wanted to see where this formula came from, and so I tried to derive it, and ended up with the following: $$\frac{\frac{\mathrm dx}{\mathrm dt} \frac{\mathrm d^2y}{\mathrm dt^2} - \frac{\mathrm dy}{\mathrm dt}\frac{\mathrm d^2x}{\mathrm dt^2}}{\left( \frac{\mathrm dx}{\mathrm dt} \right)^3 }$$
After this, I got stuck. I am pretty certain that my equation is correct, however I do not know how the two forms are equivalent. If someone could help derive the top equation from the bottom one, I would really appreciate it. Please be as specific as possible and justify each step, thank you :)
Edit: Here is my derivation of the bottom equation. https://i.stack.imgur.com/vUm2f.jpg I had a small typo all the way down, instead of $dt$ it should be $dt^2$.
It's quite simple to show that both expressions are equivalent. For convenience, I'll use prime notation for derivatives w.r.t. $t$ and quotient notation for all others.
Start with $$ {x'y'' - x''y'\over (x')^3} = {1\over x'}{x'y'' - x''y'\over (x')^2} = {1\over x'} \left({y'\over x'}\right)' $$ by the quotient rule.
To finish it off, we note informally that $$ {y'\over x'} = {\mathrm dy\over\mathrm dt}{\mathrm dt\over \mathrm dx} = {\mathrm dy\over\mathrm dx}, $$ so $$ {1\over x'} \left({y'\over x'}\right)' = {1\over x'}\left({\mathrm dy\over\mathrm dx}\right)' $$ QED.
To give ourselves some peace of mind that the derivative of $t$ w.r.t. $x$ does indeed equals $1/x'$, suppose that it exists some function $f^{-1}$ such that $f^{-1}(x)=t$ for all $x$. Taking the derivative of both sides w.r.t. $t$, we have $$ {\mathrm d\over\mathrm dx}f^{-1}(x)x' = 1 $$ by the chain rule, so $$ {\mathrm d\over\mathrm dx}f^{-1}(x) = {1\over x'}. $$
Since $f^{-1}(x)=t$ by assumption, we have $$ {\mathrm dt\over\mathrm dx} = {1\over x'}. $$