# Differential equations/Linear inhomogeneous differential equations

 Educational level: this is a tertiary (university) resource.
 Type classification: this is a lesson resource.
 Subject classification: this is a mathematics resource.
 Completion status: this resource is ~25% complete.

## Method of Undetermined Coefficients

### Definition

A non-homogeneous second order equation is an equation where the right hand side is equal to some constant or function of the independent variable. This technique is best when the right hand side of the equation has a fairly simple derivative.

### Solution

The solution is divided into two parts and then added together by superposition. The first part is obtained by solving the complimentary (homogeneous) equation. The second part is obtained from a set of equations. To illustrate the solution, we will take the equation ${\displaystyle y''+2y'+y=x^{2}}$ as an example.

1. Solve the homogeneous equation (${\displaystyle y''+2y'+y=0}$) and get the roots of the characteristic equation (${\displaystyle (m+1)^{2}=0,m=-1}$) .
2. Plug the roots into the general solution (${\displaystyle y_{c}=c_{1}\sin(x)+c_{2}\cos(x)}$) to obtain the complementary (homogeneous) solution.
3. To get the typical (specific) solution to the differential equation, we need to choose a "solution" from a table.
1. ${\displaystyle 1}$ (any constant): ${\displaystyle A}$
2. ${\displaystyle 5x+7}$ : ${\displaystyle Ax+B}$
3. ${\displaystyle 3x^{2}-2}$ : ${\displaystyle Ax^{2}+Bx+C}$
4. ${\displaystyle x^{3}-x+1}$ : ${\displaystyle Ax^{3}+Bx^{2}+Cx+D}$
5. ${\displaystyle \sin(4x)}$ : ${\displaystyle A\cos(4x)+B\sin(4x)}$
6. ${\displaystyle \cos(4x)}$ : ${\displaystyle A\cos(4x)+B\sin(4x)}$
7. ${\displaystyle e^{5x}}$ : ${\displaystyle Ae^{5x}}$
8. ${\displaystyle (9x-2)e^{5x}}$ : ${\displaystyle (Ax+B)e^{5x}}$
9. ${\displaystyle x^{2}e^{5x}}$ : ${\displaystyle (Ax^{2}+Bx+C)e^{5x}}$
10. ${\displaystyle e^{3x}\sin(4x)}$ : ${\displaystyle Ae^{3x}\cos(4x)+Be^{3x}\sin(4x)}$
11. ${\displaystyle 5x^{2}\sin(4x)}$ : ${\displaystyle (Ax^{2}+Bx+C)\cos(4x)+(Ex^{2}+Fx+G)\sin(4x)}$
12. ${\displaystyle xe^{3x}\cos(4x)}$ : ${\displaystyle (Ax+B)e^{3x}\cos(4x)+(Cx+E)e^{3x}\sin(4x)}$
4. Choose the "solution" that best fits the right hand side of the equation. (the solution of ${\displaystyle \textstyle x^{2}}$ must take the form ${\displaystyle \textstyle y_{p}=Ax^{2}+Bx+C}$ ).
5. Differentiate the "solution" to get the derivatives of the solution (${\displaystyle y_{p}^{'}=2Ax+B,y_{p}^{''}=2A}$ ).
6. Substitute those solutions into the left hand side of the original differential equation (${\displaystyle (2A)+2(2Ax+B)+(Ax^{2}+Bx+C)=x^{2}}$ ).
7. Collect and compare like terms to solve for the coefficients (${\displaystyle A=1,B=-4,C=6}$ ).
8. Substitute the coefficients back into typical "solution" (${\displaystyle y_{p}=x^{2}-4x+6}$ ).
9. Add the typical and the complementary solutions to get the complete solution
${\displaystyle y=y_{c}+y_{p}=c_{1}\cos(x)+c_{2}\sin(x)+x^{2}-4x+6}$

## Variation of Parameters

### Definition

A non-homogeneous second order equation is an equation where the right hand side is equal to some constant or function of the independent variable. This technique is best when the right hand side of the equation has a fairly complicated derivative.

### Solution

This technique involves solving the complementary equation and using both solutions (${\displaystyle y_{1}}$ and ${\displaystyle y_{2}}$ ) as a basis to solve for two more particular solutions that combine to form the typical solution ${\displaystyle y_{p}=u_{1}(x)+u_{2}(x)}$ . To illustrate, let's solve the differential equation ${\displaystyle y''-2y'-1=2xe^{3x}}$ .

1. Solve for the complementary solution (${\displaystyle (m-1)^{2}=0,m=\pm 1,y_{c}=e^{x}+xe^{x}}$ ).
2. Take each term in the complementary solution and make them separate functions (${\displaystyle y_{1}=e^{x},y_{2}=xe^{x}}$ ).
3. Set up the following three Wronksian matrices and take the determinants of them:
1. ${\displaystyle W={\begin{vmatrix}y_{1}(x)&y_{2}(x)\\y_{1}^{'}(x)&y_{2}^{'}(x)\end{vmatrix}}={\begin{vmatrix}e^{x}&xe^{x}\\e^{x}&e^{x}(1+x)\end{vmatrix}}=e^{2x}}$

2. ${\displaystyle W_{1}={\begin{vmatrix}0&y_{2}(x)\\f(x)&y_{2}^{'}(x)\end{vmatrix}}={\begin{vmatrix}0&xe^{x}\\2xe^{3x}&e^{x}(1+x)\end{vmatrix}}=-2x^{2}e^{4x}}$

3. ${\displaystyle W_{2}={\begin{vmatrix}y_{1}(x)&0\\y_{1}^{'}(x)&f(x)\end{vmatrix}}={\begin{vmatrix}e^{x}&0\\e^{x}&2xe^{3x}\end{vmatrix}}=2xe^{4x}}$

4. Solve for the terms ${\displaystyle u_{1}^{'}={\frac {W_{1}}{W}}={\frac {-2x^{2}e^{4x}}{e^{2x}}}=-2x^{2}e^{2x}}$ and ${\displaystyle u_{2}^{'}={\frac {W_{2}}{W}}={\frac {2xe^{4x}}{e^{2x}}}=2xe^{2x}}$ .
5. Integrate them to get the terms ${\displaystyle u_{1}={\frac {-(2x^{2}-2x+1)e^{2x}}{2}}}$ and ${\displaystyle u_{2}={\frac {(2x-1)e^{2x}}{2}}}$ .
6. Combine them with the complementary solution to get the complete solution (${\displaystyle y=y_{c}+y_{p}=c_{1}e^{x}+c_{2}xe^{x}-{\frac {(2x^{2}-2x+1)e^{2x}}{2}}+{\frac {(2x-1)e^{2x}}{2}}}$) .