Solution for $-\frac{d^2u}{dx^2} + \frac{du}{dx} = 1$

In a book the author says the solution $u(x)$ for differential equation

$-\frac{d^2u}{dx^2} + \frac{du}{dx} = 1$

is the particular solution $u = x$ plus any $A + Be^{x}$. The $A$ and $B$ can be calculated from boundary conditions. I checked this and it works. I am confused however on how this solution is reached. Did he guess? Or did he find solutions for $\frac{du}{dx}$ and $-\frac{d^2u}{dx^2}$ seperately somehow add them up?

Any ideas?

-
See example 1 of section Solving First Order Linear Equations here: en.wikibooks.org/wiki/Ordinary_Differential_Equations/… – Did Aug 12 '11 at 16:17
Hi Didier, the solution from that example came out in the form of $y = constant + constant / e^{mx}$. The solution above is in the form of $y = x + Ax + Be^{x}$. What is the reason for this difference? – BB_ML Aug 12 '11 at 16:22
Function $du/dx$ vs function $y$. – Did Aug 12 '11 at 16:25

The simplest thing to do here is to treat this as a first order equation in $y=\frac{du}{dx}$ first, and solve it. Note that the equation becomes $$-y' + y = 1,$$ which is a first order linear separable equation. We can solve it the usual way: if $y=1$ is constant, then the equation is satisfied; this is a particular/stable solution. Assume then that $y$ is not the constant function $1$. Then: \begin{align*} -\frac{dy}{dx} + y &= 1\\ y-1 &= \frac{dy}{dx}\\ dx &= \frac{dy}{y-1} &&\text{(this is where we use that }y\neq 1\text{)}\\ \int \,dx &= \int \frac{dy}{y-1}\\ x +C &= \ln|y-1| &&C\text{ arbitrary;}\\ e^{x+C} &= |y-1|\\ Ae^x &= |y-1| &&A\text{ a positive constant;}\\ Be^x &= y-1 &&B\text{ a nonzero constant;}\\ y &= 1+Be^x &&B\text{ a nonzero constant.} \end{align*} So $y(x) = 1+Be^x$ where $B$ is a nonzero constant. Since $B=0$ gives the stable solution, we have that the general solution is $y(x) = 1+Be^x$ with $B$ an arbitrary constant.

But $y(x) = \frac{du}{dx}$, and what we are really interested in is $u(x)$. But now we have the very easy differential equation $$\frac{du}{dx} = 1 + Be^x,$$ which can be solved directly by integration. We get \begin{align*} \frac {du}{dx} &= 1 + Be^x\\ \int \frac{du(x)}{dx}\,dx &= \int(1+Be^x)\,dx\\ u(x) &= x + Be^x + C, \end{align*} where $B$ and $C$ are arbitrary.

If you don't realize you can use the trick of replacing $u'$ with $y$ and solving two first order equations instead of a single second order equation, you can still solve this very easily because this is a (nonhomogeneous) second order equation with constant coefficients.

First, we solve the associated homogeneous equation, $$-u'' + u' = 0.$$ The associated equation is $-r^2 + r = 0$; the roots are $0$ and $1$, so this says that $e^{0x}=1$ and $e^{x}$ generate the space of solutions to the homogeneous equation.

So the general solution will be given by $$\mathbf{s} + A + Be^x$$ where $A$ and $B$ are arbitrary constants, and $\mathbf{s}$ is any particular solution to the equation $-u''+u'=1$. It is easy to find that $u(x)=x$ is a solution to this equation, so the general solution to the differential equation is then given by $$u(x) = x + A + Be^x,$$ with $A$ and $B$ arbitrary constants. Same solution as above.

-
Hi Arturo. The points on that question I asked on dy/dx not being a ratio (and you answered) is through the roof! :) Thanks for this great answer too. – BB_ML Aug 12 '11 at 17:05