Pendulum with Oscillatory Support - A question on Lagrangian Mechanics Recently I have been attempting Morin's Introduction to Classical Mechanics (2008) but I got rather stuck on question 6.3 on the topic of Langrangian Mechanics. Attached are the problem and the illlustrating image.

Question 6.3: A pendulum consists of a mass m and a massless stick of length l. The pendulum support oscillates horizontally with a position given by x(t)=Acos(wt), see Fig. 6.10. What is the general solution for the angle of the pendulum as a function of time?


My initial thought of the question was that since the support undergoes harmonic oscillation, there must be a constant force acting on the support. For instance, a spring may be driving the motion of the support. The langrangian calculated must include the kinetic energy of the support and the potential energy of the driving force, in addition to the motion of the pendulum.
As such, I solved the question as below:

coordinates of support: $(x, 0)$
\
coordinates of mass: $(x-l \sin \theta, -l \ cos \theta)$
$T=\frac{1}{2}M\dot x^2 + \frac{1}{2}m[\dot {(x+l \sin \theta)}^2+ \dot{(-l\cos\theta)}^2]=\frac{1}{2}M\dot x^2+\frac{1}{2}m(\dot x^2+2 l \dot x \cos \theta \dot {\theta} + l^2{\dot \theta}^2)$
$V=mgl\cos\theta+\frac{1}{2}kx^2$
$L=T-V=\frac{1}{2}M\dot x^2+\frac{1}{2}m(\dot x^2+2 l \dot x \cos \theta \dot {\theta} + l^2{\dot \theta}^2)-mgl\cos\theta-\frac{1}{2}kx^2$
When I checked the answer, however, the motion of the support is not included in the calculation of the Lagrangian L. Instead $T=\frac{1}{2}m(\dot x^2+2\dot x \cos \theta \dot {\theta} + l^2{\dot \theta}^2)$ and $V=mgl\cos\theta$. The L calculated was therefore
$L=\frac{1}{2}m(\dot x^2+2 l \dot x \cos \theta \dot {\theta} + l^2{\dot \theta}^2)-mgl\cos\theta$
Of course, when taking the Euler-Langrange equations by the $\theta$ coordinates, the differential equations obtained for both cases are the same as the M and k terms have no $\theta$ or $\dot \theta$ terms, so the final answers are the same.
However, I am rather confused why the answer provided in the book allowed for the Lagrangian to be calculated for the mass alone without consideration of the support. A viable $L$ would require the total energy in the frame to be conserved. How would anyone know that movement of the support does not contribute to the energy of the mass before any calculation beforehand? Or am I missing something?
Thanks for any responses in advance.
 A: You have confused this for a pendulum with free support. In this question, the support is made to oscillate (by whatever external force necessary) such that $x$ is always equal to $A \cos \omega t$. Therefore, $x$ is not a coordinate that you are trying to solve for. The Lagrangian only has one coordinate which is $\theta$:
$$L = L(\theta, \dot{\theta},t)$$
Your method gave the correct equation of motion simply because (1) the extra terms you added did not contain $\theta$ or $\dot{\theta}$ and (2) there is no equation of motion for $x$ in the first place.
Since $L$ depends explicitly on time through $\dot{x}$ ($\partial L/\partial t \neq 0$), energy is not conserved. This should be obvious because of the presence of the external force.
This problem can also be done using $F=ma$ if we switch into the frame of the support. In this frame, the pendulum is a simple pendulum except for an additional fictitious force of $-\ddot{x}(t) = -A \omega^2 \cos\omega t$ acting in the horizontal direction.
