Significance of resemblance of Electrical energy with Potential energy of spring In a spring-mass system the total mechanical energy is represented as:
$TE= 1/2kx^2 + 1/2mv^2$
$k$ being the spring constant and $x$ being the displacement.
In L.C Oscillations we find the total electromagnetic energy to be:
$TE=1/2 Q^2/LC + 1/2 Li^2$
$L$ being the inductance of the inductor and $C$ is the Capacitance of the capacitor both in resonance which is why the L.C oscillations take place.
My book says that the electrical energy i.e $1/2 Q^2/LC$ "resembles" P.E of spring which is $1/2kx^2$. I understand that we come across numerous situations in physics that are represented by the same or similar mathematical equations. I was wondering if this has some physical implications/significance or is it just an analogy.
 A: You can expect this form universally for any small perturbation to a stable equilibrium. The reason is that any smooth energy minimum, regardless of its shape, looks like a parabola up close. This can be shown from a Taylor series expansion of the energy $U$ around the equilibrium point:
$$U(0+x)=U(0)+U^{\prime}(0)x+\frac{1}{2}U^{\prime\prime}(0)x^2+\cdots\approx \frac{1}{2}U^{\prime\prime}(0)x^2,$$
where the prime notation indicates derivatives, where $U(0)$ is taken as zero (an arbitrary reference point), where $U^\prime(0)=0$ because we're describing perturbations around a minimum, and where I've dropped all subsequent terms as negligible. Here, $U^{\prime\prime}(0)$ represents a single number: the curvature of the energy well at its minimum. Thus, $$U(x)\propto\frac{1}{2}x^2,$$ the form you were asking about.
In turn, this allows us to define all kinds of useful laws involving generalized restoring forces relying linearly—up to a point—on generalized displacements.
One example is $F=kx$ for springs, a customized version of Hooke's Law $\sigma=E\varepsilon$ in which the generalized force is the actual force $F$ and the generalized displacement is the actual displacement $x$. The strain energy is $dU=F\,dx$, which is integrated to obtain $U=\frac{1}{2}kx^2$.
(Equivalently, since energies are derivatives of forces, one could have worked backward from $U\propto\frac{1}{2}x^2$ as justified above to obtain $F=E^\prime\propto x$, the spring law.)
Another example is $V=IZ$, complex Ohm's Law, where the generalized force is the voltage and the generalized displacement is the current (rate of flow of charge $Q$). The impedance $Z$ in an LC circuit is related to $L$ and $C$, and ultimately we find that the total energy is $U=\frac{1}{2}CV^2+\frac{1}{2}LI^2$, which can be transformed into your expression using the relationships between time-dependent voltage and current at the resonant oscillation frequency $\omega_0=\frac{1}{\sqrt{LC}}$.
A: In my opinion, it is because the way we define $k$ i.e. the spring (or equivalent) constant or the force required to displace a unit length.
The force required is $F=kx$, where $x$ is displacement from equilibrium position. Now, energy spent or work done is $\text{d}W = F\text{d}x$. So total work done is $W=\int F\text{d}x = \int_0^x kx\text{d}x$. Therefore, $W=kx^2/2$. That Energy = Force * displacement (from equilibrium) is a universal and hence we find equivalent formula for other energy forms.
