Calculus – Second-order differential equations – Nonhomogeneous linear differential equations
A nonhomogeneous second-order linear differential equation has the form
\[P(x)y''(x)+Q(x)y'(x)+R(x)y(x)=G(x),\]where \(P\), \(Q\) and \(R\) are continuous functions with \(P(x)\not\equiv0\) and \(G(x)\not\equiv0\). Then we have:
Theorem: If \(y_p(x)\) is a particular solution and \(y_h(x)\) is the general solution of the corresponding homogeneous (also called: complementary) differential equation (with \(G(x)\) replaced by \(0\)), then is \(y(x)=y_p(x)+y_h(x)\) the general solution.
In the case of nonhomogeneous second-order linear differential equations with constant coefficients
\[ay''+by'+cy=G(x),\quad a,b,c\in\mathbb{R},\quad a\neq0,\]we are able to obtain the general solution \(y_h(x)\) of the corresponding homogeneous differential equation in all cases.
In order to solve the nonhomogeneous differential equation, then we only need an (arbitrary) particular solution \(y_p(x)\).
In some cases we will be able to find such a particular solution by guessing its form, with one or more coefficients, and then deduce the values of these coefficients by substitution. This is called the
method of undetermined coefficients.
This method can be applied when the right-hand side \(G(x)\) is an exponential function, a polynomial, a sine, a cosine or a combination of these functions.
Examples:
1) If \(y''-2y'-8y=e^{3x}\), then \(y_h(x)=c_1e^{-2x}+c_2e^{4x}\). Now take \(y_p(x)=Ae^{3x}\), then we have: \(y_p'(x)=3Ae^{3x}\) en \(y_p''(x)=9Ae^{3x}\). Substitution then gives:
\[9Ae^{3x}-6Ae^{3x}-8Ae^{3x}=e^{3x}\quad\Longleftrightarrow\quad-5Ae^{3x}=e^{3x}\quad\Longleftrightarrow\quad A=-\tfrac{1}{5}.\] Hence: \(y_p(x)=-\frac{1}{5}e^{3x}\) is a particular solution. Then the general solution is: \(y(x)=-\frac{1}{5}e^{3x}+c_1e^{-2x}+c_2e^{4x}\) with \(c_1,c_2\in\mathbb{R}\).2) If \(y''-2y'-8y=e^{4x}\), then \(y_h(x)=c_1e^{-2x}+c_2e^{4x}\). Now take \(y_p(x)=Axe^{4x}\), then we have: \(y_p'(x)=A(4x+1)e^{4x}\) en \(y_p''(x)=A(16x+8)e^{4x}\). Substitution then gives:
\[A(16x+8)e^{4x}-A(8x+2)e^{4x}-8Axe^{4x}=e^{4x}\quad\Longleftrightarrow\quad6Ae^{4x}=e^{4x}\quad\Longleftrightarrow\quad A=\tfrac{1}{6}.\]Hence: \(y_p(x)=\frac{1}{6}xe^{4x}\) is a particular solution. Then the general solution is: \(y(x)=\frac{1}{6}xe^{4x}+c_1e^{-2x}+c_2e^{4x}\) with \(c_1,c_2\in\mathbb{R}\).
3) If \(y''-2y'-8y=8e^{2x}-6e^{-2x}\), then \(y_h(x)=c_1e^{-2x}+c_2e^{4x}\). Now take \(y_p(x)=Ae^{2x}+Bxe^{-2x}\), then we have: \(y_p'(x)=2Ae^{2x}+(-2Bx+B)e^{-2x}\) en \(y_p''(x)=4Ae^{2x}+(4Bx-4B)e^{-2x}\). Substitution then gives:
\begin{align*} &4Ae^{2x}+(4Bx-4B)e^{-2x}-4Ae^{2x}+(4Bx-2B)e^{-2x}-8Ae^{2x}-8Bxe^{-2x}=8e^{2x}-6e^{-2x}\\[2.5mm] &{}\hspace{10mm}\Longleftrightarrow\quad -8Ae^{2x}-6Be^{-2x}=8e^{2x}-6e^{-2x}\quad\Longleftrightarrow\quad A=-1\;\;\text{and}\;\;B=1. \end{align*}Hence: \(y_p(x)=xe^{-2x}-e^{2x}\) is a particular solution. Then the general solution is: \(y(x)=xe^{-2x}-e^{2x}+c_1e^{-2x}+c_2e^{4x}\) with \(c_1,c_2\in\mathbb{R}\).
4) If \(y''-4y'+4y=e^{2x}\), then \(y_h(x)=c_1e^{2x}+c_2xe^{2x}\). Now take \(y_p(x)=Ax^2e^{2x}\), then we have: \(y_p'(x)=A(2x^2+2x)e^{4x}\) en \(y_p''(x)=A(4x^2+8x+2)e^{2x}\). Substitution then gives:
\[A(4x^2+8x+2)e^{2x}-A(8x^2+8x)e^{2x}+4Ax^2e^{2x}=e^{2x}\quad\Longleftrightarrow\quad2Ae^{2x}=e^{2x}\quad\Longleftrightarrow\quad A=\tfrac{1}{2}.\]Hence: \(y_p(x)=\frac{1}{2}x^2e^{2x}\) is a particular solution. Then the general solution is: \(y(x)=\frac{1}{2}x^2e^{2x}+c_1e^{2x}+c_2xe^{2x}\) with \(c_1,c_2\in\mathbb{R}\).
5) If \(y''-2y'-8y=5xe^{3x}\), then \(y_h(x)=c_1e^{-2x}+c_2e^{4x}\). Now take \(y_p(x)=(Ax+B)e^{3x}\), then we have: \(y_p'(x)=(3Ax+A+3B)e^{3x}\) en \(y_p''(x)=(9Ax+6A+9B)e^{3x}\). Substitution then gives:
\begin{align*} &(9Ax+6A+9B-6Ax-2A-6B-8Ax-8B)e^{3x}=5xe^{3x}\quad\Longleftrightarrow\quad(-5Ax+4A-5B)e^{3x}=5xe^{3x}\\[2.5mm] &{}\hspace{10mm}\Longleftrightarrow\quad -5A=5\;\;\text{and}\;\;4A-5B=0\quad\Longleftrightarrow\quad A=-1\;\;\text{and}\;\;B=-\tfrac{4}{5}. \end{align*} Hence: \(y_p(x)=-(x+\frac{4}{5})e^{3x}\) is a particular solution. Then the general solution is: \(y(x)=-(x+\frac{4}{5})e^{3x}+c_1e^{-2x}+c_2e^{4x}\) with \(c_1,c_2\in\mathbb{R}\).6) If \(y''-2y'-8y=12xe^{4x}\), then \(y_h(x)=c_1e^{-2x}+c_2e^{4x}\). Now take \(y_p(x)=(Ax^2+Bx)e^{4x}\), then we have: \(y_p'(x)=(4Ax^2+2Ax+4Bx+B)e^{4x}\) en \(y_p''(x)=(16Ax^2+16Ax+16Bx+8B)e^{4x}\). Substitution then gives:
\begin{align*} &(16Ax^2+16Ax+16Bx+8B-8Ax^2-4Ax-8Bx-2B-8Ax^2-8Bx)e^{4x}=12xe^{4x}\quad\Longleftrightarrow\quad(12Ax+2A+6B)e^{4x}=12xe^{4x}\\[2.5mm] &{}\hspace{10mm}\Longleftrightarrow\quad 12A=12\;\;\text{and}\;\;2A+6B=0\quad\Longleftrightarrow\quad A=1\;\;\text{and}\;\;B=-\tfrac{1}{3}. \end{align*}Hence: \(y_p(x)=(x^2-\frac{1}{3}x)e^{4x}\) is a particular solution. Then the general solution is: \(y(x)=(x^2-\frac{1}{3}x)e^{4x}+c_1e^{-2x}+c_2e^{4x}\) with \(c_1,c_2\in\mathbb{R}\).
7) If \(y''+3y'+2y=4x\), then \(y_h(x)=c_1e^{-x}+c_2e^{-2x}\). Now take \(y_p(x)=Ax+B\), then we have: \(y_p'(x)=A\) en \(y_p''(x)=0\). Substitution then gives:
\[0+3A+2Ax+2B=4x\quad\Longleftrightarrow\quad 2A=4\;\;\text{and}\;\;3A+2B=0\quad\Longleftrightarrow\quad A=2\;\;\text{and}\;\;B=-3.\]Hence: \(y_p(x)=2x-3\) is a particular solution. Then the general solution is: \(y(x)=2x-3+c_1e^{-x}+c_2e^{-2x}\) met \(c_1,c_2\in\mathbb{R}\).
8) If \(y''+4y'+5y=25x^2\), then \(y_h(x)=c_1e^{-2x}\cos(x)+c_2e^{-2x}\sin(x)\). Now take \(y_p(x)=Ax^2+Bx+C\), then we have: \(y_p'(x)=2Ax+B\) en \(y_p''(x)=2A\). Substitution then gives:
\[2A+8Ax+4B+5Ax^2+5Bx+5C=25x^2\quad\Longleftrightarrow\quad 5A=25,\;\;8A+5B=0\;\;\text{and}\;\;2A+4B+5C=0.\]This implies that \(A=5\), \(B=-8\) en \(C=\frac{22}{5}\). Hence: \(y_p(x)=5x^2-8x+\frac{22}{5}\) is a particular solution. Then the general solution is: \(y(x)=5x^2-8x+\frac{22}{5}+c_1e^{-2x}\cos(x)+c_2e^{-2x}\sin(x)\) with \(c_1,c_2\in\mathbb{R}\).
9) If \(y''+4y'=8x\), then \(y_h(x)=c_1+c_2e^{-4x}\). Now take \(y_p(x)=Ax^2+Bx\), then we have: \(y_p(x)=2Ax+B\) en \(y_p''(x)=2A\). Substitution then gives:
\[2A+8Ax+4B=8x\quad\Longleftrightarrow\quad 8A=8\;\;\text{and}\;\;2A+4B=0\quad\Longleftrightarrow\quad A=1\;\;\text{and}\;\;B=-\tfrac{1}{2}.\]Hence: \(y_p(x)=x^2-\frac{1}{2}x\) is a particular solution. Then the general solution is: \(y(x)=x^2-\frac{1}{2}x+c_1+c_2e^{-4x}\).
10) If \(y''-3y'+2y=10\cos(x)\), then \(y_h(x)=c_1e^x+c_2e^{2x}\). Now take \(y_p(x)=A\cos(x)+B\sin(x)\), then we have: \(y_p(x)=-A\sin(x)+B\cos(x)\) en \(y_p''(x)=-A\cos(x)-B\sin(x)\). Substitution then gives:
\begin{align*} &-A\cos(x)-B\sin(x)+3A\sin(x)-3B\cos(x)+2A\cos(x)+2B\sin(x)=10\cos(x)\\[2.5mm] &{}\hspace{10mm}\Longleftrightarrow\quad (A-3B)\cos(x)+(3A+B)\sin(x)=10\cos(x)\\[2.5mm] &{}\hspace{10mm}\Longleftrightarrow\quad A-3B=10\;\;\text{and}\;\;3A+B=0. \end{align*}This implies that \(A=1\) en \(B=-3\). Hence: \(y_p(x)=\cos(x)-3\sin(x)\) is a particular solution. Then the general solution is: \(y(x)=\cos(x)-3\sin(x)+c_1e^x+c_2e^{2x}\) with \(c_1,c_2\in\mathbb{R}\).
11) If \(y''+2y'+5y=17\sin(2x)\), then \(y_h(x)=c_1e^{-x}\cos(2x)+c_2e^{-x}\sin(2x)\). Now take \(y_p(x)=A\cos(2x)+B\sin(2x)\), then we have: \(y_p'(x)=-2A\sin(2x)+2B\cos(2x)\) en \(y_p''(x)=-4A\cos(2x)-4B\sin(2x)\). Substitution then gives:
\begin{align*} &-4A\cos(2x)-4B\sin(2x)-4A\sin(2x)+4B\cos(2x)+5A\cos(2x)+5B\sin(2x)=17\sin(2x)\\[2.5mm] &{}\hspace{10mm}\Longleftrightarrow\quad(A+4B)\cos(2x)+(-4A+B)\sin(2x)=17\sin(2x)\\[2.5mm] &{}\hspace{10mm}\Longleftrightarrow\quad A+4B=0\;\;\text{and}\;\;-4A+B=17. \end{align*}This implies that \(A=-4\) en \(B=1\). Hence: \(y_p(x)=-4\cos(2x)+\sin(2x)\) is a particular solution. Then the general solution is: \(y(x)=-4\cos(2x)+\sin(2x)+c_1e^{-x}\cos(2x)+c_2e^{-x}\sin(2x)\) with \(c_1,c_2\in\mathbb{R}\).
12) If \(y''+9y=6\sin(3x)\), then \(y_h(x)=c_1\cos(3x)+c_2\sin(3x)\). Now take \(y_p(x)=Ax\cos(3x)+Bx\sin(3x)\), then we have: \(y_p'(x)=A\left(\cos(3x)-3x\sin(3x)\right)+B\left(\sin(3x)+3x\cos(3x)\right)\) en \(y_p''(x)=A\left(-6\sin(3x)-9x\cos(3x)\right)+B\left(6\cos(3x)-9x\sin(3x)\right)\). Substitution then gives:
\begin{align*} &A\left(-6\sin(3x)-9x\cos(3x)\right)+B\left(6\cos(3x)-9x\sin(3x)\right)+9Ax\cos(3x)+9Bx\sin(3x)=6\sin(3x)\\[2.5mm] &{}\hspace{10mm}\Longleftrightarrow\quad-6A\sin(3x)+6B\cos(3x)=6\sin(3x)\quad\Longleftrightarrow\quad A=-1\;\;\text{and}\;\;B=0. \end{align*}Hence: \(y_p(x)=-x\cos(3x)\) is a particular solution. Then the general solution is: \(y(x)=-x\cos(3x)+c_1\cos(3x)+c_2\sin(3x)\) met \(c_1,c_2\in\mathbb{R}\).
The method of variation of parameters can be found here.
Last modified on March 8, 2021