Mathematics, Sciences, and Technologies

“Every secret of a writer’s soul, every experience of his life, every quality of his mind is written large in his works.”
– Virginia Woolf

ODEs 2-7: Method of Undetermined Coefficients (Part 2)

,

Duplicated Source Term: Raising the Degree

Continuing from the last tutorial, we can guess a particular solution for a non-homogeneous ODE that has a similar form to the source term. However, if the source term coincides with the complementary solution, then plugging in this similar form, supposedly as the particular solution, will result in zero and cannot match the non-homogeneous part. The remedy is very similar to the case where the auxiliary equation has a repeated root (see this): we will add a power of \( x \) to the ansatz. To illustrate, consider a special case where

\begin{equation}
(\frac{d}{dx} -\alpha)(\frac{d}{dx} -\beta)y = \frac{d^2y}{dx^2} -(\alpha+\beta)\frac{dy}{dx} + \alpha\beta y = Pe^{\alpha x} \tag{1}
\end{equation}

This ODE has the obvious complementary solutions of \( e^{\alpha x} \) and \( e^{\beta x} \) (assumed that \( \alpha \neq \beta\)), so if we try \( Q e^{\alpha x} \) as the test particular solution, the L.H.S. will vanish and it does not work. This is equivalent to

\begin{align}
(\frac{d}{dx} -\alpha)(\frac{d}{dx} -\beta) e^{\alpha x} &= 0 \tag{2}
\end{align}

Now we can differentiate this equation with respect to \( \alpha \) to get

\begin{align}
\frac{\partial}{\partial \alpha}[(\frac{d}{dx} -\alpha)(\frac{d}{dx} -\beta) e^{\alpha x}] &= 0 \\
-(\frac{d}{dx} -\beta)e^{\alpha x} + (\frac{d}{dx} -\alpha)(\frac{d}{dx} -\beta)(x e^{\alpha x}) &= 0 \\
(\frac{d}{dx} -\alpha)(\frac{d}{dx} -\beta)(x e^{\alpha x}) &= (\frac{d}{dx} -\beta)e^{\alpha x} \\
&= (\alpha -\beta)e^{\alpha x} \tag{3}
\end{align}

This readily shows that the new particular solution \( x e^{\alpha x} \) can reproduce the non-homogeneous term \( e^{\alpha x} \) on the R.H.S. with an extra factor and it is viable. To generalize, for a higher-order constant-coefficient ODE, if the source term (probably multiplied by some polynomial \( p(x) \) of degree \( k \)) appears \( m \) times (sometimes known as the multiplicity) in the complementary solution basis, then for the ansatz, we will have to try \( q(x) \) times the source term where \( q(x) \) is a polynomial of degree \( k+m \) to be determined.

Example

Find the full solution for the ODE

\begin{equation}
\frac{d^2y}{dx^2} + y = 2\sin x \tag{4}
\end{equation}

where \( y(0) = 1, y'(0) = 0\).

It is not difficult to see that the auxiliary equation is \( r^2 + 1 = 0 \Rightarrow r = \pm i \), and the complementary solution consists of \( y_1 = \sin x \) and \( y_2 = \cos x \). Since the non-homogeneous term is the same as (a scalar multiple of) \( y_1 \), we need to raise one degree and try \( y_p = a x \sin x + b x \cos x \). The corresponding derivatives are \( dy_p/dx = a x \cos x + a \sin x -b x \sin x + b \cos x\) and \( d^2y_p/dx^2 = -a x \sin x -b x \cos x -2b \sin x + 2a \cos x \). Substituting these into (4) yields

\begin{align}
(-a x \sin x -b x \cos x -2b \sin x + 2a \cos x) &= 2\sin x \\
+ (a x \sin x + b x \cos x) & \\
-2b \sin x -2a \cos x &= 2\sin x \tag{5}
\end{align}

Matching the coefficients gives \( a = 0, b = -1 \), and the general solution has the form of \(y = c_1 \sin x + c_2 \cos x -x\cos x\), and thus \( dy/dx = c_1 \cos x -c_2 \sin x -\cos x + x \sin x \). Substituting the I.C. then results in \( c_1 = c_2 = 1 \), hence the final answer is \(y = \sin x + \cos x -x\cos x\).

Exercise

Compute the full solution of

\begin{equation}
\frac{d^2y}{dx^2} -4\frac{dy}{dx} + 4y = 3xe^{2x} \tag{6}
\end{equation}

with the I.C. \( y(0) = 1, y'(0) = 1 \).

Answer

We leave it to the readers to check that the complementary solution consists of \( y_1 = e^{2x} \) and \( y_2 = xe^{2x} \), so the \( e^{2x} \) basis has a multiplicity of \( 2 \). This demands us to increase the degree by \( 2 \) and guess the form of the particular solution as \( y_p = a_3x^3e^{2x} + a_2x^2e^{2x} \). (There is no need for the \(a_1, a_0\) terms, why?) Plugging in this leads to

\begin{align}
\begin{aligned}
(4a_3x^3e^{2x} + (12a_3 + 4a_2)x^2e^{2x} + (6a_3+ 8a_2)xe^{2x} + 2a_2e^{2x}) \\
-4(2a_3x^3e^{2x} +(3a_3+ 2a_2)x^2e^{2x} + 2a_2xe^{2x}) \\
+4(a_3x^3e^{2x} + a_2x^2e^{2x})
\end{aligned} &= 3xe^{2x} \\
6a_3xe^{2x} + 2a_2e^{2x} &= 3xe^{2x} \\
\end{align}

Comparing the coefficients gives \( a_3 = 1/2, a_2 = 0 \), and so the general solution will look like \( y = c_1 e^{2x} + c_2 xe^{2x} + (1/2)x^3e^{2x} \). Differentiation yields \( y’ = (2c_1+c_2) e^{2x} + 2c_2xe^{2x} + (3/2)x^2e^{2x} + x^3e^{2x} \), and matching the I.C. produces \( c_1 = 1, c_2 = -1 \) with the final answer of \( y = e^{2x} -xe^{2x} + (1/2)x^3e^{2x} \).

Leave a Reply

I’m Benjamin

Welcome to my Mathematical World! Here you can find posts and tutorials related to applied topics like Linear Algebra, Calculus, Differential Equations, as well as Programming. Feel free to leave comments and suggestions!

Let’s connect

Discover more from Benjamin's Maths World

Subscribe now to keep reading and get access to the full archive.

Continue reading