The question is basically about when to apply the variational operator...
Given the general functional representing the strain energy of a solid under a given stress state $\sigma$ and strain state $\varepsilon$, both representing vectors.
$$U=\frac12\int_{V}\sigma^T\varepsilon dV$$
The stress is related to the strain with:
$$\sigma=C \varepsilon$$
where C is a symmetric matrix with constant terms (for linear elastic materials).
Suppose I want the variation of $U$ and the functions that I am varying are the strain field functions. Which one of the following two possibilities should I do:
1-)$$\delta U=\frac12\int_V \sigma^T\delta\varepsilon dV$$
2-)$$\delta U=\frac12 \left( \int_V \delta \varepsilon^T C \varepsilon dV + \int_V \varepsilon^T C \delta\varepsilon dV\right)=\int_V \varepsilon^T C \delta \varepsilon dV=\int_V \sigma^T \delta \varepsilon dV$$
Another case is when we approximate the displacement field by a set of approximation functions (finite element, for example). Then it comes that:
$$\varepsilon=Bc$$
Where $B$ is a matrix containing all the strain-displacement equations and the approximation functions (may be a function of $c$ for non-linear analysis). And $c$ is a vector containing all the amplitudes of each term in the approximation function (Ritz constants). The new energy functional becomes:
$$U=\frac12 \left( \int_V\sigma^T BdV \right) c$$
$c$ is the unkkown of the problem and the variational now should be applied to $c$, such that the following two options may be used:
1-)$$\delta U=\frac12 \left( \int_V\sigma^T BdV \right) \delta c +\frac12 \left( \int_V\sigma^T \delta BdV \right)c$$
2-)$$\delta U=\frac12 c^T \left( \int_V B^T C BdV \right) \delta c + \frac12 \delta c^T \left( \int_V B^T C BdV \right) c + \frac12 c^T \left( \int_V B^T C \delta BdV \right)c + \frac12 c^T \left( \int_V \delta B^T C BdV \right)c$$ $$=c^T \left( \int_V B^T C BdV \right) \delta c + c^T \left( \int_V B^T C \delta BdV \right)c$$ $$=\left( \int_V \sigma^T BdV \right) \delta c + \left( \int_V \sigma^T \delta BdV \right)c$$
In both cases the difference is the $\cfrac12$...
Which option (if any!) is the right one? This may be a basic question, but it remains not totally clear to me...