This page is part of a serie of articles on how to write the model of an inverted pendulum. We strongly recommand to read the previous pages for a better understanding.
The fundamental principle of dynamics can be apply to our system. For the trolley (body 1):
$$ \begin{array}{r c l} m_1.{a_1}^x = m_1.\ddot{x_1}&=& | \vec{F_t} | + \lambda_1 \\ m_1.{a_1}^y = m_1.\ddot{y_1}&=& 0 + \lambda_2 \\ I_1.\ddot{\Theta_1} &=& 0 + \lambda_3 \ \end{array} $$
For the pendulum (body 2):
$$ \begin{array}{r c l} m_2.{a_2}^x = m_2.\ddot{x_2} &=& 0 + \lambda_4 \\ m_2.{a_2}^y = m_2.\ddot{y_2} &=& | \vec{F_g} | + \lambda_5 = -g.m_2 + \lambda_5\\ I_2.\ddot{\Theta_2} &=& 0 + \lambda_6 \ \end{array} $$
Where \(\lambda_1\), \(\lambda_2\), \(\lambda_3\), \(\lambda_4\), \(\lambda_5\) and \(\lambda_6\) are the Lagrange's coefficients. These coefficients represent the interaction between bodies. In the present system, this is the interaction between the pendulum and the trolley.