Differential Equation Exercise 21

We are asked to solve the following differential equation:

$$ y'' - y = 2x \sin(x) $$

This is a second-order nonhomogeneous differential equation.

The nonhomogeneous term is of the form Q(x)sin(βx), which makes it suitable for solving using the method of undetermined coefficients.

We'll solve it in three steps.

1] Solving the homogeneous equation

We begin by finding the general solution to the associated homogeneous equation:

$$ y'' - y = 2x \sin(x) $$

To do this, we introduce an auxiliary variable and form the characteristic equation:

$$ t^2 - 1 = 0 $$

This yields two distinct real roots: \( t_1 = -1 \) and \( t_2 = 1 \)

$$ t^2 = 1 $$

$$ \sqrt{t^2} = \sqrt{1} $$

$$ t = \begin{cases} t_1 = -1 \\ \\ t_2 = 1 \end{cases} $$

Since the roots are distinct, the general solution of the homogeneous equation is:

$$ y_o = c_1 e^{\lambda_1 x} + c_2 e^{\lambda_2 x} $$

where λ1 = -1 and λ2 = 1

$$ y_o = c_1 e^{-x} + c_2 e^{x} $$

This gives us the homogeneous solution.

Next, we compute a particular solution to the nonhomogeneous equation.

2] Finding a particular solution

To find a particular solution, we apply the method of undetermined coefficients.

The right-hand side is of the form Q(x)sin(βx), with Q(x) = 2x and β = 1.

We first check whether \( i\beta \) is a root of the characteristic equation:

$$ t^2 - 1 = 0 $$

$$ (i\beta)^2 - 1 = 0 $$

$$ (i \cdot 1)^2 - 1 = 0 $$

$$ i^2 - 1 = -1 - 1 = -2 \neq 0 $$

Since \( i\beta \) is not a root, the particular solution has the form:

$$ y_p = R(x) \cos(\beta x) + S(x) \sin(\beta x) $$

With β = 1, this becomes:

$$ y_p = R(x) \cos(x) + S(x) \sin(x) $$

Because Q(x) = 2x is a polynomial of degree 1, we assume R(x) = A + Bx and S(x) = C + Dx, both polynomials of degree 1:

$$ y_p = (A + Bx) \cos(x) + (C + Dx) \sin(x) $$

The constants A, B, C, and D are to be determined.

We now compute the first derivative of \( y_p \):

$$ y'_p = D_x [ (A + Bx) \cos(x) + (C + Dx) \sin(x) ] $$

Applying the product rule:

$$ y'_p = B \cos(x) - (A + Bx) \sin(x) + D \sin(x) + (C + Dx) \cos(x) $$

Now compute the second derivative:

$$ y''_p = D_x [ B \cos(x) - (A + Bx) \sin(x) + D \sin(x) + (C + Dx) \cos(x) ] $$

After differentiating:

$$ y''_p = -2B \sin(x) + 2D \cos(x) - (A + Bx) \cos(x) - (C + Dx) \sin(x) $$

Now we substitute \( y_p \) and \( y''_p \) into the original equation:

$$ y'' - y = 2x \sin(x) $$

Substituting gives:

$$ y''_p - y_p = 2x \sin(x) $$

Plugging in the expressions for \( y''_p \) and \( y_p \):

$$ [-2B \sin(x) + 2D \cos(x) - (A + Bx) \cos(x) - (C + Dx) \sin(x)] - [(A + Bx) \cos(x) + (C + Dx) \sin(x)] = 2x \sin(x) $$

Grouping like terms:

$$ \sin(x)[-2B - 2C - 2Dx] + \cos(x)[2D - 2A - 2Bx] = 2x \sin(x) $$

Now we match coefficients of \( \sin(x) \) and \( \cos(x) \) on both sides:

$$ \begin{cases} -2B - 2C - 2Dx = 2x \\ \\ 2D - 2A - 2Bx = 0 \end{cases} $$

Note: On the left-hand side, the coefficient of \( \sin(x) \) is \( -2B - 2C - 2Dx \); on the right-hand side, it's \( 2x \). For \( \cos(x) \), the left-hand coefficient is \( 2D - 2A - 2Bx \), and the right-hand coefficient is 0.

We equate the coefficients of like powers of \( x \):

$$ \begin{cases} -2D = 2 \\ -2B - 2C = 0 \\ -2B = 0 \\ 2D - 2A = 0 \end{cases} $$

Note: In the first equation, the coefficient of \( x \) in the first row gives \( -2D = 2 \). From the constant terms, we get the remaining equations.

Solving this system:

From \( -2D = 2 \) we get \( D = -1 \)

From \( -2B = 0 \), we find \( B = 0 \)

Plugging into \( -2B - 2C = 0 \) gives \( C = 0 \)

From \( 2D - 2A = 0 \) we find \( A = -1 \)

Now substitute these constants into the particular solution:

$$ y_p = (A + Bx) \cos(x) + (C + Dx) \sin(x) $$

$$ y_p = (-1) \cos(x) + (-x) \sin(x) $$

Therefore, the particular solution is:

$$ y_p = - \cos(x) - x \sin(x) $$

3] General solution

The general solution is the sum of the homogeneous and particular solutions:

$$ y = y_o + y_p $$

We know:

$$ y_o = c_1 e^{-x} + c_2 e^{x} $$

and

$$ y_p = - \cos(x) - x \sin(x) $$

Thus, the general solution is:

$$ y = c_1 e^{-x} + c_2 e^{x} - \cos(x) - x \sin(x) $$

where \( c_1 \) and \( c_2 \) are arbitrary real constants.

And that completes the solution.

 

 
 

Please feel free to point out any errors or typos, or share suggestions to improve these notes. English isn't my first language, so if you notice any mistakes, let me know, and I'll be sure to fix them.

FacebookTwitterLinkedinLinkedin
knowledge base

Differential Equations

First-Order Differential Equations

Second-Order Differential Equations

Higher-Order Linear Equations

Examples and Practice Problems

Theory

Approximate Solutions