Consider the state of the circuit at some time \(t\text{.}\) Let \(\pm Q(t)\) be charges on the capacitor, whose formula we wish to determine. Let \(I(t)\) be the current in the circuit at this instant. The voltage drop across the capacitor, \(V_c\) will be given by the capacitor formula,
\begin{equation*}
V_c = \frac{Q}{C}.
\end{equation*}
Now, applying Kirchhoff’s loop rule in the loop \(a-b-c-a\text{,}\) we will get
\begin{equation*}
-V_c - R I + V = 0.
\end{equation*}
As current flows into the positive plate of the capacitor, charge \(Q\) on that plate increases. Therefore, we will have
\begin{equation*}
I = \frac{dQ}{dt}
\end{equation*}
From three equations above we obtain the following equation for rate of charge build-up.
\begin{equation}
\frac{dQ}{dt} + \frac{Q}{RC} = \frac{V}{R}.\tag{34.55}
\end{equation}
Suppose we started out with uncharged capacitor, then we seek solution of this equation with \(Q(0) = 0\text{.}\) By plugging the answer back into this equation, you can check that following function is the right solution of this equation.
\begin{equation}
Q(t) = CV \left[ 1- \exp{\left(-t/RC\right)} \right].\tag{34.56}
\end{equation}
How can we get this answer? Let us change variable in Eq.
(34.55) to
\begin{equation*}
f(t) = Q(t) - CV,
\end{equation*}
Then, we will get
\begin{equation*}
\frac{df}{dt} = \frac{dQ}{dt} - 0,,
\end{equation*}
which can be transformed using Eq.
(34.55) to
\begin{align*}
\frac{df}{dt} \amp = - \frac{Q}{RC} + \frac{V}{R}, \\
\amp = - \frac{f + CV}{RC} + \frac{V}{R},\\
\amp = - \frac{f}{RC}.
\end{align*}
That is \(f(t)\) obeys a simpler equation,
\begin{equation*}
\frac{df}{dt} = - \frac{1}{RC}\, f,
\end{equation*}
which is the equation we encountered in the discharging circuit. The solution of this equation is easy to write down.
\begin{equation*}
f(t) = f(0)\, \exp\left(- \frac{t}{RC} \right).
\end{equation*}
Therefore, \(Q(t)\) is
\begin{align*}
Q(t)\amp = f(t) + CV \\
\amp = f(0)\, \exp\left(- \frac{t}{RC} \right) + CV.
\end{align*}
Now, we use the condition that at \(t=0\text{,}\) we have \(Q=0\text{.}\) This will fix \(f(0)\text{.}\)
\begin{equation*}
0 = f(0)\times 1 + CV\Longrightarrow f(0) = - CV.
\end{equation*}
Therefore,
\begin{equation*}
Q(t) = -CV\, \exp\left(- \frac{t}{RC} \right) + CV.
\end{equation*}
It is instructive to gain insight from \(Q(t)\) into the current flow during charging. We can get current by taking derivative of \(Q(t)\text{.}\)
\begin{equation*}
I(t) = \frac{dQ}{dt} = \frac{V}{R}\, \exp\left(- \frac{t}{RC} \right).
\end{equation*}
It shows that maximum current, \(I_\text{max} = V/R\text{,}\) is at \(t=0\text{.}\) This corresponds to all voltage of the EMF dropping across the resistor and none around the capacitor. This makes sense since at this instant capacitor has no charge, and hence no voltage drop. As time passes, current dies out with time constant \(\tau = RC\text{.}\)