According to principle of virtual displacements, if a system in equilibrium condition under the action of force is subjected to virtual displacement, then the sum of total virtual work done will be zero.
According to this principle, virtual displacement must be compatible with system constraints. In this virtual work, we consider all types of forces including inertia forces for dynamic problem.
In order to understand this principle briefly, we consider a mass spring system in horizontal direction where mass is displaced a virtual displacement δx.
So the work done due to each type of force is shown as following
Virtual work done by spring force = δWs = – (kx).δx
Virtual work done by inertia force = δWi = – (mẍ).δx
Total virtual work done equal to zero according to the statement mentioned above
– (kx).δx – (mẍ).δx = 0
kx + mẍ = 0