Ball Thrown Upwards Subject to Air Resistance Proportional to Speed

Suppose the air resistance on a particle of mass  
\[m\]
  is proportional to the velocity, so that  
\[R=kv\]
/ A particle thrown up will then be subject to two forces slowing the particle - the force of gravity and air resistance. Obviously when  
\[t=0, \; y=0\]
. Suppose the particle is thrown up with initial speed  
\[v_0=\frac{dy}{dt}\|_{t=0}\]
. Applying  
\[F=ma\]
  to the particle while it is moving upwards gives
\[ma =-mg-kv\]

Using  
\[v= \frac{dy}{dt}, \; a= \frac{d^2 y}{dt^2}\]
  this equation becomes  
\[m \frac{d^2 y}{dt^2} = -mg - k \frac{dy}{dt} \rightarrow \frac{d^2 y}{dt^2} +\frac{k}{m}\frac{dy}{dt}=-g\]
.
We can write this last equation as  
\[\frac{d}{dt} (\frac{dy}{dt}+\frac{k}{m}y)=-g\]
.
Integrating gives  
\[[ \frac{dy}{dt}+\frac{k}{m}y \ ] = [ -gt \ ]^t_0\]

\[\frac{dy}{dt}-v_0 + \frac{k}{m}y =-gt\]
.
Write this as  
\[\frac{dy}{dt}+ \frac{k}{m}y =v_0-gt\]
.
Use the integrating factor method with integrating factor  
\[e^{\frac{k}{m}t}\]
.
The equation becomes  
\[e^{\frac{k}{m}t} \frac{dy}{dt}+e^{\frac{k}{m}t} \frac{k}{m}y =-e^{\frac{k}{m}t}gt\]
.
\[\frac{d}{dt}(e^{\frac{k}{m}t}y) =-e^{\frac{k}{m}}gt\]
.
Integrate again.
\[[ e^{\frac{k}{m}t}y \ ]^y_0 = \int^t_0 e^{\frac{k}{m} t}(v_0-gt)dt\]
.
Integrate the right hand side by parts to give
\[e^{\frac{k}{m}t}y = \int^t_0 e^{\frac{k}{m} t}(v_0-gt)dt=\frac{k}{m}((v_o-gt)e^{\frac{k}{m}t}-1)+ \frac{k^2g}{m^2}(e^{\frac{k}{m}t}-1)\]
.
Hence  
\[y=\frac{k}{m}((v_o-gt)- e^{-\frac{k}{m}t})+ \frac{k^2g}{m^2}(1- e^{- \frac{k}{m}t})\]