Forces in lagrangian mechanics I've asked previously this question on constraint forces and what I understood from the answer was that constraint forces normal to the virtual displacement do no work. However, I have a problem in which I do not understand how was the Lagrangian equation, 
$$\frac{\partial L}{\partial x}-\frac{{\rm d}}{{\rm d}t}\frac{\partial L}{\partial\dot x}=\text{Generalized forces},$$
was applied. 
The problem is: 

A simple pendulum consisting of length $r$ and a bob of mass $m$
  is attached to a support of mass $M$. The support moves without friction on a horizontal plane. 

In the solution, the kinetic, potential energies are clearly right: 
\begin{align}
T&=\frac{M}{2}\dot x^2+\frac{m}{2}(\dot x^2+r^2\dot \theta^2+2\dot xr\dot \theta \cos\theta) \\
U&=-mgr\cos\theta
\end{align}
Further, to derive the equations of motion, the Lagrangian equation I've written above is applied for $x$ and $\theta$. My question is why do we have
$$
\frac{\partial L}{\partial x}-\frac{{\rm d}}{{\rm d}t}\frac{\partial L}{\partial \dot x}=0
$$
instead of 
$$
\frac{\partial L}{\partial x}-\frac{{\rm d}}{{\rm d}t}\frac{\partial L}{\partial \dot x}=T_{x},
$$
where $T_{x}$ is the $x$ component of tension?
I understand that $T$ is a constraint force but I am not sure if $T_{x}$ is perpendicular to the virtual displacement (when writing the equation applied for x). Otherwise, I understand why 
$$\frac{\partial L}{\partial \theta}-\frac{{\rm d}}{{\rm d} t}\frac{\partial L}{\partial\dot \theta}=0$$
 A: In Lagrangian mechanics all forces arising by constraints are ignored provided they are "orthogonal to the virtual displacements" (see below). 
In fact, the general form of E-L equations for the curve $t \mapsto (t, q(t), \dot{q}(t))$ representing the motion of the system are written this way 
$$\frac{d}{dt}\left(\frac{\partial T(t,q(t),\dot{q}(t))}{\partial \dot{q}^k}\right)- \frac{\partial T(t,q(t),\dot{q}(t))}{\partial q^k}= Q_k(t,q(t), \dot{q}(t))\quad k=1,2,\ldots, n$$ 
together with
$$\frac{dq^k}{dt} = \dot{q}^k(t)\quad k=1,2,\ldots, n$$ 
where $$Q_k(t,q,\dot{q}) = \sum_{i=1}^N {\bf F}_i \cdot \frac{\partial {\bf x}_i}{\partial q^k}\tag{1}$$
and $${\bf F}_i = {\bf f}_i + {\bf \phi}_i\tag{2}$$ is the total force acting on the $i$-th point of matter with position ${\bf x}_i$ in our reference frame where we compute the kinetic energy $T$. I henceforth assume that the points are $N$ and the free coordinates are $n>0$, so that $3N-n=c\geq 0$ is the number of independent constraints.
In (2) I distinguish between forces ${\bf f}_i$ whose I know the functional form as a function of the positions and velocities of all matter points of the Lagrangian system and the reactive forces ${\bf \phi}_i$ which are unknowns of the problem and are physically due to the constraints.
As soon as these reactive  forces satisfy the postulate of ideal reactive forces, we have
      $$\sum_{i=1}^N {\bf \phi}_i \cdot \frac{\partial {\bf x}_i}{\partial q^k}=0\:,\qquad k=1,2,\ldots, n\tag{3}$$
and we can completely ignore them in (1) and thus also in E.-L. equations.
Powerfulness of E.-L. method is also based on this fact: reactive forces disappear and the reaming equations satisfy the general hypotheses permitting existence and uniqueness of solutions. Once known the motion of the system the unknown forces ${\bf \phi}_i$ are constructed out of Newtonian equation ${\bf \phi}_i = m_i {\bf a}_i - {\bf f}_i$.
The  postulate of ideal reactive forces just requires that (3) is true.
There are many equivalent ways to state the same requirement. The "classical" old-fashioned statement says
$$\sum_{i=1}^N {\bf \phi}_i \cdot \delta {\bf x}_i =0 \tag{4}$$
for every "virtual displacement" $\delta {\bf x}_i$. However, since 
$$\delta {\bf x}_i = \sum_{k=1}^n\frac{\partial {\bf x}_i}{\partial q^k} \delta q^k$$
for arbitrary numbers $\delta q^k \in \mathbb R$, (4) is completely equivalent to (3).
NB. The modern view on this matter is that the set of reactive forces $({\bf \phi}_1, \ldots {\bf \phi}_N)$ at everyfixed time must be normal to the  $n$-dimensional submanifold  in the $3N$ configuration space consisting of all  possible configurations permitted to the system taking the $3N-n$ constraints into account.  (3) just says it.
Let us come to your system. I will prove that (3) is automatically satisfied assuming that the $x$ axis is frictionless and the rope has no mass (so it completely transmits its tension).
Let us indicate by ${\bf X}$ the position of $M$ and by ${\bf x}$ that of $m$. The free coordinates are $q^1=x$ and $q^2=\theta$. We therefore have
$${\bf X}(x,\theta)= x{\bf e}_x$$
$${\bf x}(x, \theta) = (x+ r \sin \theta){\bf e}_x - r \cos \theta {\bf e}_y$$
Now let us consider the total reactive force ${\bf \phi}_M$ acting on $M$, it has two components. One is normal to the $x$ axis, since it is frictionless. The other is just provided by the tension $T$ of the ideal rope and thus
$${\bf \phi}_M \cdot \frac{\partial {\bf X}}{\partial x} = {\bf \phi}_M \cdot {\bf e}_x  = T \sin \theta \:,$$ 
$${\bf \phi}_M \cdot \frac{\partial {\bf X}}{\partial \theta} = {\bf \phi}_M \cdot {\bf 0}=0\:.$$
Regarding $m$, the reactive force is only due to the tension ${\bf \phi}_m = T\cos \theta {\bf e}_y - T \sin \theta {\bf e}_x$ so that.
$${\bf \phi}_m \cdot \frac{\partial {\bf x}}{\partial x} = {\bf \phi}_m \cdot {\bf e}_x  = -T \sin \theta$$ 
$${\bf \phi}_m \cdot \frac{\partial {\bf x}}{\partial \theta} = {\bf \phi}_m \cdot (r \cos \theta {\bf e}_x+ r \sin \theta {\bf e}_y)  = T \cos \theta \sin \theta  -T \sin \theta \cos \theta =0\:.$$
Summing together  all contributions, we have
$${\bf \phi}_M \cdot \frac{\partial {\bf X}}{\partial x} + {\bf \phi}_m \cdot \frac{\partial {\bf x}}{\partial x} = T \sin \theta - T \sin \theta =0$$
$${\bf \phi}_M \cdot \frac{\partial {\bf X}}{\partial \theta} + {\bf \phi}_m \cdot \frac{\partial {\bf x}}{\partial \theta} = 0+ 0 =0\:.$$
You see that (3) is satisfied and thus you can completely omit reactive forces when writing E.-L. equations.
Finally, noticing that the remaining force is conservative we can re-write everything using the Lagrangian only as in your text.
A: You would have to include the tension as a generalized force if you did away with the constraint that $r$ is constant when writing your Lagrangian (since it acts inward towards the support, that is, along $r$). You would then have to use Lagrange multipliers to include the constraint of a constant $r$
From what I understand of the generalized coordinates you're using, $x$ represents the location of the support (assuming for the moment it moves on a linear rail instead of a plane as stated in the question) and $\theta$ represents the angle the pendulum makes with the vertical.
Since there is no force acting in the $x$ direction (the support moves without friction) and the force in the $\theta$ direction comes from a potential, you don't need to include generalized forces in the Euler-Lagrange equations if the Lagrangian is written only in terms of $x$ and $\theta$.
