Integrate an equation: $\frac{dx}{dt} = -kx+bt$ I need help integrating the following equation: $\frac{dx}{dt} = -kx+bt$. I know what to do if it were just $\frac{dx}{dt} = -kx$, but do not know how to account for the $bt$. 
 A: This is an example of an ODE which can be solved using an integrating factor to force the ODE into an exact form. We have
$$x'(t)+kx(t)=bt$$
$$e^{kt}x'(t)+ke^{kt}x(t)=bte^{kt}$$
$$(e^{kt}x(t))'=bte^{kt}$$
$$e^{kt}x(t)=\int bte^{kt}\mathrm{dt}$$
$$x(t)=\frac{b}kt-\frac{b}{k^2}+Ce^{-kt}$$
A: $$\frac{dx}{dt} = -kx+bt$$
$$x' +kx=bt$$
Use method of integrating factor $\mu(t)=e^{kt}$
$$( xe^{kt})'=bte^{kt}$$
Integrate  $(k \ne 0)$:
$$ xe^{kt}= b\int te^{kt}dt$$
$$ xe^{kt}= b \left(\frac  t ke^{kt}-\frac 1 {k^2}e^{kt} \right)+C$$
$$ x(t)= b \left(\frac  t k-\frac 1 {k^2} \right)+Ce^{-kt}$$
For $k=0$ we have :
$$x'=bt$$
Integrate :
$$x=\frac b2 t^2+C$$

Or since you know how to solve the homogeneous part you can use the method of variation of constants for the $bt$ term. Suppose $x_p(t)=at+c$ Plug $x_p(t)$ in the original equation and find the constants $ a,c$. Then the solution is $x(t)=x_h(t)+x_p(t)$
The homogeneous equation is:
$$x'(t)+kx=0$$
$bt$ is the inhomogeneous part.
So we have:
$$x' +kx=bt$$
$$x_p' +kx_p=bt$$
$$(at+c)' +k(at+c)=bt$$
Can you take it from here ?
A: Using the variation of parameters instead of the integrating factor
$$\frac{dx}{dt} = -kx \implies  x= C e^{-k t}$$
$$\frac{dx}{dt} = -kx+bt\implies C' e^{-k t}=b t\implies C'=b te^{-k t}$$ One integration by parts leads to the result.
