# How to set up this differential equation

I need some help with the following problem, assigned in a calc 2 course:

$\frac{dy}{dt} = ky +f(t)$ is a population model where $y$ is the population at time $t$ and $f(t)$ is some function that describes the net effect on the population. Assume $k=.02$ and $y=10,000$ when $t=0$. Solve the differential equation of $y$ when $f(t)=-6t$.

My instinct is to treat the given values for $k$ and $y$ as I would the conditions in an initial value problem, leaving $k$ as a variable and treating this as a separable differential equation:

$\frac{dy}{dt} = ky-6t$

$\frac{dy}{dt} \frac{1}{ky}= -6t$

$\frac{1}{ky} dy = -6t dt$

$\int \frac{1}{ky} dy = \int -6t dt$

$\frac{ln|y|}{k} = -3t^2 + C$

$ln|y| = -3t^2k + CK$

$y = e^{-3t^2k + CK} = CKe^{-3t^2k}$

At this point, I'd plug in the given values for $k$ and $y$ and treat it as an initial value problem to calculate C. My question is about how to do that: I've tried a few ways, and am still trying others, but I don't see how my current trajectory is going to lead me to the answer given, which is: $300t+15000-5000e^{.02t}$.

Am I on the right track with how I'm setting up and solving the differential equation here? If so, how should I go about arriving at my final answer? If not, where am I going wrong?

• If you believe you have a function $y(t)$ that satisfies the differential equation then you can check by seeing if $y'(t) = ky(t)-6t$. If you think you have a general solution then you verify whether or not it is by seeing if you can satisfy any initial value problem. – R R May 15 '14 at 1:50

Hint: You need to use an integrating factor since it is not a homogeneous equation. Think of how you can write the left side of the following equation as a form of the product rule: $$e^{-kt}\left(\frac{\text{d}y}{\text{d}t}-ky\right)=e^{-kt}f(t) \,,$$ which is equivalent to the original differential equation for which you were asked to find a solution. Once you do this, the rest of the procedure to follow will become clear (follows very similar process to solving a separable differential equation, like what you attempted). Note that $e^{\int -k \,\text{d}t}=Ce^{-kt}$ for a constant $C$, which you can use as motivation for the above.
For completeness and the benefit of future users, I will add the rest of the solution. The equation above can be rewritten as $$\frac{\text{d}}{\text{d}t}\left(ye^{-kt}\right) = e^{-kt}f(t) \,\,.$$ Now, integrating both sides with respect to $t$, we obtain \begin{align} ye^{-kt} &= \int e^{-kt}f(t)\text{d}t \\ &= -6\int te^{-kt}\text{d}t \\ &= 6\frac{kt+1}{k^2}e^{-kt} + c_0\end{align} \,\, for a constant $c_0$. The third equality comes from an application of integration by parts. Finally, dividing both sides by $e^{-kt} > 0$ gives a general solution for $y(t)$. Then substitute your initial value to find a particular solution.
The solution to $y'+p(t) y = f(t)$ is $y(t) = e^{- \int p(t) dt} (\int e^{\int p(t) dt} f(t) dt +C)$.
In this case, $p(t) = -k$, $f(t) = -6t$. Plug into the formula for the general solution, then substitute $y(0) = 10000$ to find $C$ (giving the particular solution).