# on inhomogeneous second-order linear ODE with constant coefficients

Let’s consider solving the ordinary second-order linear differential equation

 $\displaystyle\frac{d^{2}y}{dx^{2}}+a\frac{dy}{dx}+by\;=\;R(x)$ (1)

which is inhomogeneous (http://planetmath.org/HomogeneousLinearDifferentialEquation), i.e. $R(x)\not\equiv 0$.

For obtaining the general solution of (1) we have to add to the general solution of the corresponding homogeneous equation (http://planetmath.org/SecondOrderLinearODEWithConstantCoefficients)

 $\displaystyle\frac{d^{2}y}{dx^{2}}+a\frac{dy}{dx}+by\;=\;0$ (2)

some particular solution (http://planetmath.org/SolutionsOfOrdinaryDifferentialEquation) of the inhomogeneous equation (1).  A latter one can always be gotten by means of the variation of parameters  , but in many cases there exist simpler ways to find a particular solution of (1).

$1^{\circ}$:  $R(x)$ is a nonzero constant function $x\mapsto c$.  In this case, apparently  $y=\frac{c}{b}$ is a solution of (1), supposing that  $b\neq 0$.  If  $b=0$  but $a\neq 0$,  a particular solution is $y=\frac{c}{a}x$.  If  $a=b=0$,  a solution is gotten via two consecutive integrations.

$2^{\circ}$:  $R(x)$ is a polynomial function of degree $n\geq 1$.  Now (1) has as solution a polynomial  which can be found by using indetermined coefficients.  If  $b\neq 0$,  the polynomial is of degree $n$ and is uniquely determined.  If  $b=0$  and  $a\neq 0$,  the degree of the polynomial is $n\!+\!1$ and its constant term is arbitrary. If  $a=b=0$  the polynomial is of degree $n\!+\!2$ and is gotten via two integrations.

$3^{\circ}$:  Let $R(x)$ in (1) be of the form $\alpha\sin{nx}+\beta\cos{nx}$ with $\alpha$, $\beta$, $n$ constants.  We try to find a solution of the same form and put into (1) the expression

 $\displaystyle y\;:=\;A\sin{nx}+B\cos{nx}.$ (3)

Then the left hand side of (1) attains the form

 $[(b-n^{2})A-anB]\sin{nx}+[anA+(b-n^{2})B]\cos{nx}.$

This must equal $R(x)$, i.e. we have the conditions

 $(b-n^{2})A-anB\;=\;\alpha\quad\mbox{and}\quad anA+(b-n^{2})B\;=\;\beta.$

These determine uniquely the values of $A$ and $B$ provided that the determinant  $\left|\begin{matrix}b\!-\!n^{2}&-an\\ an&b\!-\!n^{2}\end{matrix}\right|\;=\;a^{2}n^{2}\!+\!(b\!-\!n^{2})^{2}$

does not vanish.  Then we obtain the particular solution (3).  The determinant vanishes only if  $a=0$ and  $b=n^{2}$, in which case the differential equation (1) reads

 $\displaystyle\frac{d^{2}y}{dx^{2}}+n^{2}y\;=\;\alpha\sin{nx}+\beta\cos{nx}.$ (4)

Unless we have  $\alpha=\beta=0$, the equation (4) has no solution of the form (3), since

 $\displaystyle\frac{d^{2}}{dx^{2}}(A\sin{nx}+B\cos{nx})+n^{2}(A\sin{nx}+B\cos{% nx})\;=\;0$ (5)

identically.  But we find easily a solution of (4) when we differentiate the identity (5) with respect to $n$.  Changing the order of differentiations we get

 $\frac{d^{2}}{dx^{2}}(Ax\cos{nx}-Bx\sin{nx})+n^{2}(Ax\cos{nx}-Bx\sin{nx})\;=\;-% 2nA\sin{nx}-2nB\cos{nx}.$

The right hand side coincides with the right hand side of (4) iff  $-2nA=\alpha$  and  $-2nB=\beta$, and thus (4) has the solution

 $y\;:=\;-\frac{\alpha}{2n}x\cos{nx}+\frac{\beta}{2n}x\sin{nx}.$

$4^{\circ}$:  Let $R(x)$ in (1) now be $\alpha e^{kx}$ where $\alpha$ and $k$ are constants.  Denote the left hand side of (1) briefly $\frac{d^{2}y}{dx^{2}}+a\frac{dy}{dx}+by\;=:\;F(y)$.  We seek again a solution of the same form $Ae^{kx}$ as $R(x)$.

First we have

 $F(Ae^{kx})\;=\;A\underbrace{(k^{2}\!+\!ak\!+\!b)}_{f(k)}e^{kx}\;=\;Af(k)e^{kx}.$

Thus $A$ can be determined from the condition  $Af(k)=\alpha$.  If  $f(k)\neq 0$,  i.e. $k$ is not a root of the characteristic equation    $f(r)=0$  corresponding the homogeneous equation (2), then we obtain the particular solution

 $y\;:=\;\frac{\alpha}{f(k)}e^{kx}\;=\;\frac{\alpha}{k^{2}\!+\!ak\!+\!b}e^{kx}$

of the inhomogeneous equation (1).

If  $f(k)=0$, then $e^{kx}$ and $Ae^{kx}$ satisfy the homogeneous equation  $F(y)=0$.  Now we may start from the identity

 $F(Ae^{rx})\;=\;Af(r)e^{rx}$

and differentiate it with respect to $r$.  Changing again the order of differentiations we can write first

 $\displaystyle F(Axe^{rx})\;=\;Ae^{rx}[f^{\prime}(r)\!+\!xf(r)],$ (6)

and differentiating anew,

 $\displaystyle F(Ax^{2}e^{rx})\;=\;Ae^{rx}[f^{\prime\prime}(r)\!+\!2xf^{\prime}% (r)\!+\!x^{2}f(r)].$ (7)

If $k$ is a simple root of the equation  $f(r)=0$,  i.e. if  $f(k)=0$  but  $f^{\prime}(k)\neq 0$,  then  $r:=k$  makes the right hand side of (6) to $Af^{\prime}(k)e^{kx}$, which equals to  $R(x)=\alpha e^{kx}$  by choosing  $A:=\frac{\alpha}{f^{\prime}(k)}$.  Then we have found the particular solution

 $y\;:=\;\frac{\alpha}{f^{\prime}(k)}xe^{kx}\;=\;\frac{\alpha}{2k\!+\!a}xe^{kx}.$

We have still to handle the case when $k$ is the double root of the equation  $f(k)=0$  and thus  $f^{\prime}(k)=0$.  Putting  $r:=k$  into (7), the right hand side reduces to  $Af^{\prime\prime}(k)e^{kx}=2Ae^{kx}$; this equals to $R(x)=\alpha e^{kx}$  when choosing $A:=\frac{\alpha}{2}$.  So we have the particular solution

 $y\;:=\;\frac{\alpha}{2}x^{2}e^{kx}$

of the given inhomogeneous equation.

$5^{\circ}$:  Suppose that in (1) the right hand side $R(x)$ is a sum of several functions,

 $\displaystyle\frac{d^{2}y}{dx^{2}}+a\frac{dy}{dx}+by\;=\;R_{1}(x)+R_{2}(x)+% \ldots+R_{n}(x),$ (8)

and one can find a particular solution $y_{i}(x)$ for each of the equations

 $\frac{d^{2}y}{dx^{2}}+a\frac{dy}{dx}+by\;=\;R_{i}(x).$

Then evidently the sum $y_{1}(x)+y_{2}(x)+\ldots+y_{n}(x)$ is a particular solution of the equation (8).

## References

• 1 Ernst Lindelöf: Differentiali- ja integralilasku ja sen sovellutukset III.1.  Mercatorin Kirjapaino Osakeyhtiö, Helsinki (1935).

Title on inhomogeneous second-order linear ODE with constant coefficients OnInhomogeneousSecondorderLinearODEWithConstantCoefficients 2014-03-05 16:25:57 2014-03-05 16:25:57 pahio (2872) pahio (2872) 14 pahio (2872) Derivation msc 34A05