In mechanics, virtual work arises in the application of the principle of least action to the study of forces and movement of a mechanical system. The work of a force acting on a particle as it moves along a displacement is different for different displacements. Among all the possible displacements that a particle may follow, called virtual displacements, one will minimize the action. This displacement is therefore the displacement followed by the particle according to the principle of least action. The work of a force on a particle along a virtual displacement is known as the virtual work. Historically, virtual work and the associated calculus of variations were formulated to analyze systems of rigid bodies, but they have also been developed for the study of the mechanics of deformable bodies.
History The principle of virtual work had always been used in some form since antiquity in the study of statics. It was used by the Greeks, medieval Arabs and Latins, and Renaissance Italians as "the law of lever". The idea of virtual work was invoked by many notable physicists of the 17th century, such as Galileo, Descartes, Torricelli, Wallis, and Huygens, in varying degrees of generality, when solving problems in statics. Working with Leibnizian concepts, Johann Bernoulli systematized the virtual work principle and made explicit the concept of infinitesimal displacement. He was able to solve problems for both rigid bodies as well as fluids. Bernoulli's version of virtual work law appeared in his letter to Pierre Varignon in 1715, which was later published in Varignon's second volume of Nouvelle mécanique ou Statique in 1725. This formulation of the principle is today known as the principle of virtual velocities and is commonly considered as the prototype of the contemporary virtual work principles. In 1743 D'Alembert published his Traité de Dynamique where he applied the principle of virtual work, based on Bernoulli's work, to solve various problems in dynamics. His idea was to convert a dynamical problem into static problem by introducing inertial force. In 1768, Lagrange presented the virtual work principle in a more efficient form by introducing generalized coordinates and presented it as an alternative principle of mechanics by which all problems of equilibrium could be solved. A systematic exposition of Lagrange's program of applying this approach to all of mechanics, both static and dynamic, essentially D'Alembert's principle, was given in his Mécanique Analytique of 1788. Although Lagrange had presented his version of least action principle prior to this work, he recognized the virtual work principle to be more fundamental mainly because it could be assumed alone as the foundation for all mechanics, unlike the modern understanding that least action does not account for non-conservative forces.
Overview If a force acts on a particle as it moves from point A to point B, then, for each possible trajectory that the particle may take, it is possible to compute the total work done by the force along the path. The principle of virtual work, which is the form of the principle of least action applied to these systems, states that the path actually followed by the particle is the one for which the difference between the work along this path and other nearby paths is zero (to the first order). The formal procedure for computing the difference of functions evaluated on nearby paths is a generalization of the derivative known from differential calculus, and is termed the calculus of variations. Consider a point particle that moves along a path which is described by a function 𝐫(t) from point A, where 𝐫(t)=t0, to point B, where 𝐫(t)=t1. It is possible that the particle moves from A to B along a nearby path described by 𝐫(t)+δ𝐫(t), where δ𝐫(t) is called the variation of 𝐫(t). The variation δ𝐫(t) satisfies the requirement δ𝐫(t0)=δ𝐫(t1)=0. The scalar components of the variation δr1(t), δr2(t) and δr3(t) are called virtual displacements. This can be generalized to an arbitrary mechanical system defined by the generalized coordinates qi, i=1,2,...,n. In which case, the variation of the trajectory qi(t) is defined by the virtual displacements δqi, i=1,2,...,n. Virtual work is the total work done by the applied forces and the inertial forces of a mechanical system as it moves through a set of virtual displacements. When considering forces applied to a body in static equilibrium, the principle of least action requires the virtual work of these forces to be zero.
Mathematical treatment Consider a particle P that moves from a point A to a point B along a trajectory r(t), while a force F(r(t)) is applied to it. The work done by the force F is given by the integral W=∫𝐫(t0)=A𝐫(t1)=B𝐅⋅d𝐫=∫t0t1𝐅⋅d𝐫dt dt=∫t0t1𝐅⋅𝐯 dt, where dr is the differential element along the curve that is the trajectory of P, and v is its velocity. It is important to notice that the value of the work W depends on the trajectory r(t). Now consider particle P that moves from point A to point B again, but this time it moves along the nearby trajectory that differs from r(t) by the variation δr(t) = εh(t), where ε is a scaling constant that can be made as small as desired and h(t) is an arbitrary function that satisfies h(t0) = h(t1) = 0. Suppose the force F(r(t) + εh(t)) is the same as F(r(t)). The work done by the force is given by the integral W¯=∫𝐫(t0)=A𝐫(t1)=B𝐅⋅d(𝐫+ε𝐡)=∫t0t1𝐅⋅d(𝐫(t)+ε𝐡(t))dt dt=∫t0t1𝐅⋅(𝐯+ε𝐡˙) dt. The variation of the work δW associated with this nearby path, known as the virtual work, can be computed to be δW=W¯−W=∫t0t1(𝐅⋅ε𝐡˙) dt. If there are no constraints on the motion of P, then 3 parameters are needed to completely describe P's position at any time t. If there are k (k ≤ 3) constraint forces, then n = (3 − k) parameters are needed. Hence, we can define n generalized coordinates qi (t) (i = 1,...,n), and express r(t) and δr = εh(t) in terms of the generalized coordinates. That is, 𝐫(t)=𝐫(q1,q2,…,qn;t), 𝐡(t)=𝐡(q1,q2,…,qn;t). Then, the derivative of the variation δr = εh(t) is given by ddtδ𝐫=ddtε𝐡=∑i=1n∂𝐡∂qiεq˙i, then we have δW=∫t0t1(∑i=1n𝐅⋅∂𝐡∂qiεq˙i)dt=∑i=1n(∫t0t1𝐅⋅∂𝐡∂qiεq˙i dt). The requirement that the virtual work be zero for an arbitrary variation δr(t) = εh(t) is equivalent to the set of requirements Qi=𝐅⋅∂𝐡∂qi=0,i=1,…,n. The terms Qi are called the generalized forces associated with the virtual displacement δr.
… excerpt ends here. Continue reading the full article.

