How do you solve this non-homogenous differential equation? $$\frac{dv}{dt} = mg - kv^2$$
Edit:
I tried to solve it by finding the particular solution: $$v=A \implies \frac{dv}{dt}=0;$$ \begin{align} \frac{dv}{dt} + kv^2 = mg &\implies 0 + kA^2 = mg \\ &\implies A = \sqrt{\frac{mg}{k}}. \end{align}
Then getting the general solution for its homogenous counterpart by separating variables:
\begin{align} \frac{dv}{dt} + kv^2 = 0 &\implies -\frac{dv}{kv^2} = dt \\ &\implies \frac{1}{kv} = t + C \\ &\implies v = \frac{1}{kt+C}. \end{align}
The solution I got the particular solution plus the general solution:
$$v = \sqrt{\frac{mg}{k}} + \frac{1}{kt + C}.$$
I shall present my answer using separation of variables. I will skip on some of the computations and present the concept directly.
$$ \begin{align} \frac{dv}{dt} & =mg-kv^2\\ \frac{dv}{dt} & = -k\Big(v^2-\frac{mg}{k}\Big)\\ \frac{1}{v^2-\frac{mg}{k}}dv & = -k dt\\ \int\frac{1}{v^2- \big( \sqrt \frac{mg}{k} \big)^2}dv & = \int -k dt\\ \end{align} $$ For simplicity we can set $\alpha= \sqrt {mg/k}$. We can apply partial fraction decomposition on the LHS of the equation. $$ \begin{align} \frac{1}{v^2- \alpha^2} & = \frac{A}{v- \alpha} + \frac{B}{v + \alpha} \\ \\ \end{align} $$ You can solve the coefficients on your own.
Solving the equation, you will arrive the answer in the form: $$ v(t) = \frac{\alpha(1+Ce^{-2 \alpha kt})}{1-Ce^{-2 \alpha kt}}$$ for $C$ is a constant.
Now we check the system at steady-state. As we take $t \to \infty$, $$ \begin{align} \lim_{t \to \infty}v(t) & = \lim_{t \to \infty} \frac{\alpha(1+Ce^{-2 \alpha kt})}{1-Ce^{-2 \alpha kt}} \\ & = \alpha \\ & = \sqrt \frac{mg}{k} \\ \end{align} $$ which is your terminal velocity.
Hope it helps.