Introduction to finite elements/Axial bar weak form
Axially loaded bar: Weak Form 
Instead of deriving the differential equation using a balance of forces on a differential element, we may arrive at the same problem description via a different route - the principle of virtual work (also called the variational approach).
If we imagine there were forces (virtual forces) inside and outside of the bar, then the virtual work generated by these 'virtual forces' should conserve energy. For the bar, this principle can be stated as
where is the virtual work of the internal forces, is the virtual work of the external forces, and is the virtual work of the body forces.
The virtual internal work is given by
The virtual work done by the external forces is given by
The virtual work done by the body forces is given by
The principle of virtual work for the bar can then be expressed as
Now, the stress and the virtual strain expressed in terms of the displacements are
Therefore, we have
Note that the virtual displacement is zero at points on the boundary where displacements are prescribed.
The above equation is called the variational form or weak form of the problem.
Why is it called a variational form? 
Let us start with the weak form. Using the formula for the first variation (from variational calculus)
Therefore, the weak form can be written as
This is equivalent to the following variational statement of the problem
where means variation in and is an arbitrary variation on subject to the condition that .
Equivalence of the strong and weak forms 
The strong and weak statements of the problem are equivalent. Since finite elements uses the weak form of the problem statement, we can either derive the weak form from the strong form or using the principle of virtual work. The preferred approach is chosen on the basis of convenience.
We can derive the weak form from the strong form as follows. We multiply the strong form with an arbitrary virtual displacement (or weighting function) and integrate over the length of the bar. Thus
Next, we integrate the first term of the equation by parts (to get rid of the higher order derivatives of ) and get
Recall that and . Therefore, we have
This is the same as the weak form derived from the principle of virtual work.