# Where do I go wrong solving this non-homogeneous 2nd order DE?

I'll just show you my work and you can tell me where I career off the road and burst into flames.

$y''+by'+cy=p(x)$

set $b=u+v$ and $c=uv$, and rewrite

$y''+(u+v)y'+(uv)y=p(x)$

$y''+ uy' + vy' + (uv)y=p(x)$

$(y'' + uy') + v(y' + uy) = p(x)$

$\frac{d}{dx}(y'+uy) + v(y' + uy) = p(x)$

set $z=y'+uy$, and rewrite

$\frac{dz}{dx} + vz = p(x)$

Solve this 1st-order DE for $z$

($e^{vx}z)' = e^{vx}p(x)$

$e^{vx}z = \int e^{vx}p(x) dx + C_0$

$z = e^{-vx}\int e^{vx}p(x) dx + C_0e^{-vx}$

Sub. this back into the 1st-order DE

$y'+uy = e^{-vx}\int e^{vx}p(x) dx + C_0e^{-vx}$

Solve this 1st-order DE for $y$:

$(e^{ux}y)' = e^{ux}e^{-vx}\int e^{vx}p(x) dx + C_0e^{-vx}e^{ux}$

$(e^{ux}y)' = e^{(u-v)x}\int e^{vx}p(x) dx + C_0e^{(u-v)x}$

$e^{ux}y = \int \left[ e^{(u-v)x}\int e^{vx}p(x) dx + C_0e^{(u-v)x} \right] dx$

$e^{ux}y = \int \left[ e^{(u-v)x}\int e^{vx}p(x) dx \right] dx + C_0\int e^{(u-v)x} dx$

$e^{ux}y = \int \left[ e^{(u-v)x}\int e^{vx}p(x) dx \right] dx + \frac{C_0}{u-v}e^{(u-v)x} + C_1$

$y = e^{-ux}\int \left[ e^{(u-v)x}\int e^{vx}p(x) dx \right] dx + e^{-ux}\frac{C_0}{u-v}e^{(u-v)x} + C_1e^{-ux}$

$y = e^{-ux}\int \left[ e^{(u-v)x}\int e^{vx}p(x) dx \right] dx + e^{-vx}\frac{C_0}{u-v} + C_1e^{-ux}$

Okay, two questions: is this correct and can I simplify any further?

-

Note that if you write $$y'' + by' + cy = p(x) = y'' -(u_0 + v_0)y' + u_0 v_0 y,$$ then $u_0$ and $v_0$ are the roots of $x^2 + bx + c = 0.$ To make things easier, your $u$ equals $-u_0$ and your $v$ equals $-v_0$. Then your expression in terms of $p(x)$, $u_0$ and $v_0$ reads $$y = e^{u_0 x}\int \left[ e^{(v_0-u_0)x}\int e^{-v_0 x}p(x) dx + C_0e^{(v_0 - u_0)x} \, \mathrm dx \right] \, \mathrm dx.$$ I'll leave it there so, when we get special cases like $u_0 = v_0$ we do not run into undefined terms.

Ultimate exercise: what happens when $$y'' + p(x)y' + q(x)y = r(x)?$$

-
Already been down this road before. :) math.stackexchange.com/a/102928/17976 – Mike Oct 14 '12 at 22:07
What I have thought is a generalization of what OP was doing. Nice question! – Ian Mateus Oct 14 '12 at 22:14
btw, Now I have to solve your ultimate exercise ;) – Korgan Rivera Oct 14 '12 at 22:21
@IanMateus It now makes sense to me to consider $u_o$ and $v_0$ as roots of a quadratic. – Korgan Rivera Oct 14 '12 at 22:34
@IanMateus btw, your 'ultimate exercise' is evil and should be killed with fire. – Korgan Rivera Oct 15 '12 at 5:26

Looks about right, except for the case where $u=v$. You might be able to clean it up a bit. For starters, $C_0$ has no real significance, so you can declare a new constant $C_2=\frac {C_0}{u-v}$. That really messy part is your particular solution.

Not sure if it will work, but maybe integration by parts can clean it up a bit.

$$r=\int e^{vx}p(x)dx,dr=e^{vx}p(x)dx$$

$$ds=e^{(u-v)x}dx,s=\frac{e^{(u-v)x}}{u-v}$$

$$y=\frac{e^{-ux}e^{(u-v)x}}{u-v}\int e^{vx}p(x)dx-\frac{e^{-ux}}{u-v}\int e^{(u-v)x}e^{vx}p(x)dx+C_2e^{-vx}+C_1e^{-ux}$$

$$y=\frac{e^{-vx}}{u-v}\int e^{vx}p(x)dx-\frac{e^{-ux}}{u-v}\int e^{ux}p(x)dx+C_1e^{-ux}+C_2e^{-vx}$$

Again, if $u=v$, that changes the homogenous solution slightly as

$$\int e^{(u-v)x}dx=\int dx=x$$

I'll leave it to someone else to explain whether or not this would work when $u$ and $v$ are complex as that's not my area of expertise.

-
It works for all cases. When $u$ and $v$ are complex you'll just have to use $e^{i\theta}=\cos\theta +i\cdot\sin\theta$ to get further simplifications. However, when $u=v$, you cannot integrate $\int e^{(u−v)t}\, \mathrm dt$ as as usual; you will find $C_0 t + C_1$ instead. – Ian Mateus Oct 14 '12 at 21:54
@IanMateus Already mentioned that case. $\int C_0e^{(u-v)x}dx=\int C_0e^{0x}dx=\int C_0dx=C_0x+C_1$. Which when multiplied by $e^{-ux}$ results in $C_0xe^{-ux}+C_1e^{-ux}$ which is indeed what happens with a double root. – Mike Oct 14 '12 at 21:56
@KorganRivera No, $e^{0x}=e^0=1$ – Mike Oct 14 '12 at 23:09
@Mike \facepalm. Why did I even say that. -_- – Korgan Rivera Oct 14 '12 at 23:12