Elementary derivation of the motion equations for an inverted pendulum on a cart

Consider a cart of mass $M$ constrained to move on the horizontal axis. A massless rod is attached to the midpoint of the cart, having a mass $m$ on its endpoint. See wikipedia for a picture and for a derivation of the equations of motion.

I'm wondering if someone could provide an elementary derivation of these equations of motion, using just Newton's second law and free body diagrams without appealing to the Euler Lagrange equations.

My reasons for asking: I am a math student that is going to use this as an example in a presentation to engineering students and I don't want to appeal to concepts neither I nor my audience know; unfortunately, my knowledge of physics is sadly lacking...

-
BTW, you will find that anything beyond 1 body gets super complex really quickly with Newtons Law's. On the other hand, you get a lot more information (like reaction forces) compared to Lagrange's method. –  ja72 Aug 28 '12 at 1:16

First break the problem up using two free body diagrams.

Then figure out the kinematics at point A $$\vec{r}_A = \begin{pmatrix} x \\ 0 \\ 0 \end{pmatrix}$$ $$\vec{v}_A = \begin{pmatrix}\dot x \\ 0 \\ 0 \end{pmatrix}$$ $$\vec{a}_A = \begin{pmatrix}\ddot x \\ 0 \\ 0 \end{pmatrix}$$ and point B $$\vec{r}_B = \vec{r}_A + \begin{bmatrix} \cos\theta & \text{-}\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{pmatrix} 0 \\ l \\ 0 \end{pmatrix} = \begin{pmatrix} x - l \sin\theta \\ l \cos\theta \\ 0 \end{pmatrix}$$ $$\vec{v}_B = \vec{v}_A + \begin{pmatrix} 0 \\ 0 \\ \dot\theta \end{pmatrix} \times \left( \vec{r}_B - \vec{r}_A \right) = \begin{pmatrix} \dot{x}-l \dot{\theta}\cos\theta \\ \text{-}l \dot\theta \sin\theta \\ 0 \end{pmatrix}$$ $$\vec{a}_B = \vec{a}_A + \begin{pmatrix} 0 \\ 0 \\ \ddot\theta \end{pmatrix} \times \left( \vec{r}_B - \vec{r}_A \right)+ \begin{pmatrix} 0 \\ 0 \\ \ddot\theta \end{pmatrix} \times \left( \vec{v}_B - \vec{v}_A \right) = \begin{pmatrix} \ddot{x}-l \ddot{\theta}\cos\theta+l \dot{\theta}^2 \sin\theta \\ \text{-}l \ddot\theta\sin\theta -l \dot{\theta}^2 \cos\theta \\ 0 \end{pmatrix}$$

Find the sum of the forces for the two bodies using trigonometry

$$\sum \vec{F}_A = \begin{pmatrix} F +A_y \sin\theta \\ N- A_y \cos\theta \\ 0 \end{pmatrix}$$

$$\sum \vec{F}_B = \begin{pmatrix} - A_y \sin\theta \\ A_y \cos\theta - m g \\ 0 \end{pmatrix}$$

And finally apply Newtons laws to the centers of gravity

$$\sum \vec{F}_A = M \vec{a}_A$$ $$\sum \vec{F}_B = m \vec{a}_B$$

which is 4 equations (ignore z-components) with 4 unknowns $N$, $A_y$, $\ddot{x}$, $\ddot\theta$.

The final solution I get for the motion is

$$\ddot{x} = \frac{F + m g \cos\theta \sin\theta -m l \dot{\theta}^2 \sin\theta } {M + m\sin^2\theta}$$ $$\ddot{\theta} = \frac{g (M+m) \sin\theta - \cos\theta (l m \dot{\theta}^2 \sin\theta-F)}{l (m \sin^2\theta+M) }$$

The above ignores all the rotational components for rigid bodies expressed in Newton-Euler's equations of motion. The rotational equations of motion would be $\sum \vec{M}_A = I_A \dot{\vec{\omega}_A} + \vec{\omega}_A\times I_A \vec{\omega}_A$ and $\sum \vec{M}_B = I_B \dot{\vec{\omega}_B} + \vec{\omega}_B\times I_B \vec{\omega}_B$ but that is beyond the scope of this discussion.

-
What did you use to draw the diagram? –  Physiks lover Aug 27 '12 at 17:43
Powerpoint and IgaunaTex ( technion.ac.il/~zvikabh/software/iguanatex ) to render LaTeX on the slides. –  ja72 Aug 27 '12 at 18:09
Thanks a lot! Can you explain why your answer appears to be different from the answer at wikipedia? I'm guessing it has something to do with your comment about ignoring the rotational components; can you expand on that? –  robinson Aug 27 '12 at 19:03
I have solved for $\ddot x$ and $\ddot \theta$. The wikipedia article does not. If you do solve for those you get the same result. –  ja72 Aug 28 '12 at 1:01