The formula for elastic potential energy, U = 1/2 k x^2, arises from the Taylor expansion of the potential energy function around the equilibrium position. The factor of 1/2 comes from calculating the work done by a variable force, specifically integrating the force over the distance. In this context, the average force is used, which leads to the inclusion of the 1/2 in the equation. The derivation assumes small displacements, allowing the approximation to hold true. Understanding this derivation clarifies the role of the 1/2 factor in the formula for elastic potential energy.