Skip to main content

Second order non-homogeneous

Second order non-homogeneous differential equations are used to model systems like climate dynamics with variable weather patterns, economic models with fluctuating market forces, and chemical reactions with external catalysts. Understanding how to solve them helps predict system responses to external stimuli.

Second order non-homogeneous differential equations

A second order non-homogeneous differential equation is an equation that involves a function and its derivatives up to the second order. They are called "non-homogeneous" because they have a non-zero function on the output side—that is, \(f(x)\neq0\).

Second order non-homogeneous differential equations have the general form:

\[f(x)=a_{1}\dfrac{d^{2}y}{dx^{2}}+a_{2}\dfrac{dy}{dx}+a_{3}y\]

where \(a_{1}\), \(a_{2}\) and \(a_{3}\) are constants, and \(f(x)\neq0\).

Solving second order non-homogeneous differential equations

The method for solving second order non-homogeneous differential equations builds on the method for homogeneous equations. We find the auxiliary and complementary functions in the same way.

One key difference is that we use a particular integral, \(y_{p}(x)\). The particular integral is a type of function based on the general form of the function \(f(x)\); it is the function on the other side of the equals sign. The table shows some examples.

Function \(f(x)\) Particular integral \(y_{p}(x)\)
\(f(x)=4\) \(y_{p}(x)=a\)
\(f(x)=2x+3\) \(y_{p}(x)=ax+b\)
\(f(x)=x^{2}-2x+7\) \(y_{p}(x)=ax^{2}+bx+c\)
\(f(x)=2e^{\alpha x}\) \(y_{p}(x)=ae^{\alpha x}\)
\(f(x)=3\sin(px)\), \(f(x)=7\cos(px)\) or \(f(x)=4\sin(px)+2\cos(px)\) \(y_{p}(x)=a\sin(px)+b\cos(px)\)

For sine and cosine functions, the particular integral is ALWAYS \(a\sin(px)+b\cos(px)\), regardless or whether the original function only consists of sine or cosine functions, or a sum of both.

The general solution for second order non-homogeneous differential equations is:

\[y(x)=y_{c}(x)+y_{p}(x)\]

Example 1 – solving second order non-homogeneous differential equations

Determine the general solution \(y(x)\) for the equation \(2\dfrac{d^{2}y}{dx^{2}}-\dfrac{dy}{dx}-6y=3x+2\).

Find the auxiliary equation and solve for \(m\).
\[\begin{align*} 2m^{2}-m-6 & = 0\\
(2m+3)(m-2) & = 0\\
2m+3=0 & \textrm{ or } m-2=0\\
m_{1}=-\dfrac{3}{2} & \textrm{ or } m_{2}=2
\end{align*}\]

There are two real and different solutions, so the complementary function is:
\[y_{c}(x)=Ae^{-\frac{3}{2}}+Be^{2x}\]

For this example, \(f(x)=3x+2\) which is a linear function. Therefore, the particular integral is:
\[y_{p}(x)=ax+b\]

To find \(a\) and \(b\), we need to use the original equation:
\[2\frac{d^{2}y}{dx^{2}}\frac{dy}{dx}-6y=3x+2\]

We can find \(\dfrac{d^{2}y}{dx^{2}}\) and \(\dfrac{dy}{dx}\).
\[\frac{dy}{dx}=a\] \[\frac{d^{2}y}{dx^{2}}=0\]

Let's substitute these values into the equation, group the "like" powers and solve for \(a\) and \(b\).
\[\begin{align*} 2(0)-(a)-6(ax+b) & = 3x+2\\
(-6a)x+(-a-6b) & = 3x+2\\
-6a=3 & \textrm{ and } -a-6b=2\\
a=-\frac{1}{2} & \textrm{ and } -\frac{1}{2}-6b=2\\
& \quad\quad\quad\quad b=-\frac{1}{4}
\end{align*}\]

The particular integral is therefore:
\[y_{p}(x)=-\frac{1}{2}x-\frac{1}{4}\]

Finally, we can find the general solution.
\[\begin{align*} y(x) & = y_{c}(x)+y_{p}(x)\\
& = Ae^{-\frac{3}{2}x}+Be^{2x}-\frac{1}{2}x-\frac{1}{4}
\end{align*}\]

Repeated solutions

Sometimes, a term in the complementary function will also appear in the form you chose for the particular integral. This overlap causes the particular integral to not work; you will not be able to solve the question effectively.

To fix this, we just need to multiply the initial guess for the particular integral by increasing powers of \(x\) until it is no longer matches any part of the complementary solution.

But what does this all mean? Let's look at Example 2.

Example 2 – solving second order non-homogeneous differential equations

Solve the differential equation \(y''-y'-2y=6e^{-x}\).

The auxiliary equation is \(m^{2}-m-2=0\). The solutions for \(m\) are \(m=-1\) and \(m=2\). These are two real and different solutions.

The complementary function is therefore:
\[y_{c}(x)=Ae^{-x}+Be^{2x}\]

The particular integral is \(y_{p}(x)=ke^{-x}\), but this term is already contained within the complementary function.

We start by multiplying by \(x\) to get:
\[y_{p}(x)=kxe^{-x}\]

Now, we can find the value of \(k\) by substituting \(y_{p}(x)\) and its derivatives into the original equation. Here, we need to use The product rule.
\[\frac{dy}{dx}=ke^{-x}-kxe^{-x}\] \[\frac{dy^{2}}{dx^{2}}=-2ke^{-x}+kxe^{-x}\]

Substituting these into the original equation and solving for \(k\), we get:
\[\begin{align*} -2ke^{-x}+kxe^{-x}-(ke^{-x}-kxe^{-x})-2(kxe^{-x}) & = 6e^{-x}\\
-3ke^{-x} & = 6e^{-x}\\
k & =-2
\end{align*}\]

The particular integral is therefore:
\[y_{p}(x)=-2xe^{-x}\]

The general solution is:
\[\begin{align*} y(x) & = y_{c}(x)+y_{p}(x)\\
& = Ae^{-x}+Be^{2x}-2xe^{-x}
\end{align*}\]

Exercise – solving second order non-homogeneous differential equations

  1. Find the general solutions for the following.
    1. \(\dfrac{d^{2}y}{dx^{2}}-2\dfrac{dy}{dx}+y=5e^{x}\)
    2. \(2\dfrac{d^{2}y}{dx^{2}}+5\dfrac{dy}{dx}-3y=4\sin(2x)\)
    3. \(\dfrac{d^{2}y}{dx^{2}}-4\dfrac{dy}{dx}+4y=4x+3\cos(2x)\)
    4. \(\dfrac{d^{2}y}{dx^{2}}+2\dfrac{dy}{dx}+2y=6e^{x}\sin(2x)\)
  2. Find the particular solutions for the following.
    1. \(\dfrac{d^{2}y}{dx^{2}}+4\dfrac{dy}{dx}=6\) given that \(y(0)=0\) and \(\dfrac{dy}{dx}(0)=0\)
    2. \(\dfrac{d^{2}y}{dx^{2}}+9y=12\cos(3x)\) given that \(y(0)=2\) and \(\dfrac{dy}{dx}(0)=3\)
  3. When a mass of \(2\textrm{ kg}\) is attached to a spring whose constant is \(32\textrm{ N/m}\), it comes to rest in the equilibrium position. Starting at \(t=0\), a force equal to \(f(t)=68e^{-2t}\cos(4t)\) is applied to the system. Find the equation of motion in the absence of damping (dissipation of energy).
  4. A mass of \(40\textrm{ kg}\) stretches a spring \(10\textrm{ cm}\). A damping device imparts a resistance to motion equal to \(560\) times the instantaneous velocity. Find the equation of motion if the mass is released from the equilibrium position with a downward velocity of \(2\textrm{ cm/sec}\).

    1. \(y=e^{x}(Ax+b+\dfrac{5}{2}x^{2}\)
    2. \(y=Ae^{\frac{1}{2}x}+Be^{-3x}-\dfrac{4}{221}(11\sin(2x)+10\cos(2x))\)
    3. \(y=(Ax+B)e^{2x}+x+1-\dfrac{3}{8}\sin(2x)\)
    4. \(y=e^{-x}(A\cos(x)+B\sin(x))+\dfrac{e^{x}}{17}(6\sin(2x)-24\cos(2x)\)
    1. \(y=\dfrac{3}{8}e^{-4}+\dfrac{3}{2}x-\dfrac{3}{8}\)
    2. \(y=2\cos(3x)+(1+2x)\sin(3x)\)
  1. \(x(t)=-\dfrac{1}{2}\cos(4t)+\dfrac{9}{4}\sin(4t)+\dfrac{1}{2}e^{-2t}\cos(4t)-2e^{-2t}\sin(4t)\)
  2. \(x(t)=\dfrac{2}{7}e^{-7t}\sin(7t)\)