Generalized forces can be obtained from the computation of the
virtual work, , of the applied forces. The virtual work of the forces, , acting on the particles , is given by \delta W = \sum_{i=1}^n \mathbf F_i \cdot \delta \mathbf r_i where is the
virtual displacement of the particle .
Generalized coordinates Let the position vectors of each of the particles, , be a function of the generalized coordinates, . Then the virtual displacements are given by \delta \mathbf{r}_i = \sum_{j=1}^m \frac {\partial \mathbf {r}_i} {\partial q_j} \delta q_j,\quad i=1,\ldots, n, where is the virtual displacement of the generalized coordinate . The virtual work for the system of particles becomes \delta W = \mathbf F_1 \cdot \sum_{j=1}^m \frac {\partial \mathbf r_1} {\partial q_j} \delta q_j + \dots + \mathbf F_n \cdot \sum_{j=1}^m \frac {\partial \mathbf r_n} {\partial q_j} \delta q_j. Collect the coefficients of so that \delta W = \sum_{i=1}^n \mathbf F_i \cdot \frac {\partial \mathbf r_i} {\partial q_1} \delta q_1 + \dots + \sum_{i=1}^n \mathbf F_i \cdot \frac {\partial \mathbf r_i} {\partial q_m} \delta q_m.
Generalized forces The virtual work of a system of particles can be written in the form \delta W = Q_1\delta q_1 + \dots + Q_m\delta q_m, where Q_j = \sum_{i=1}^n \mathbf F_i \cdot \frac {\partial \mathbf r_i} {\partial q_j},\quad j=1,\ldots, m, are called the generalized forces associated with the generalized coordinates .
Velocity formulation In the application of the principle of virtual work it is often convenient to obtain virtual displacements from the velocities of the system. For the n particle system, let the velocity of each particle Pi be , then the virtual displacement can also be written in the form \delta \mathbf r_i = \sum_{j=1}^m \frac {\partial \mathbf V_i} {\partial \dot q_j} \delta q_j,\quad i=1,\ldots, n. This means that the generalized force, , can also be determined as Q_j = \sum_{i=1}^n \mathbf F_i \cdot \frac {\partial \mathbf V_i} {\partial \dot{q}_j}, \quad j=1,\ldots, m. ==D'Alembert's principle==