Krista King Math | Online math help

View Original

Second-order nonhomogeneous differential equations initial value problems

Steps for solving a second-order nonhomogeneous differential equation initial value problem

To solve an initial value problem for a second-order nonhomogeneous differential equation, we’ll follow a very specific set of steps.

We can summarize these steps as follows:

  1. Find the complementary solution ???y_c(x)???.

  2. Find the particular solution ???y_p(x)???.

  3. Put them together to find the general solution ???y(x)=y_c(x)+y_p(x)???.

  4. Find the derivative of the general solution ???y'(x)=y_c'(x)+y_p'(x)???.

  5. Plug the given initial conditions into the general solution and its derivative to create a system of linear equations.

  6. Solve the system in order to find values for ???c_1??? and ???c_2???.

  7. Plug ???c_1??? and ???c_2??? back into the general solution to solve the initial value problem.

Example of a nonhomogeneous differential equation with an exponential function


Take the course

Want to learn more about Differential Equations? I have a step-by-step course for that. :)


Finding the general solution of the second-order nonhomogeneous differential equation given a set of initial conditions

Example

Find the general solution of the differential equation, if ???y(0)=0??? and ???y'(0)=1???.

???y''+y'=x-2e^{-x}???

First we need to work on the complementary solution, which we’ll do by substituting ???0??? for the entire right side and focusing only the left side.

???y''+y'=0???

Then we’ll make the substitution ???y'=r???.

???r^2+r=0???

???r(r+1)=0???

So the roots are

???r_1=0???

???r_2=-1???

These are distinct real roots, so we’ll use the formula for the complementary solution with distinct real roots and get

???y_c(x)=c_1e^{r_1x}+c_2e^{r_2x}???

???y_c(x)=c_1e^{(0)x}+c_2e^{-1x}???

???y_c(x)=c_1(1)+c_2e^{-x}???

???y_c(x)=c_1+c_2e^{-x}???

We’ll hold on to the complementary solution and switch over to the particular solution. The first thing we notice is that we have a polynomial function, ???x???, and an exponential function, ???-2e^{-x}???. We’ll use ???Ax+B??? as our guess for the polynomial function, and we’ll use ???Ce^{-x}??? as our guess for the exponential function. Putting these together, our guess for the particular solution will be

???y_p(x)=Ax+B+Ce^{-x}???

Comparing this to the complementary solution, we can see that ???c_2e^{-x}??? from the complementary solution and ???Ce^{-x}??? from the particular solution are overlapping terms. To fix this, we’ll multiply ???Ce^{-x}??? from the particular solution by ???x???, such that our guess becomes

???y_p(x)=Ax+B+Cxe^{-x}???

We also need to realize that ???c_1??? from the complementary solution and ???B??? from the particular solution are overlapping terms. To fix this, we’ll multiply the polynomial portion of the particular solution by ???x???, such that our guess becomes

???y_p(x)=Ax^2+Bx+Cxe^{-x}???

Taking the first and second derivatives of this guess, we get

???y_p'(x)=2Ax+B+Ce^{-x}-Cxe^{-x}???

???y_p''(x)=2A-2Ce^{-x}+Cxe^{-x}???

Plugging the first two derivatives into the original differential equation, we get

???2A-2Ce^{-x}+Cxe^{-x}+2Ax+B+Ce^{-x}-Cxe^{-x}=x-2e^{-x}???

???(2A+B)+2Ax-Ce^{-x}=x-2e^{-x}???

Equating coefficients from the left and right side, we get

???2A+B=0???

???2\left(\frac12\right)+B=0???

???B=-1???

and

???2A=1???

???A=\frac12???

and

???-C=-2???

???C=2???

We’ll plug the results into our guess for the particular solution to get

???y_p(x)=\frac12x^2-x+2xe^{-x}???

Putting this together with the complementary solution gives us the general solution to the differential equation.

???Y(x)=y_c(x)+y_p(x)???

???Y(x)=c_1+c_2e^{-x}+\frac12x^2-x+2xe^{-x}???

Now we’ll take the derivative of the general solution.

???Y'(x)=-c_2e^{-x}+x-1+2e^{-x}-2xe^{-x}???

We can now plug the given initial conditions ???y(0)=0??? and ???y'(0)=1??? into the general solution and its derivative to create a system of linear equations.

???Y(x)=c_1+c_2e^{-x}+\frac12x^2-x+2xe^{-x}???

???0=c_1+c_2e^{-(0)}+\frac12(0)^2-0+2(0)e^{-(0)}???

???0=c_1+c_2(1)???

???0=c_1+c_2???

and

???Y'(x)=-c_2e^{-x}+x-1+2e^{-x}-2xe^{-x}???

???1=-c_2e^{-(0)}+0-1+2e^{-(0)}-2(0)e^{-(0)}???

???1=-c_2(1)-1+2(1)???

???1=-c_2+1???

???0=-c_2???

???0=c_2???

Plugging ???c_2=0??? into ???0=c_1+c_2??? to solve the system of linear equations gives

???0=c_1+0???

???0=c_1???

Plugging these values for ???c_1??? and ???c_2??? back into the general solution gives

???Y(x)=0+(0)e^{-x}+\frac12x^2-x+2xe^{-x}???

???Y(x)=\frac12x^2-x+2xe^{-x}???


Get access to the complete Differential Equations course