by inspection this equation is identical to the result from lagrange's method. in order to obtain the second equation the pendulum equation of motion must be dotted with a unit vector which runs perpendicular to the pendulum at all times and is typically noted as the x-coordinate of the body frame. in inertial coordinates this vector can be written using a simple 2-d coordinate transformation