Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

For example, to solve:

y+y=0.001x2,y(0)=0,y(0)=1.5y'' + y = 0.001 x^2, \quad y(0) = 0, \quad y'(0) = 1.5

Use the following steps:

  1. Find yhy_{\rm h}:

    yh+yh=0λ2+1=0\begin{align} y_{\rm h}'' + y_{\rm h} &= 0 \\ \lambda^2 + 1 &= 0 \end{align}

    so λ=±i\lambda = \pm i and

    yh=c1cosx+c2sinxy_{\rm h} = c_1 \cos x +c_2 \sin x
  2. Guess ypy_{\rm p} and solve for undetermined coefficients:

    yp=k2x2+k1x+k0yp=2k2x+k1yp=2k2\begin{align} y_{p} &= k_2 x^2 + k_1 x + k_0 \\ y_{\rm p}' &= 2k_2 x + k_1 \\ y_{\rm p}'' &= 2k_2 \end{align}

    So

    yp+yp=2k2+k2x2+k1x+k0=0.001x2y_{\rm p}'' + y_{p} = 2 k_2 + k_2 x^2 + k_1 x + k_0 = 0.001x^2

    Equating coefficients of like powers of x gives the system

    k2=0.001k1=02k2+k0=0\begin{align} k_2 &= 0.001 \\ k_1 &= 0 \\ 2k_2 + k_0 &= 0 \\ \end{align}

    which gives k0=0.002k_0 = -0.002.

  3. Combine solutions and solve IVP.

    The general solution and its first derivative are:

    y=yh+yp=c1cosx+c2sinx+0.001x20.002y=c1sinx+c2cosx+0.002x\begin{align} y &= y_{\rm h} + y_{\rm p} = c_1 \cos x + c_2 \sin x + 0.001x^2 - 0.002 \\ y' &= -c_1 \sin x + c_2 \cos x + 0.002x \end{align}

    Substituting in the first boundary condition:

    y(0)=c10.002=0y(0)=c2=1.5\begin{align} y(0) &= c_1 - 0.002 = 0\\ y'(0) &= c_2 = 1.5 \end{align}

    Hence, c1=0.002c_1 = 0.002, c2=1.5c_2 = 1.5, and

    y=0.002cosx+1.5sinx+0.001x20.002y = 0.002 \cos x + 1.5 \sin x + 0.001x^2 - 0.002

As a more complex example, let’s find the form of the particular solution for:

y+3y+2.25y=10e1.5x+cosxy'' + 3y' + 2.25y = -10e^-1.5x + \cos x
  1. Find yhy_{\rm h}:

    yh+3yh+2.25yh=0λ2+3λ+2.25=0(λ+1.5)2=0\begin{align} y_{\rm h}''+3y_{\rm h}'+2.25y_{\rm h} &= 0 \\ \lambda^2 +3\lambda+2.25 = 0 \\ (\lambda+1.5)^2 &= 0 \\ \end{align}

    so λ=1.5\lambda = -1.5. This is a real repeated root, so

    yh=(c1+c2x)e1.5xy_{\rm h} = (c_1 + c_2 x)e^{-1.5x}
  2. Guess ypy_{\rm p}:

    We should add guesses for both terms in r. Our first term is an exponential, but it needs to be multiplied by x2x^2 because it is the same as the homogeneous solution, which is a real repeated root. Our second term is a sum of cosine and sine.

    yp=k1x2e1.5x+(k2cosx+k3sinx)\begin{align} y_{\rm p} = k_1 x^2 e^{-1.5 x} + (k_2 \cos x +k_3 \sin x) \end{align}

Skill builder problems

Solve:

Solution to Exercise 1
  1. Find homogeneous solution yhy_{\rm h}:

    yh+3yh+2yh=0λ2+3λ+2=0(λ+1)(λ+2)=0\begin{align} y_{\rm h}'' + 3y_{\rm h}' + 2y_{\rm h} &= 0 \\ \lambda^{2} + 3\lambda + 2 &= 0 \\ (\lambda + 1)(\lambda + 2) &= 0 \end{align}

    so λ1=1\lambda_1 = -1 and λ2=2\lambda_2 = -2. Then,

    yh=c1ex+c2e2xy_{\rm h} = c_1 e^{x} + c_2 e^{-2x}
  2. Find particular solution ypy_{\rm p}:

    yp=ke2xyp=2ke2xyp=4ke2x\begin{align} y_{\rm p} &= ke^{2x} \\ y_{\rm p}' &= 2ke^{2x} \\ y_{\rm p}'' &= 4ke^{2x} \end{align}

    Combine and solve for k:

    4ke2xe2x+6ke2xe2x+2ke2xe2x=30e2xe2x12k=30\begin{align} 4ke^{2x} e^{2x} &+ 6ke^{2x} e^{2x} + 2ke^{2x} e^{2x} = 30e^2x e^{2x} \\ 12k &= 30 \end{align}

    so k=5/2k = 5/2 and

    yp=52e2xy_{\rm p} = \frac{5}{2} e^{2x}
  3. Combine and apply initial conditions:

    The general solution and its first derivative are

    y=c1ex+c2e2x+52e2xy=c1ex2c2e2x+5e2x\begin{align} y &= c_1 e^{-x} + c_2 e^-{2x} + \frac{5}{2} e^{2x} \\ y' &= -c_1 e^{-x} - 2c_2 e^{-2x} + 5e^{2x} \end{align}

    Plugging in initial conditions

    y(0)=c1+c2+52=1y(0)=c12c2+5=0\begin{align} y(0) &= c_1 + c_2 + \frac{5}{2} = 1 \\ y'(0) &= -c_1 - 2c_2 + 5 = 0 \end{align}

    This is a system of linear equations:

    c1+c2=32c1+2c2=5\begin{align} c_1 + c_2 &= -\frac{3}{2} \\ c_1 + 2c_2 &= 5 \\ \end{align}

    that can be solved to give c1=8c_1 = -8 and c2=13/2c_2 = 13/2.

The final solution is:

y=8ex+132e2x=52e2xy = -8e^{-x} + \frac{13}{2} e^{-2x} = \frac{5}{2} e^{2x}
Solution to Exercise 2
  1. Find homogeneous solution yhy_{\rm h}:

    yh+4yh=0λ2+4=0\begin{align} y_{\rm h}'' + 4y_{\rm h} &= 0 \\ \lambda^{2} + 4 &= 0 \\ \end{align}

    so λ1,2=±2i\lambda_{1,2} = \pm 2i and

    yh=c1cos2x+c2sin2xy_{\rm h} = c_1 \cos 2x + c_2 \sin 2x
  2. Find the particular solution ypy_{\rm p}:

    yp=x(k1cos2x+k2sin2x)yp=x(2k1sin2x+2k2cos2x)+(k1cos2x+k2sin2x)yp=x(4k1cos2x4k2sin2x)+2(2k1sin2x+2k2cos2x)\begin{align} y_{\rm p} &= x(k_1 \cos 2x + k_2 \sin 2x) \\ y_{\rm p}' &= x(-2k_1 \sin 2x + 2k_2 \cos 2x) + (k_1 \cos 2x + k_2 \sin 2x) \\ y_{\rm p}'' &= x(-4k_1 \cos 2x - 4k_2 \sin 2x) + 2(-2k_1 \sin 2x + 2k_2 \cos 2x) \end{align}

    Combine:

    yp+4yp=2(2k1sin2x+2k2cos2x)=16cos2xy_{\rm p}'' + 4y_{\rm p} = 2(-2k_1 \sin 2x + 2k_2 \cos 2x) = 16\cos 2x

    Comparing terms gives k1=0k_1 = 0 and k2=4k_2 = 4.

  3. Combine and apply initial conditions:

    The general solution and its first derivative are

    y=c1cos2x+c2sin2x+4xsin2xy=2c1sin2x+2c2cos2x+4x(2cos2x)+4sin2x\begin{align} y &= c_1 \cos 2x + c_2 \sin 2x + 4x \sin 2x \\ y' &= -2c_1 \sin 2x + 2c_2 \cos 2x + 4x(2 \cos 2x) + 4 \sin 2x \end{align}

    Plugging in the initial conditions:

    y(0)=c1=0y(0)=2c2=0\begin{align} y(0) &= c_1 = 0 \\ y'(0) &= 2c_2 = 0 \end{align}

    gives c1=0c_1 = 0 and c2=0c_2 = 0.

The final solution is:

y=4xsin2xy = 4x \sin 2x
Solution to Exercise 3
  1. Find homogeneous solution yhy_{\rm h}:

    yhyh12yh=0λ2λ12=0(λ4)(λ+3)=0\begin{align} y_{\rm h}'' - y_{\rm h}' - 12y_{\rm h} &= 0 \lambda^2 - \lambda - 12 &= 0 (\lambda - 4)(\lambda + 3) &= 0 \end{align}

    so λ1=4\lambda_1 = 4, λ2=3\lambda_2 = -3, and

    yh=c1e4x+c2e3xy_{\rm h} = c_1 e^{4x} + c_2 e^{-3x}
  2. Find the particular solution ypy_{\rm p}:

    yp=k1x3+k2x2+k3x+k4yp=3k1x2+2k2x+k3yp=6k1x+2k2\begin{align} y_{\rm p} &= k_1 x^3 + k_2 x^2 + k_3 x + k_4 \\ y_{\rm p}' &= 3k_1x^2 + 2k_2x + k_3 \\ y_{\rm p}'' &= 6k_1x + 2k_2 \end{align}

    Substitute in ODE and combine:

    ypyp12yp=(6k1x+2k2)(3k1x2+2k2x+k3)12(k1x3+k2x2+k3x+k4)=12k1x3+(3k112k2)x2+(6k12k212k3)x+(2k2k312k4)\begin{align} & y_{\rm p}'' - y_{\rm p}' - 12y_{\rm p} \\ &= (6k_1x + 2k_2) - (3k_1x^2 + 2k_2x + k_3) - 12(k_1x^3 + k_2x^2 + k_3x + k_4) \\ &= -12k_1x^3 + (-3k_1 - 12k_2)x^2 + (6k_1 - 2k_2 - 12k_3)x + (2k_2 - k_3 - 12k_4) \end{align}

    Comparing coefficients of powers of x gives:

    12k1=1443k112k2=03612k2=06k12k212k3=02k2k312k4=252\begin{align} -12k_1 &= 144 \\ -3k_1 - 12k_2 &= 0 \\ 36 - 12k_2 &= 0 \\ 6k_1 - 2k_2 - 12k_3 &= 0 \\ 2k_2 - k_3 - 12k_4 &= \frac{25}{2} \end{align}

    Solving this system of linear equations gives k1=12k_1 = -12, k2=3k_2 = 3, k3=13/2k_3 = -13/2, and k4=0k_4 = 0, so:

    yp=12x3+3x2132xy_{\rm p} = -12x_3 + 3x^2 - \frac{13}{2}x
  3. Combine and apply boundary conditions:

    The general solution and its first derivative are

    y=c1e4x+c2e3x12x3+3x2132xy=4c1e4x3c2e3X36x2+6x132\begin{align} y &= c_1 e^{4x} + c_2 e^{-3x} - 12x^3 + 3x^2 - \frac{13}{2}x \\ y' &= 4c_1 e^{4x} - 3c_2e^{-3X} - 36x^2 + 6x - \frac{13}{2} \end{align}

    Plugging in the initial conditions:

    y(0)=c1+c2=5y(0)=4c13c2132=12\begin{align} y(0) &= c_1 + c_2 = 5 \\ y'(0) &= 4c_1 - 3c_2 - \frac{13}{2} = -\frac{1}{2} \end{align}

    Solve using matrices:

    [115436]R14R1[1150714]R1÷7[115012]R2R1[103012]\begin{align} \begin{bmatrix} 1 & 1 & 5 \\ 4 & -3 & 6 \end{bmatrix} \begin{matrix} \vphantom{R_1} \\ -4 R_1 \end{matrix} &\to \begin{bmatrix} 1 & 1 & 5 \\ 0 & -7 & 14 \end{bmatrix} \begin{matrix} \vphantom{R_1} \\ \div -7 \end{matrix} \\ &\to \begin{bmatrix} 1 & 1 & 5 \\ 0 & 1 & 2 \end{bmatrix} \begin{matrix} -R_2 \\ \vphantom{R_1} \end{matrix} \\ &\to \begin{bmatrix} 1 & 0 & 3 \\ 0 & 1 & 2 \end{bmatrix} \end{align}

    so c1=3c_1 = 3 and c2=2c_2 = 2. The final solution is:

    y=3e4x+2e3x12x3+3x2132xy = 3e^{4x} + 2e^{-3x} - 12x^3 + 3x^2 - \frac{13}{2}x