Time dependent Lagrangian Suppose I have a mechanical system with $\ell + m$ degrees of freedom and an associated Lagrangian:
$$L(\alpha, \beta, \dot{\alpha}, \dot{\beta}, t),$$
where $\alpha \in \mathbb{R}^{\ell}$ and $\beta \in \mathbb{R}^{m}$. Now suppose I have a known $\mathbb{R}^{\ell}$-valued function $f(t)$ and define a new Lagrangian:
$$M(\beta, \dot{\beta}, t)~:=~L(f(t), \beta, \dot{f}(t), \dot{\beta}, t)$$
Do the equations that derive from $M$ correctly describe the motion of the initial mechanical system, where the first $\ell$ degrees of freedom are constrained to the motion $f(t)$ (by means of an external force)?
 A: Let us reformulate OP's question(v2) as follows:

If we have a Lagrangian $L=L(q^1,\ldots, q^N, \dot{q}^1,\ldots, \dot{q}^N,t)$, and if we eliminate some of the  $q^i$ variables from the Lagrangian [by using some given fixed curves $q^i=f^i(t)$], can we still derive the correct Lagrangian equations of motion (LEOM) for the remaining $q^i$ variables from this partially reduced Lagrangian $\tilde{L}$ ?

A special case of the above question is:

If we have a Lagrangian $L=L(q^1,\ldots, q^N, \dot{q}^1,\ldots, \dot{q}^N,t)$, and if we eliminate some of the  $q^i$ variables from the Lagrangian [by using some of the LEOM and possibly boundary conditions], can we still derive the correct LEOM for the remaining $q^i$ variables from this partially reduced Lagrangian $\tilde{L}$ ?

Answer to the latter case: In many simple cases, this actually holds, but it is easy to give counterexamples.
Counterexample: Let $L=q^1 q^2$ be the product of two variables $q^1$ and $q^2$. The corresponding LEOM are $q^1=0$ and $q^2=0$. Let us now eliminate $q^2$ from the Lagrangian by using the LEOM $q^2=0$. Then the new partially reduced Lagrangian $\tilde{L}=q^1\cdot 0 =0$ vanishes, so that we can no longer deduce the LEOM for the remaining $q^1$ variable.
