# derive the solution for non-homogenous differential equations directly

Say we have a differential equation $\frac{dx}{dt}= -ax+b$

We can find the solution by solving $\frac{dx}{dt}= -ax$:

$$x_r=Ae^{-at}$$ And then adding a "particular solution" for $\frac{dx}{dt}=0$, which results in $x_p=\frac{b}{a}$ then we simply add these solutions, and solve for $A$:

$$x=(x_0-\frac{b}{a})e^{-at}+\frac{b}{a}$$

We can easily verify afterwards that this solves the differential equation by taking the derivative now, and seeing that it satisfies it.

My question, however: Is there a method to actually derive this solution, without having to guess beforehand that we can simply add those two solutions separately?

Or at the very least, is there a more general method from which this particular approach follows?

• So there is a general method of using the Laplace transform to solve linear ODEs. See for example en.wikipedia.org/wiki/…. – shrinklemma Apr 13 '17 at 11:35

If by directly you mean a method that doesn't involve splitting into the homogeneous and non-homogeneous part (and then adding a particular solution to the homogeneous solution), you can solve it by separation of variables: $$x'(t) = -ax+b \longrightarrow \int \frac{1}{-ax+b}\,\mbox{d} x = t$$ Then: $$-\frac{1}{a}\ln\left( -ax+b \right)+c = t \implies x = \frac{b}{a}+Ce^{-at}$$

There's the "annihilator method." Take the derivative of both sides to get

$$x'' = -ax'$$

which is 2nd-order homogeneous and then solve in the usual way. The characteristic equation is $r^2+ar = 0$ with roots $r=-a$ and $r=0$, giving the two solutions $x=e^{-at}$ and $x=e^{0}$. The general solution is

$$x=c_1e^{-at}+c_2.$$

Note that $x(0) = c_1+c_2$ and $x'(0) = -ac_1$. Plug these into the original DE to get $-ac_1 = -a(c_1+c_2)+b$ which gives $c_2 = b/a$.

Considering $$x'= -ax+b$$ let$$-ax+b=y\implies x=\frac{b-y}a\implies x'=-\frac{y'}a$$ Replace to get $$-\frac{y'}a=y\implies y'=-ay$$