An electric circuit which contains a capacitor and an inductor connected in series is called LC series circuit. The RL series circuit described current as a function of time.
A LC circuit behaves quiet differently, that is we find something interesting called oscillating current. To dive into it we consider a LC circuit as shown in Figure 1 below. There are two switches, first we charge the capacitor by closing the switch \(S_1\) and opening the switch \(S_2\). Once the capacitor is fully charged, we open the switch \(S_1\) and close switch \(S_2\). In short, we connect an already charged capacitor in series with an inductor. In our discussions, we consider the resistance is zero in our circuit.
Since we have inductor present which opposes the change in current, the current in the circuit can not instantly change, instead it increases gradually. It means the capacitor discharges, and at each instant, the voltage across capacitor is equal to the voltage across inductor. The voltage continuously decreases as the current increases. When the current becomes maximum, the voltage across the capacitor drops to zero.
You may ask why the current increases if the voltage is decreasing? Note that we have capacitor in place in our circuit and you know if \(q\), \(v\) are the charge and voltage at an instant with capacitance \(C\), then \(q = Cv\) which implies \(dq/dt = i = Cdv/dt\). You can see that the current is proportional to the rate of change of voltage not to the voltage at a particular instant. You'll see later that charge, voltage and current all change sinusoidally.
We know in RC circuit that when a capacitor discharges, the current, charge and voltage all decrease exponentially to zero. But the situation is quiet different in LC circuit, because of the presence of an inductor, the current can not decrease from maximum value to zero (as the inductor does not let the current change abruptly) instead it starts from zero and continuously builds up and becomes maximum.
Now all the energy that's stored in the electric field of capacitor is transferred to the magnetic field of the inductor. Don't you think that it seems like the potential energy (energy stored in electric field of capacitor) is converted to kinetic energy (energy stored in magnetic field of inductor). It'll will be clear when we use the analogy of simple harmonic motion of mass-spring system. You'll soon find that whatever we are discussing right now is analogous to the simple harmonic motion.
As the energy is now transferred to the inductor, the current starts to decrease, the sense of inductor opposes the decrease in current. But the polarity of the capacitor shown in Figure 1 above is now changed being left hand plate positively charged and right hand plate negatively charged. So far electric field energy of the capacitor was transferred to the magnetic field of inductor and now the magnetic field energy of the inductor is again transferred to the electric field of the capacitor.
This whole process continuous forever and what we find is something called oscillating current, that is the current oscillates back and forth and each time, the polarity of the capacitor changes. You'll soon see that the charge on the capacitor as a function of time is sinusoidal. Let's first apply Kirchhoff's law in the lower loop in Figure 1.
\[\frac{q}{C} + L \frac{di}{dt} = 0 \tag{1} \label{1}\]
Note that the current is the rate of change of charge, that is \(i = dq/dt\). When the capacitor discharges, \(dq/dt < 0\) (negative), that is the direction of current is opposite to the positive direction of current, so we take this current direction to be consistent with the change in capacitor charge.
You can rewrite the Equation \eqref{1} as
\[\frac{d^2q}{dt^2} + \frac{1}{LC}q = 0 \tag{2}\label{2}\]
This equation is similar to the equation of simple harmonic motion we derived for the mass-spring system, that is
\[\frac{d^2x}{dt^2} + \frac{k}{m}x = 0 \tag{3} \label{3}\]
The oscillation of current in LC circuit is analogous to the oscillation of mass in spring-mass system. If you compare Equations \eqref{2} and \eqref{3}, you'll notice that the charge \(q\) is analogous to the elongation \(x\), the inductance \(L\) is analogous to the mass, and the reciprocal of capacitance is analogous to the force constant \(k\). The elongation \(x\), we derived in simple harmonic motion was
\[x = A\cos(\omega\,t + \theta) \tag{4} \label{4}\]
Using the analogy of simple harmonic motion, the charge \(q\) is sinusoidal, that is
\[q = Q_0\cos(\omega\,t + \theta) \tag{5} \label{5}\]
where \(Q_0\) is the maximum charge on the capacitor analogous to the amplitude \(A\). And the angular frequency of the electrical oscillation is
\[\omega = \sqrt{\frac{1}{LC}} \tag{6} \label{6}\]
You can easily find the expression of the alternative frequency \(f = \omega/2\pi\) from the above equation. You know the charge on the capacitor at any time by the relationship \(q = Cv_C\), and the maximum charge is \(Q_0 = CV_0\) where \(V_0\) is the maximum voltage. Therefore, the voltage across the capacitor at any time is
\[v_C = V_0\cos(\omega\,t + \theta) \tag{7} \label{7}\]
As you can see that the voltage across the capacitor changes sinusoidally. The current \(i\) is the rate of change of charge which is also sinusoidal:
\[i = -\omega\,Q_0\sin(\omega\,t + \theta) \tag{8} \label{8}\]
As the capacitor discharges, the magnitude of current first increases and becomes maximum, and then decreases, and it again increases. When \(i = 0\) at \(t = 0\), Equation \eqref{8} gives \(\theta = 0\), and Equation \eqref{5} gives \(q = Q_0\) which is as it should be. If \(q = 0\) at \(t = 0\), Equation \eqref{5} gives \(\theta = \pm\,\pi/2\).
When the charge is zero, the voltage is zero and the current is maximum, and that happens when \(\theta = \pm \pi/2\), and Equation \eqref{8} gives \(i_\text{max} = I_0 = \omega\,Q_0\), so you can rewrite Equation \eqref{8} as
\[i = -I_0\sin(\omega\,t + \theta) \tag{9} \label{9}\]
We know that the voltage across the inductor is \(L\,di/dt\), therefore, the voltage across the inductor at any time is (solving it by putting the value of \(\omega\) form Equation \eqref{6})
\[v_L = -V_0\cos(\omega\,t + \theta) \tag{10} \label{10}\]
The voltage of capacitor is always equal in magnitude to the voltage of inductor at each instant. The negative sign is because the inductor opposes the change in current (by Lenz's law). The curves of charge as a function of time and current as a function of time are shown in Figure 2 below starting at \(\theta = 0\) and \(t = 0\). The curves of both voltages as a function of time are also shown in the figure below. You can understand what's going on by examining those curves.
You can see that the charge lags the current by \(\pi/2 \,\text{rad}\). And the current is out of phase with both voltages by \(\pi/2 \,\text{rad}\), that is current leads the voltage across capacitor by \(\pi/2 \,\text{rad}\) and lags the voltage across inductor by \(\pi/2 \,\text{rad}\). The voltage across capacitor lags the voltage across inductor by \(\pi \,\text{rad}\).
The simple harmonic motion in mass-spring system was conservative, where the sum of kinetic and potential energy at each point on the path of motion was the total energy. In electrical oscillation like this one, the potential energy is analogous to the energy stored in the capacitor (in electric field) and the kinetic energy is analogous to the energy stored in the inductor (in magnetic field). The electrical oscillation is also conservative.
The total energy is equal to the energy stored in the capacitor before its connected to the circuit, that is \({Q_0}^2/2C\). When the capacitor charges or discharges, the potential energy at any time \(t\) is \(q^2/2C\) and the kinetic energy is \(1/2(Li^2)\). Therefore,
\[\frac{{Q_0}^2}{2C} = \frac{q^2}{2C} + \frac{1}{2}Li^2 \tag{11} \label{11}\]
As an alternative way, you can also get Equation \eqref{2} from Equation \eqref{11}. You can try this on your own. If you solve the above equation for \(i\), you'll get
\[i = \pm\,\sqrt{\frac{1}{LC}}\sqrt{{Q_0}^2 - q^2} \tag{12} \label{12}\]
If you substitute \(q\) from Equation \eqref{5} in the above equation, you'll get Equation \eqref{8} or \eqref{9}. Let's examine how the energy of LC system changes by substituting the value of \(q\) and \(i\) from Equations \eqref{5} and \eqref{9} into Equation \eqref{11}, you'll get the total energy \(U = {Q_0}^2/2C\) if \(\theta = 0\) is
\[U = U_E + U_B = \frac{Q_0^2}{2C}\cos^2(\omega\,t) + \frac{1}{2}LI_0^2\sin^2(\omega\,t) \]
You can see from the above equation that when the energy in electric field is maximum (potential energy), the energy in magnetic field (kinetic energy) is zero and vice versa. And the total energy is the sum of both energies and it remains constant. The oscillations of both energies are shown in the curves below.
Since the total energy of capacitor is transferred to the inductor and back to the capacitor again, that is the total energy that we had before in the capacitor before connecting to the circuit, oscillates and therefore, the amplitudes of both curves must be equal to each other, that is \(Q_0^2/2C = LI_0^2/2\). Here we have considered the resistance is zero and the total energy remains the same but that is not the case in real life situations. In real life, the resistance exists, and the energy is also transformed as the radiation, and the oscillations do not remain forever.