If you have a conservative system, one way you can derive the equations of motion is by using the fact that the total energy $E$ of the system is conserved, i.e.:
$$ \frac{d}{dt}(T+V)=0 $$
For example consider a simple textbook-pendulum. The total energy is:
$$ T + V = \frac{1}{2}ml^2\dot\varphi^2 + mgl(1-\cos\varphi) $$
Differentiating once with respect to time leads to the following condition, which is trivially true if $\dot\varphi = 0$ or if the terms within the brackets are zero. The latter case leads directly to the familiar equation of motion for a simple pendulum.
$$ 0 = \dot\varphi (ml^2\ddot\varphi + mgl\sin\varphi) $$
$$ \Rightarrow \ddot\varphi + \frac{g}{l}\sin\varphi = 0 $$
Now to the fun stuff
Consider a system where a pendulum is attached to a mass which itself is attached to a spring. This is a system which has two independent degrees of freedom $x$ and $\varphi$.
The total energy of the depicted system is the following mess:
$$ T + V = \frac{1}{2}m_1\dot x^2 + \frac{1}{2}m_2(\dot x^2 + 2l\dot\varphi \dot x \cos\varphi + l^2 \dot\varphi^2) + m_2gl(1-\cos\varphi) + \frac{1}{2}kx^2 $$
Differentiating this mess with respect to time leads to an even bigger mess:
$$ \dot x \ddot x(m_1 + m_2 + k) + m_2l\left(\ddot \varphi \dot x \cos\varphi + \dot\varphi \ddot x \cos\varphi - \dot\varphi^2\dot x \sin\varphi + l\dot\varphi\ddot\varphi - g\dot\varphi\sin\varphi\right) $$
Since the system has two degrees of freedom, we should get two coupled equations of motion. And we can indeed get two such equations if we do the same thing we did above, namely factoring out $\dot x$ and $\dot\varphi$. There is just one slight inconvience here. This term exists.
$$ -m_2l\dot\varphi^2\dot x \sin\varphi $$
Here we can factor out both, $\dot x$ and $\dot\varphi$ which effectively gives two possible sets of equations of motion. Namely these two:
$$ 0 = \ddot x (m_1 + m_2) + m_2l(\ddot\varphi\cos\varphi - \dot\varphi^2\sin\varphi) + kx $$
$$ 0 = m_2l(\ddot x \cos\varphi + l^2\ddot\varphi - g\sin\varphi) $$
or these two:
$$ 0 = \ddot x (m_1 + m_2) + m_2l\ddot\varphi\cos\varphi + kx $$
$$ 0 = m_2l(\ddot x \cos\varphi + l^2\ddot\varphi - g\sin\varphi - \dot\varphi \dot x \sin\varphi) $$
How can we know which way of factoring and which equations are correct? Are both possibilities equaly true? Or is this method just not "valid" for systems with multiple degrees of freedom?