# 2 Body Radial Equation, Effective Potential derivation

According to my textbook, in the derivation for the effective potential $U_{eff}$, starting with the Lagrangian $L = \frac{1}{2}\mu(\dot r^2 +r^2\dot\phi^2) -V(r)$, substituting into Lagrange's equation gives $\mu\ddot r = -\frac{\partial V}{\partial r} + \frac{l^2}{\mu r^3} = -\frac{\partial}{\partial r}(V(r) + \frac{l^2}{2\mu r^2})$, where the substitution $\dot\phi = \frac{l}{r^2\mu}$ is made after substituting into Lagrange's equation and the effective potential is $V(r) + \frac{l^2}{2\mu r^2}$ and $l$ is the angular momentum.

However, when I do the derivation by first substituting the angular momentum, it goes like this: Starting with $L = \frac{1}{2}\mu(\dot r^2 +\frac{l^2}{\mu^2 r^2}) -V(r)$, then substituting into lagranges equation gives $\mu\ddot r = -\frac{\partial V}{\partial r} - \frac{l^2}{\mu r^3} = -\frac{\partial}{\partial r}(V(r) - \frac{l^2}{2\mu r^2})$, where the effective potential is $V(r) - \frac{l^2}{2\mu r^2}$.

This is the wrong result, but I can't see why substituting angular momentum before or after taking the derivatives should make any difference.

Thanks for any help!