Javascript required
Skip to content Skip to sidebar Skip to footer

How to Find Particular Solution of Second Order Differential Equation

17.2: Nonhomogeneous Linear Equations

  1. Last updated
  2. Save as PDF
  • Page ID
    2627
    • Professor (Mathematics) at Massachusetts Institute of Technology (Strang) & University of Wisconsin-Stevens Point (Herman)
    • Publisher: OpenStax CNX

    Learning Objectives

    • Write the general solution to a nonhomogeneous differential equation.
    • Solve a nonhomogeneous differential equation by the method of undetermined coefficients.
    • Solve a nonhomogeneous differential equation by the method of variation of parameters.

    In this section, we examine how to solve nonhomogeneous differential equations. The terminology and methods are different from those we used for homogeneous equations, so let's start by defining some new terms.

    General Solution to a Nonhomogeneous Linear Equation

    Consider the nonhomogeneous linear differential equation

    \[a_2(x)y″+a_1(x)y′+a_0(x)y=r(x). \nonumber\]

    The associated homogeneous equation

    \[a_2(x)y″+a_1(x)y′+a_0(x)y=0 \nonumber\]

    is called the complementary equation. We will see that solving the complementary equation is an important step in solving a nonhomogeneous differential equation.

    Definition: particular solution

    A solution \(y_p(x)\) of a differential equation that contains no arbitrary constants is called a particular solution to the equation.

    GENERAL Solution TO A NONHOMOGENEOUS EQUATION

    Let \(y_p(x)\) be any particular solution to the nonhomogeneous linear differential equation

    \[a_2(x)y″+a_1(x)y′+a_0(x)y=r(x).\]

    Also, let \(c_1y_1(x)+c_2y_2(x)\) denote the general solution to the complementary equation. Then, the general solution to the nonhomogeneous equation is given by

    \[y(x)=c_1y_1(x)+c_2y_2(x)+y_p(x).\]

    Proof

    To prove \(y(x)\) is the general solution, we must first show that it solves the differential equation and, second, that any solution to the differential equation can be written in that form. Substituting \(y(x)\) into the differential equation, we have

    \[\begin{align*}a_2(x)y″+a_1(x)y′+a_0(x)y &=a_2(x)(c_1y_1+c_2y_2+y_p)″+a_1(x)(c_1y_1+c_2y_2+y_p)′  \\ &\;\;\;\; +a_0(x)(c_1y_1+c_2y_2+y_p)  \\[4pt] &=[a_2(x)(c_1y_1+c_2y_2)″+a_1(x)(c_1y_1+c_2y_2)′+a_0(x)(c_1y_1+c_2y_2)] \\ &\;\;\;\; +a_2(x)y_p″+a_1(x)y_p′+a_0(x)y_p \\[4pt] &=0+r(x) \\[4pt] &=r(x).  \end{align*}\]

    So \(y(x)\) is a solution.

    Now, let \(z(x)\) be any solution to \(a_2(x)y''+a_1(x)y′+a_0(x)y=r(x).\) Then

    \[\begin{align*}a_2(x)(z−y_p)″+a_1(x)(z−y_p)′+a_0(x)(z−y_p) &=(a_2(x)z″+a_1(x)z′+a_0(x)z) \\ &\;\;\;\;−(a_2(x)y_p″+a_1(x)y_p′+a_0(x)y_p)  \\[4pt] &=r(x)−r(x) \\[4pt] &=0, \end{align*}\]

    so \(z(x)−y_p(x)\) is a solution to the complementary equation. But, \(c_1y_1(x)+c_2y_2(x)\) is the general solution to the complementary equation, so there are constants \(c_1\) and \(c_2\) such that

    \[z(x)−y_p(x)=c_1y_1(x)+c_2y_2(x). \nonumber \]

    Hence, we see that

    \[z(x)=c_1y_1(x)+c_2y_2(x)+y_p(x). \nonumber \]

    Example \(\PageIndex{1}\): Verifying the General Solution

    Given that \(y_p(x)=x\) is a particular solution to the differential equation \(y″+y=x,\) write the general solution and check by verifying that the solution satisfies the equation.

    Solution

    The complementary equation is \(y″+y=0,\) which has the general solution \(c_1 \cos x+c_2 \sin x.\) So, the general solution to the nonhomogeneous equation is

    \[y(x)=c_1 \cos x+c_2 \sin x+x. \nonumber \]

    To verify that this is a solution, substitute it into the differential equation. We have

    \[y′(x)=−c_1 \sin x+c_2 \cos x+1 \nonumber \]

    and

    \[y″(x)=−c_1 \cos x−c_2 \sin x. \nonumber \]

    Then

    \[\begin{align*} y″(x)+y(x) &=−c_1 \cos x−c_2 \sin x+c_1 \cos x+c_2 \sin x+x \\[4pt] &=x.\end{align*} \]

    So, \(y(x)\) is a solution to \(y″+y=x\).

    Exercise \(\PageIndex{1}\)

    Given that \(y_p(x)=−2\) is a particular solution to \(y″−3y′−4y=8,\) write the general solution and verify that the general solution satisfies the equation.

    Hint

    Find the general solution to the complementary equation.

    Answer

    \(y(x)=c_1e^{−x}+c_2e^{4x}−2\)

    In the preceding section, we learned how to solve homogeneous equations with constant coefficients. Therefore, for nonhomogeneous equations of the form \(ay″+by′+cy=r(x)\), we already know how to solve the complementary equation, and the problem boils down to finding a particular solution for the nonhomogeneous equation. We now examine two techniques for this: the method of undetermined coefficients and the method of variation of parameters.

    Undetermined Coefficients

    The method of undetermined coefficients involves making educated guesses about the form of the particular solution based on the form of \(r(x)\). When we take derivatives of polynomials, exponential functions, sines, and cosines, we get polynomials, exponential functions, sines, and cosines. So when \(r(x)\) has one of these forms, it is possible that the solution to the nonhomogeneous differential equation might take that same form. Let's look at some examples to see how this works.

    Example \(\PageIndex{2}\): Undetermined Coefficients When \(r(x)\) Is a Polynomial

    Find the general solution to \(y″+4y′+3y=3x\).

    Solution

    The complementary equation is \(y″+4y′+3y=0\), with general solution \(c_1e^{−x}+c_2e^{−3x}\). Since \(r(x)=3x\), the particular solution might have the form \(y_p(x)=Ax+B\). If this is the case, then we have \(y_p′(x)=A\) and \(y_p″(x)=0\). For \(y_p\) to be a solution to the differential equation, we must find values for \(A\) and \(B\) such that

    \[\begin{align*} y″+4y′+3y &=3x \\[4pt] 0+4(A)+3(Ax+B) &=3x  \\[4pt] 3Ax+(4A+3B) &=3x. \nonumber \end{align*} \]

    Setting coefficients of like terms equal, we have

    \[\begin{align*} 3A &=3 \\ 4A+3B &=0. \end{align*} \]

    Then, \(A=1\) and \(B=−\frac{4}{3}\), so \(y_p(x)=x−\frac{4}{3}\) and the general solution is

    \[y(x)=c_1e^{−x}+c_2e^{−3x}+x−\frac{4}{3}. \nonumber \]

    In Example \(\PageIndex{2}\), notice that even though \(r(x)\) did not include a constant term, it was necessary for us to include the constant term in our guess. If we had assumed a solution of the form \(y_p=Ax\) (with no constant term), we would not have been able to find a solution. (Verify this!) If the function \(r(x)\) is a polynomial, our guess for the particular solution should be a polynomial of the same degree, and it must include all lower-order terms, regardless of whether they are present in \(r(x)\).

    Example \(\PageIndex{3}\): Undetermined Coefficients When \(r(x)\) Is an Exponential

    Find the general solution to \(y″−y′−2y=2e^{3x}\).

    Solution

    The complementary equation is \(y″−y′−2y=0\), with the general solution \(c_1e^{−x}+c_2e^{2x}\). Since \(r(x)=2e^{3x}\), the particular solution might have the form \(y_p(x)=Ae^{3x}.\) Then, we have \(yp′(x)=3Ae^{3x}\) and \(y_p″(x)=9Ae^{3x}\). For \(y_p\) to be a solution to the differential equation, we must find a value for \(A\) such that

    \[\begin{align*} y″−y′−2y &=2e^{3x} \\[4pt] 9Ae^{3x}−3Ae^{3x}−2Ae^{3x} &=2e^{3x} \\[4pt] 4Ae^{3x} &=2e^{3x}. \end{align*} \]

    So, \(4A=2\) and \(A=1/2\). Then, \(y_p(x)=(\frac{1}{2})e^{3x}\), and the general solution is

    \[y(x)=c_1e^{−x}+c_2e^{2x}+\dfrac{1}{2}e^{3x}. \nonumber\]

    Exercise \(\PageIndex{3}\)

    Find the general solution to \(y″−4y′+4y=7 \sin t− \cos t.\)

    Hint

    Use \(y_p(t)=A \sin t+B \cos t \) as a guess for the particular solution.

    Answer

    \(y(t)=c_1e^{2t}+c_2te^{2t}+ \sin t+ \cos t \)

    In the previous checkpoint, \(r(x)\) included both sine and cosine terms. However, even if \(r(x)\) included a sine term only or a cosine term only, both terms must be present in the guess. The method of undetermined coefficients also works with products of polynomials, exponentials, sines, and cosines. Some of the key forms of \(r(x)\) and the associated guesses for \(y_p(x)\) are summarized in Table \(\PageIndex{1}\).

    Table \(\PageIndex{1}\): Key Forms for the Method of Undetermined Coefficients
    \(r(x)\) Initial guess for \(y_p(x)\)
    \(k\) (a constant) \(A\) (a constant)
    \(ax+b\) \(Ax+B\) (Note: The guess must include both terms even if \(b=0\).)
    \(ax^2+bx+c\) \(Ax^2+Bx+C\) (Note: The guess must include all three terms even if \(b\) or \(c\) are zero.)
    Higher-order polynomials Polynomial of the same order as \(r(x)\)
    \(ae^{λx}\) \(Ae^{λx}\)
    \(a \cos βx+b \sin βx\) \(A \cos βx+B \sin βx\) (Note: The guess must include both terms even if either \(a=0\) or \(b=0.\))
    \(ae^{αx} \cos βx+be^{αx} \sin βx\) \(Ae^{αx} \cos βx+Be^{αx} \sin βx\)
    \((ax^2+bx+c)e^{λx}\) \((Ax^2+Bx+C)e^{λx}\)
    \((a_2x^2+a_1x+a0) \cos βx \\ +(b_2x^2+b_1x+b_0) \sin βx\) \((A_2x^2+A_1x+A_0) \cos βx \\ +(B_2x^2+B_1x+B_0) \sin βx \)
    \((a_2x^2+a_1x+a_0)e^{αx} \cos βx \\ +(b_2x^2+b_1x+b_0)e^{αx} \sin βx \) \((A_2x^2+A_1x+A_0)e^{αx} \cos βx \\ +(B_2x^2+B_1x+B_0)e^{αx} \sin βx \)

    Keep in mind that there is a key pitfall to this method. Consider the differential equation \(y″+5y′+6y=3e^{−2x}\). Based on the form of \(r(x)\), we guess a particular solution of the form \(y_p(x)=Ae^{−2x}\). But when we substitute this expression into the differential equation to find a value for \(A\),we run into a problem. We have

    \[y_p′(x)=−2Ae^{−2x} \nonumber\]

    and

    \[y_p''=4Ae^{−2x}, \nonumber\]

    so we want

    \[\begin{align*} y″+5y′+6y &=3e^{−2x} \\[4pt] 4Ae^{−2x}+5(−2Ae^{−2x})+6Ae^{−2x} &=3e^{−2x}  \\[4pt] 4Ae^{−2x}−10Ae^{−2x}+6Ae^{−2x} &=3e^{−2x}  \\[4pt] 0 &=3e^{−2x}, \end{align*}\]

    which is not possible.

    Looking closely, we see that, in this case, the general solution to the complementary equation is \(c_1e^{−2x}+c_2e^{−3x}.\) The exponential function in \(r(x)\) is actually a solution to the complementary equation, so, as we just saw, all the terms on the left side of the equation cancel out. We can still use the method of undetermined coefficients in this case, but we have to alter our guess by multiplying it by \(x\). Using the new guess, \(y_p(x)=Axe^{−2x}\), we have

    \[y_p′(x)=A(e^{−2x}−2xe^{−2x} \nonumber\]

    and

    \[y_p''(x)=−4Ae^{−2x}+4Axe^{−2x}. \nonumber\]

    Substitution gives

    \[\begin{align*}y″+5y′+6y &=3e^{−2x}  \\[4pt] (−4Ae^{−2x}+4Axe^{−2x})+5(Ae^{−2x}−2Axe^{−2x})+6Axe^{−2x} &=3e^{−2x} \\[4pt]−4Ae^{−2x}+4Axe^{−2x}+5Ae^{−2x}−10Axe^{−2x}+6Axe^{−2x} &=3e^{−2x} \\[4pt]  Ae^{−2x} &=3e^{−2x}.\end{align*}\]

    So, \(A=3\) and \(y_p(x)=3xe^{−2x}\). This gives us the following general solution

    \[y(x)=c_1e^{−2x}+c_2e^{−3x}+3xe^{−2x}. \nonumber\]

    Note that if \(xe^{−2x}\) were also a solution to the complementary equation, we would have to multiply by \(x\) again, and we would try \(y_p(x)=Ax^2e^{−2x}\).

    PROBLEM-SOLVING STRATEGY: METHOD OF UNDETERMINED COEFFICIENTS

    1. Solve the complementary equation and write down the general solution.
    2. Based on the form of \(r(x)\), make an initial guess for \(y_p(x)\).
    3. Check whether any term in the guess for\(y_p(x)\) is a solution to the complementary equation. If so, multiply the guess by \(x.\) Repeat this step until there are no terms in \(y_p(x)\) that solve the complementary equation.
    4. Substitute \(y_p(x)\) into the differential equation and equate like terms to find values for the unknown coefficients in \(y_p(x)\).
    5. Add the general solution to the complementary equation and the particular solution you just found to obtain the general solution to the nonhomogeneous equation.

    Example \(\PageIndex{3}\): Solving Nonhomogeneous Equations

    Find the general solutions to the following differential equations.

    1. \(y''−9y=−6 \cos 3x\)
    2. \(x″+2x′+x=4e^{−t}\)
    3. \(y″−2y′+5y=10x^2−3x−3\)
    4. \(y''−3y′=−12t\)

    Solution

    1. The complementary equation is \(y″−9y=0\), which has the general solution \(c_1e^{3x}+c_2e^{−3x}\)(step 1). Based on the form of \(r(x)=−6 \cos 3x,\) our initial guess for the particular solution is \(y_p(x)=A \cos 3x+B \sin 3x\) (step 2). None of the terms in \(y_p(x)\) solve the complementary equation, so this is a valid guess (step 3).
      Now we want to find values for \(A\) and \(B,\) so substitute \(y_p\) into the differential equation. We have

      \[y_p′(x)=−3A \sin 3x+3B \cos 3x \text{ and } y_p″(x)=−9A \cos 3x−9B \sin 3x, \nonumber\]

      so we want to find values of \(A\) and \(B\) such that

      \[\begin{align*}y″−9y &=−6 \cos 3x \\[4pt] −9A \cos 3x−9B \sin 3x−9(A \cos 3x+B \sin 3x) &=−6 \cos 3x \\[4pt] −18A \cos 3x−18B \sin 3x &=−6 \cos 3x. \end{align*}\]

      Therefore,

      \[\begin{align*}−18A &=−6 \\[4pt] −18B &=0. \end{align*}\]

      This gives \(A=\frac{1}{3}\) and \(B=0,\) so \(y_p(x)=(\frac{1}{3}) \cos 3x\) (step 4).
      Putting everything together, we have the general solution

      \[y(x)=c_1e^{3x}+c_2e^{−3x}+\dfrac{1}{3} \cos 3x.\nonumber\]

    2. The complementary equation is \(x''+2x′+x=0,\) which has the general solution \(c_1e^{−t}+c_2te^{−t}\) (step 1). Based on the form \(r(t)=4e^{−t}\), our initial guess for the particular solution is \(x_p(t)=Ae^{−t}\) (step 2). However, we see that this guess solves the complementary equation, so we must multiply by \(t,\) which gives a new guess: \(x_p(t)=Ate^{−t}\) (step 3). Checking this new guess, we see that it, too, solves the complementary equation, so we must multiply by t again, which gives \(x_p(t)=At^2e^{−t}\) (step 3 again). Now, checking this guess, we see that \(x_p(t)\) does not solve the complementary equation, so this is a valid guess (step 3 yet again).
      We now want to find a value for \(A\), so we substitute \(x_p\) into the differential equation. We have

      \[\begin{align*}x_p(t) &=At^2e^{−t}, \text{ so} \\[4pt] x_p′(t) &=2Ate^{−t}−At^2e^{−t} \end{align*}\]

      and \[x_p″(t)=2Ae^{−t}−2Ate^{−t}−(2Ate^{−t}−At^2e^{−t})=2Ae^{−t}−4Ate^{−t}+At^2e^{−t}. \nonumber\]
      Substituting into the differential equation, we want to find a value of \(A\) so that

      \[\begin{align*} x″+2x′+x &=4e^{−t} \\[4pt] 2Ae^{−t}−4Ate^{−t}+At^2e^{−t}+2(2Ate^{−t}−At^2e^{−t})+At^2e^{−t} &=4e^{−t} \\[4pt] 2Ae^{−t}&=4e^{−t}. \end{align*} \]

      This gives \(A=2\), so \(x_p(t)=2t^2e^{−t}\) (step 4). Putting everything together, we have the general solution

      \[x(t)=c_1e^{−t}+c_2te^{−t}+2t^2e^{−t}.\nonumber\]

    3. The complementary equation is \(y″−2y′+5y=0\), which has the general solution \(c_1e^x \cos 2x+c_2 e^x \sin 2x\) (step 1). Based on the form \(r(x)=10x^2−3x−3\), our initial guess for the particular solution is \(y_p(x)=Ax^2+Bx+C\) (step 2). None of the terms in \(y_p(x)\) solve the complementary equation, so this is a valid guess (step 3). We now want to find values for \(A\), \(B\), and \(C\), so we substitute \(y_p\) into the differential equation. We have \(y_p′(x)=2Ax+B\) and \(y_p″(x)=2A\), so we want to find values of \(A\), \(B\), and \(C\) such that

      \[\begin{align*}y″−2y′+5y &=10x^2−3x−3 \\[4pt] 2A−2(2Ax+B)+5(Ax^2+Bx+C) &=10x^2−3x−3 \\[4pt] 5Ax^2+(5B−4A)x+(5C−2B+2A) &=10x^2−3x−3. \end{align*}\]

      Therefore,

      \[\begin{align*} 5A &=10 \\[4pt] 5B−4A &=−3 \\[4pt] 5C−2B+2A &=−3. \end{align*}\]

      This gives \(A=2\), \(B=1\), and \(C=−1\), so \(y_p(x)=2x^2+x−1\) (step 4). Putting everything together, we have the general solution

      \[y(x)=c_1e^x \cos 2x+c_2e^x \sin 2x+2x^2+x−1.\nonumber\]

    4. The complementary equation is \(y″−3y′=0\), which has the general solution \(c_1e^{3t}+c_2\) (step 1). Based on the form r(t)=−12t,r(t)=−12t, our initial guess for the particular solution is \(y_p(t)=At+B\) (step 2). However, we see that the constant term in this guess solves the complementary equation, so we must multiply by \(t\), which gives a new guess: \(y_p(t)=At^2+Bt\) (step 3). Checking this new guess, we see that none of the terms in \(y_p(t)\) solve the complementary equation, so this is a valid guess (step 3 again). We now want to find values for \(A\) and \(B,\) so we substitute \(y_p\) into the differential equation. We have \(y_p′(t)=2At+B\) and \(y_p″(t)=2A\), so we want to find values of AA and BB such that

      \[\begin{align*}y″−3y′ &=−12t \\[4pt] 2A−3(2At+B) &=−12t \\[4pt] −6At+(2A−3B) &=−12t. \end{align*}\]

      Therefore,

      \[\begin{align*}−6A &=−12 \\[4pt] 2A−3B &=0. \end{align*}\]

      This gives \(A=2\) and \(B=4/3\), so \(y_p(t)=2t^2+(4/3)t\) (step 4). Putting everything together, we have the general solution

      \[y(t)=c_1e^{3t}+c_2+2t^2+\dfrac{4}{3}t.\nonumber\]

    Exercise \(\PageIndex{3}\)

    Find the general solution to the following differential equations.

    1. \(y″−5y′+4y=3e^x\)
    2. \(y″+y′−6y=52 \cos 2t \)
    Hint

    Use the problem-solving strategy.

    Answer a

    \(y(x)=c_1e^{4x}+c_2e^x−xe^x\)

    Answer b

    \(y(t)=c_1e^{−3t}+c_2e^{2t}−5 \cos 2t+ \sin 2t\)

    Variation of Parameters

    Sometimes, \(r(x)\) is not a combination of polynomials, exponentials, or sines and cosines. When this is the case, the method of undetermined coefficients does not work, and we have to use another approach to find a particular solution to the differential equation. We use an approach called the method of variation of parameters.

    To simplify our calculations a little, we are going to divide the differential equation through by \(a,\) so we have a leading coefficient of 1. Then the differential equation has the form

    \[y″+py′+qy=r(x),\]

    where \(p\) and \(q\) are constants.

    If the general solution to the complementary equation is given by \(c_1y_1(x)+c_2y_2(x)\), we are going to look for a particular solution of the form

    \[y_p(x)=u(x)y_1(x)+v(x)y_2(x).\]

    In this case, we use the two linearly independent solutions to the complementary equation to form our particular solution. However, we are assuming the coefficients are functions of \(x\), rather than constants. We want to find functions \(u(x)\) and \(v(x)\) such that \(y_p(x)\) satisfies the differential equation. We have

    \[\begin{align*}y_p &=uy_1+vy_2 \\[4pt] y_p′ &=u′y_1+uy_1′+v′y_2+vy_2′ \\[4pt] y_p″ &=(u′y_1+v′y_2)′+u′y_1′+uy_1″+v′y_2′+vy_2″. \end{align*}\]

    Substituting into the differential equation, we obtain

    \[\begin{align*}y_p″+py_p′+qy_p &=[(u′y_1+v′y_2)′+u′y_1′+uy_1″+v′y_2′+vy_2″] \\ &\;\;\;\;+p[u′y_1+uy_1′+v′y_2+vy_2′]+q[uy_1+vy_2] \\[4pt] &=u[y_1″+p_y1′+qy_1]+v[y_2″+py_2′+qy_2] \\ &\;\;\;\; +(u′y_1+v′y_2)′+p(u′y_1+v′y_2)+(u′y_1′+v′y_2′). \end{align*}\]

    Note that \(y_1\) and \(y_2\) are solutions to the complementary equation, so the first two terms are zero. Thus, we have

    \[(u′y_1+v′y_2)′+p(u′y_1+v′y_2)+(u′y_1′+v′y_2′)=r(x).\]

    If we simplify this equation by imposing the additional condition \(u′y_1+v′y_2=0\), the first two terms are zero, and this reduces to \(u′y_1′+v′y_2′=r(x)\). So, with this additional condition, we have a system of two equations in two unknowns:

    \[\begin{align*} u′y_1+v′y_2 &= 0 \\[4pt] u′y_1′+v′y_2′ &=r(x). \end{align*}\]

    Solving this system gives us \(u′\) and \(v′\), which we can integrate to find \(u\) and \(v\).

    Then, \(y_p(x)=u(x)y_1(x)+v(x)y_2(x)\) is a particular solution to the differential equation. Solving this system of equations is sometimes challenging, so let's take this opportunity to review Cramer's rule, which allows us to solve the system of equations using determinants.

    RULE: CRAMER'S RULE

    The system of equations

    \[\begin{align*} a_1z_1+b_1z_2 &=r_1 \\[4pt] a_2z_1+b_2z_2 &=r_2 \end{align*}\]

    has a unique solution if and only if the determinant of the coefficients is not zero. In this case, the solution is given by

    \[z_1=\dfrac{\begin{array}{|ll|}r_1 b_1 \\ r_2 b_2 \end{array}}{\begin{array}{|ll|}a_1 b_1 \\ a_2 b_2 \end{array}} \; \; \; \; \; \text{and} \; \; \; \; \; z_2= \dfrac{\begin{array}{|ll|}a_1 r_1 \\ a_2 r_2 \end{array}}{\begin{array}{|ll|}a_1 b_1 \\ a_2 b_2 \end{array}}. \label{cramer}\]

    Example \(\PageIndex{4}\): Using Cramer's Rule

    Use Cramer's rule to solve the following system of equations.

    \[\begin{align*}x^2z_1+2xz_2 &=0 \\[4pt] z_1−3x^2z_2 &=2x \end{align*}\]

    Solution

    We have

    \[\begin{align*} a_1(x) &=x^2 \\[4pt] a_2(x) &=1 \\[4pt] b_1(x) &=2x \\[4pt] b_2(x) &=−3x^2 \\[4pt] r_1(x) &=0 \\[4pt] r_2(x) &=2x. \end{align*}\]

    Then,\[\begin{array}{|ll|}a_1 b_1 \\ a_2 b_2 \end{array}=\begin{array}{|ll|}x^2 2x \\ 1 −3x^2 \end{array}=−3x^4−2x \nonumber \]

    and

    \[\begin{array}{|ll|}r_1 b_1 \\ r_2 b_2 \end{array}=\begin{array}{|ll|}0 2x \\ 2x -3x^2 \end{array}=0−4x^2=−4x^2. \nonumber\]

    Thus,

    \[z1=\dfrac{\begin{array}{|ll|}r_1 b_1 \\ r_2 b_2 \end{array}}{\begin{array}{|ll|}a_1 b_1 \\ a_2 b_2 \end{array}}=\dfrac{−4x^2}{−3x^4−2x}=\dfrac{4x}{3x^3+2}. \nonumber\]

    In addition,

    \[\begin{array}{|ll|}a_1 r_1 \\ a_2 r_2 \end{array}=\begin{array}{|ll|} x^2 0 \\ 1 2x \end{array}=2x^3−0=2x^3. \nonumber\]

    Thus,

    \[z2=\dfrac{\begin{array}{|ll|}a_1 r_1 \\ a_2 r_2 \end{array}}{\begin{array}{|ll|}a_1 b_1 \\ a_2 b_2 \end{array}}=\dfrac{2x^3}{−3x^4−2x}=\dfrac{−2x^2}{3x^3+2}.\nonumber\]

    Exercise \(\PageIndex{4}\)

    Use Cramer's rule to solve the following system of equations.

    \[\begin{align*} 2xz_1−3z_2 &=0 \\[4pt] x^2z_1+4xz_2 &=x+1 \end{align*}\]

    Hint

    Use the process from the previous example.

    Answer

    \(z_1=\frac{3x+3}{11x^2}\),\( z_2=\frac{2x+2}{11x}\)

    PROBLEM-SOLVING STRATEGY: METHOD OF VARIATION OF PARAMETERS

    1. Solve the complementary equation and write down the general solution \[c_1y_1(x)+c_2y_2(x).\]
    2. Use Cramer's rule or another suitable technique to find functions \(u′(x)\) and \(v′(x)\) satisfying \[\begin{align*} u′y_1+v′y_2 &=0 \\[4pt] u′y_1′+v′y_2′ &=r(x). \end{align*}\]
    3. Integrate \(u′\) and \(v′\) to find \(u(x)\) and \(v(x)\). Then, \(y_p(x)=u(x)y_1(x)+v(x)y_2(x)\) is a particular solution to the equation.
    4. Add the general solution to the complementary equation and the particular solution found in step 3 to obtain the general solution to the nonhomogeneous equation.

    Example \(\PageIndex{5}\): Using the Method of Variation of Parameters

    Find the general solution to the following differential equations.

    1. \(y″−2y′+y=\dfrac{e^t}{t^2}\)
    2. \(y″+y=3 \sin ^2 x\)

    Solution

    1. The complementary equation is \(y″−2y′+y=0\) with associated general solution \(c_1e^t+c_2te^t\). Therefore, \(y_1(t)=e^t\) and \(y_2(t)=te^t\). Calculating the derivatives, we get \(y_1′(t)=e^t\) and \(y_2′(t)=e^t+te^t\) (step 1). Then, we want to find functions \(u′(t)\) and \(v′(t)\) so that

      \[\begin{align*} u′e^t+v′te^t &=0 \\[4pt] u′e^t+v′(e^t+te^t) &= \dfrac{e^t}{t^2}. \end{align*}\]

      Applying Cramer's rule (Equation \ref{cramer}), we have

      \[u′=\dfrac{\begin{array}{|lc|}0 te^t \\ \frac{e^t}{t^2} e^t+te^t \end{array}}{ \begin{array}{|lc|}e^t te^t \\ e^t e^t+te^t \end{array}} =\dfrac{0−te^t(\frac{e^t}{t^2})}{e^t(e^t+te^t)−e^tte^t}=\dfrac{−\frac{e^{2t}}{t}}{e^{2t}}=−\dfrac{1}{t} \nonumber\]

      and

      \[v′= \dfrac{\begin{array}{|ll|}e^t 0 \\ e^t \frac{e^t}{t^2} \end{array} }{\begin{array}{|lc|}e^t te^t \\ e^t e^t+te^t \end{array} } =\dfrac{e^t(\frac{e^t}{t^2})}{e^{2t}}=\dfrac{1}{t^2}\quad(\text{step 2}). \nonumber\]

      Integrating, we get

      \[\begin{align} u &=−\int \dfrac{1}{t}dt=− \ln|t| \\[4pt] v &=\int \dfrac{1}{t^2}dt=−\dfrac{1}{t} \tag{step 3} \end{align}\]

      Then we have

      \[\begin{align}y_p &=−e^t \ln|t|−\frac{1}{t}te^t \\[4pt] &=−e^t \ln |t|−e^t \tag{step 4}.\end{align}\]

      The \(e^t\) term is a solution to the complementary equation, so we don't need to carry that term into our general solution explicitly. The general solution is

      \[y(t)=c_1e^t+c_2te^t−e^t \ln |t| \tag{step 5}\]

    2. The complementary equation is \(y″+y=0\) with associated general solution \(c_1 \cos x+c_2 \sin x\). So, \(y_1(x)= \cos x\) and \(y_2(x)= \sin x\) (step 1). Then, we want to find functions \(u′(x)\) and \(v′(x)\) such that

      \[\begin{align*} u′ \cos x+v′ \sin x &=0 \\[4pt] −u′ \sin x+v′ \cos x &=3 \sin _2 x \end{align*}.\]

      Applying Cramer's rule, we have

      \[u′= \dfrac{\begin{array}{|cc|}0 \sin x \\ 3 \sin ^2 x \cos x \end{array}}{ \begin{array}{|cc|} \cos x \sin x \\ − \sin x \cos x \end{array}}=\dfrac{0−3 \sin^3 x}{ \cos ^2 x+ \sin ^2 x}=−3 \sin^3 x \nonumber\]

      and

      \[v′=\dfrac{\begin{array}{|cc|} \cos x 0 \\ - \sin x 3 \sin^2 x \end{array}}{ \begin{array}{|cc|} \cos x \sin x \\ − \sin x \cos x \end{array}}=\dfrac{ 3 \sin^2x \cos x}{ 1}=3 \sin^2 x \cos x( \text{step 2}). \nonumber\]

      Integrating first to find \(u,\) we get

      \[u=\int −3 \sin^3 x dx=−3 \bigg[ −\dfrac{1}{3} \sin ^2 x \cos x+\dfrac{2}{3} \int \sin x dx \bigg]= \sin^2 x \cos x+2 \cos x. \nonumber\]

      Now, we integrate to find \(v.\) Using substitution (with \(w= \sin x\)), we get

      \[v= \int 3 \sin ^2 x \cos x dx=\int 3w^2dw=w^3=sin^3x.\nonumber\]

      Then,

      \[\begin{align*}y_p &=(\sin^2 x \cos x+2 \cos x) \cos x+(\sin^3 x)\sin x \\[4pt] &=\sin_2 x \cos _2 x+2 \cos _2 x+ \sin _4x \\[4pt] &=2 \cos_2 x+ \sin_2 x(\cos^2 x+\sin ^2 x) & & (\text{step 4}). \\[4pt] &=2 \cos _2 x+\sin_2x \\[4pt] &= \cos _2 x+1 \end{align*}\]

      The general solution is

      \[y(x)=c_1 \cos x+c_2 \sin x+1+ \cos^2 x(\text{step 5}).\nonumber\]

    Exercise \(\PageIndex{5}\)

    Find the general solution to the following differential equations.

    1. \(y″+y= \sec x\)
    2. \(x″−2x′+x=\dfrac{e^t}{t}\)
    Hint

    Follow the problem-solving strategy.

    Answer a

    \(y(x)=c_1 \cos x+c_2 \sin x+ \cos x \ln| \cos x|+x \sin x\)

    Answer b

    \(x(t)=c_1e^t+c_2te^t+te^t \ln|t| \)

    Key Concepts

    • To solve a nonhomogeneous linear second-order differential equation, first find the general solution to the complementary equation, then find a particular solution to the nonhomogeneous equation.
    • Let \(y_p(x)\) be any particular solution to the nonhomogeneous linear differential equation \[a_2(x)y''+a_1(x)y′+a_0(x)y=r(x), \nonumber\] and let \(c_1y_1(x)+c_2y_2(x)\) denote the general solution to the complementary equation. Then, the general solution to the nonhomogeneous equation is given by \[y(x)=c_1y_1(x)+c_2y_2(x)+y_p(x). \nonumber\]
    • When \(r(x)\) is a combination of polynomials, exponential functions, sines, and cosines, use the method of undetermined coefficients to find the particular solution. To use this method, assume a solution in the same form as \(r(x)\), multiplying by x as necessary until the assumed solution is linearly independent of the general solution to the complementary equation. Then, substitute the assumed solution into the differential equation to find values for the coefficients.
    • When \(r(x)\) is not a combination of polynomials, exponential functions, or sines and cosines, use the method of variation of parameters to find the particular solution. This method involves using Cramer's rule or another suitable technique to find functions and \(v′(x)\) satisfying \[\begin{align*}u′y_1+v′y_2 &=0 \\[4pt] u′y_1′+v′y_2′ &=r(x). \end{align*}\] Then, \(y_p(x)=u(x)y_1(x)+v(x)y_2(x)\) is a particular solution to the differential equation.

    Key Equations

    • Complementary equation
      \(a_2(x)y″+a_1(x)y′+a_0(x)y=0\)
    • General solution to a nonhomogeneous linear differential equation
      \(y(x)=c_1y_1(x)+c_2y_2(x)+y_p(x)\)

    Glossary

    complementary equation
    for the nonhomogeneous linear differential equation \(a+2(x)y″+a_1(x)y′+a_0(x)y=r(x),\)the associated homogeneous equation, called the complementary equation, is \(a_2(x)y''+a_1(x)y′+a_0(x)y=0\)
    method of undetermined coefficients
    a method that involves making a guess about the form of the particular solution, then solving for the coefficients in the guess
    method of variation of parameters
    a method that involves looking for particular solutions in the form \(y_p(x)=u(x)y_1(x)+v(x)y_2(x)\), where \(y_1\) and \(y_2\) are linearly independent solutions to the complementary equations, and then solving a system of equations to find \(u(x)\) and \(v(x)\)
    particular solution
    a solution \(y_p(x)\) of a differential equation that contains no arbitrary constants

    Contributors and Attributions

    • Gilbert Strang (MIT) and Edwin "Jed" Herman (Harvey Mudd) with many contributing authors. This content by OpenStax is licensed with a CC-BY-SA-NC 4.0 license. Download for free at http://cnx.org.

    How to Find Particular Solution of Second Order Differential Equation

    Source: https://math.libretexts.org/Bookshelves/Calculus/Book%3A_Calculus_(OpenStax)/17%3A_Second-Order_Differential_Equations/17.2%3A_Nonhomogeneous_Linear_Equations