Let an electric dipole be rotated in electric field from angle θ0 and θ1 in the direction of electric field. In this process the angle of orientation θ is changing continuously; hence the torque also changes continuously. Let at any time, the angle between dipole moment →p and electric field →E be θ then
Torque on dipole τ=pEsinθ
The work done in rotating the dipole a further by small angle dθ is
dW=Torque×angular displacement=pEsinθdθ
Total work done in rotating the dipole from angle θ0 to θ1 is given by
W=∫θ1θ0pEsinθdθ=pE[−cosθ]θ1θ0
=−pE[cosθ1−θ0]=pE(cosθ0−cosθ1)....(i)
Special case : If electric dipole is initially in a stable equilibrium position (θ0=0∘) and rotated through an angle θ(θ1=θ) then work done
W=pE[cos0∘−cosθ]=pE(1−cosθ)....(ii).