I have been reading "Classical mechanics" by Goldstein, Poole, and Safko. In particular, the section on "D'alembert's principle and lagrange's equations", in which the principle of virtual work is used to derive lagrange's equations for generalized coordinates. I am somewhat confused by the mathematics of this, in particular due to the use of displacements $\delta q_j$. I have tried to derive the result without using the concept of virtual work. I want to check whether this derivation is correct:
Setup
We have a configuration space $X=\mathbb R^n$, and a path $r:T\to X$ (where $T=[0,1]$ is the time dimension) that satisfies Newton's laws:
$$m_i\ddot r_i(t)=F_i^t(r(t),t)\quad\quad \forall t\in T$$
We also assume that the total force $F^t$ is separable in the applied force $F$ and constraint forces $f$, as follows: $F^t=F+f$, and that they are conservative, so that $F^t=F+f=-\nabla V^t=-\nabla V-\nabla V^f$, where $V:X\to \mathbb R$. I will not show, but just state that this implies that if we define the lagrangian $L^t(r,\dot r,t)=T(\dot r)-V^t(r,t)$ and $L(r,\dot r,t)=T(\dot r)-V(r,t)$ appropriately, then
$$\frac d {dt} L^t_{\dot r_i}(r(t),\dot r(t),t)=L^t_{r_i}(r(t),\dot r(t),t)\quad\quad \forall i,t.$$
Furthermore, we assume that in fact, the path $r$ is constrained to a subspace $S\subseteq X$, which happens as a result of the constraint forces (I don't explicitly state the constraints, just the subspace S that satisfies them). We can describe the path $r$ in different coordinates which map onto this subspace S: We have an alternative coordinate space $Q=\mathbb R^m$ for $m\leq n$ and a (time-varying) coordinate transformation $r:Q\times T\to S$, together with a path $q:T\to Q$ (to be interpreted as the same path in the new coordinates) such that:
$$r(t)=r(q(t),t)\quad \forall t\in T$$ From this we can easily derive $\dot r$ as a function of $q$ coordinates, by defining $\dot r_i(q,\dot q, t)=\sum_j\frac {\partial r_i(q,t)}{\partial q_j} \dot q_j+\frac {\partial R_i}{\partial t}$ (it can be easily shown that this works out).
Lagrangian in generalized coordinates $q$
I now define the "derived" lagrangian $L(q,\dot q, t)=L(r(q(t),t),\dot r(q(t),\dot q(t),t),t)$
We will now show that the Euler-Lagrange equations also hold in generalized coordinates $q$:
$$\frac d {dt} L_{\dot q_j}(q(t),\dot q(t),t)=L_{q_j}(q(t),\dot q(t),t)\quad\quad \forall j,t.$$
We simply expand both sides, and using the fact that $L^t=L+V^f$ and $\frac d {dt}L^t_{\dot r_i}=\frac d {dt}L_{\dot r_i}$), and show four equalities:
$$\begin{align}\frac d {dt} L_{\dot q_j}(q(t),\dot q(t),t)\quad\quad\quad\quad\quad\quad\quad= \frac d {dt}\left[\sum_i L_{\dot r_i} \frac {\partial \dot r_i}{\partial \dot q_j} \right]&= \sum_i \underset{=}{\underbrace{\left[\frac d {dt}L^t_{\dot r_i}\right]}} \underset{=}{\underbrace{\frac {\partial \dot r_i}{\partial \dot q_j}}} + L_{\dot r_i} \underset{=}{\underbrace{\left[\frac d {dt}\frac {\partial \dot r_i}{\partial \dot q_j} \right]}}\\ L_{q_j}(q(t),\dot q(t),t)=\sum_i {\left[L^t_{r_i}+\nabla V^f\right]} {\frac {\partial r_i}{\partial q_j}} +L_{\dot r_i} {\left[\frac {\partial \dot r_i}{\partial q_j} \right]} &=\sum_i \;\;\;\overbrace{\left[L^t_{r_i}\right]} \;\;\;\overbrace{\frac {\partial r_i}{\partial q_j}} +\; L_{\dot r_i} \;\; \overbrace{\left[\frac {\partial \dot r_i}{\partial q_j} \right]} \;\;-\;\;\overset {=\;0}{\overbrace{ \sum_i f_i\frac {\partial r_i}{\partial q_j}}} \end{align}$$
The three equalities follow from the following:
The first equality is simply the Euler-Lagrange equation for coordinates $r$.
The second equality follows from simply differentiating $\dot r(q,\dot q,t)$ w.r.t. $\dot q$.
The third equality follows from the second equality and simple differentiation.
The fourth equality is equivalent to the assumption of zero virtual work for the constraint forces, although I have not used the concept of virtual work in stating it.
Conclusion
It seems to me that I have derived the desired result without using the concept of virtual work, and in a way that is simpler than if we were to use it. Is this derivation correct? Am I missing something?