Class 12 Maths, Worked in Full Past papersGet updates
Chapter 9 · Differential Equations

Exercise 9.5 · Q1: Linear: dydx+2y=sin⁡x\frac{dy}{dx} + 2y = \sin x

Exercise 9.5Linear differential equations · Section 9.4.3
The question

For each of the differential equations given in Exercises 1 to 12, find the general solution:

1. dydx+2y=sin⁡x\dfrac{dy}{dx} + 2y = \sin x

Exam answer

This is of the form dydx+Py=Q\frac{dy}{dx} + Py = Q⁠, where P=2P = 2 and Q=sin⁡xQ = \sin x⁠.

I.F.=e∫2 dx=e2x\text{I.F.} = e^{\int 2\,dx} = e^{2x}

So the solution is given by

ye2x=∫e2xsin⁡x dx+C…(i)ye^{2x} = \int e^{2x}\sin x\,dx + C\quad\ldots(\text{i})

Let I=∫e2xsin⁡x dxI = \int e^{2x}\sin x\,dx⁠. Integrating by parts with sin⁡x\sin x as the first function,

I=sin⁡x⋅e2x2−∫cos⁡x⋅e2x2 dx\begin{aligned} I &= \sin x\cdot\frac{e^{2x}}{2} \\ &\quad - \int\cos x\cdot\frac{e^{2x}}{2}\,dx \end{aligned}

Again by parts, with cos⁡x\cos x as the first function,

I=e2xsin⁡x2−12[cos⁡x⋅e2x2+∫sin⁡x⋅e2x2 dx]=e2xsin⁡x2−e2xcos⁡x4−I4\begin{aligned} I &= \frac{e^{2x}\sin x}{2} \\ &\quad - \frac{1}{2}\bigg[\cos x\cdot\frac{e^{2x}}{2} \\ &\qquad + \int\sin x\cdot\frac{e^{2x}}{2}\,dx\bigg] \\ &= \frac{e^{2x}\sin x}{2} - \frac{e^{2x}\cos x}{4} \\ &\quad - \frac{I}{4} \end{aligned} 54I=e2x(2sin⁡x−cos⁡x)4I=e2x(2sin⁡x−cos⁡x)5\begin{aligned} \frac{5}{4}I &= \frac{e^{2x}(2\sin x - \cos x)}{4} \\ I &= \frac{e^{2x}(2\sin x - \cos x)}{5} \end{aligned}

Putting the value of II in (i),

ye2x=e2x(2sin⁡x−cos⁡x)5+C\begin{aligned} ye^{2x} &= \frac{e^{2x}(2\sin x - \cos x)}{5} \\ &\quad + C \end{aligned}

Dividing by e2xe^{2x}⁠,

∴\therefore y=15(2sin⁡x−cos⁡x)y = \dfrac{1}{5}(2\sin x - \cos x) + Ce−2x+\ Ce^{-2x} is the general solution.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

The equation is linear: yy and dydx\frac{dy}{dx} appear only to the first power, and the coefficient of yy is the constant 2. Multiplying by the integrating factor e∫2 dx=e2xe^{\int 2\,dx} = e^{2x} turns the left side into the single derivative ddx(ye2x)\frac{d}{dx}\left(ye^{2x}\right)⁠. One integration then finishes it; the only real work is ∫e2xsin⁡x dx\int e^{2x}\sin x\,dx⁠, which needs integration by parts twice, as in Example 14.

Given, to find, and the plan
Given
dydx+2y=sin⁡x\frac{dy}{dx} + 2y = \sin x⁠, for all real xx⁠.
To find
The general solution (one arbitrary constant).
Plan
(1) Match dydx+Py=Q\frac{dy}{dx} + Py = Q⁠: read off PP and QQ⁠. (2) I.F. =e∫P dx= e^{\int P\,dx}⁠. (3) Multiply and see the product rule. (4) Integrate: y⋅I.F.=∫Q⋅I.F. dx+Cy\cdot\text{I.F.} = \int Q\cdot\text{I.F.}\,dx + C⁠. (5) Find ∫e2xsin⁡x dx\int e^{2x}\sin x\,dx by parts twice. (6) Solve for yy⁠. (7) Check by substitution.

Basics you need

1First order linear equations

dydx+Py=Q\frac{dy}{dx} + Py = Q⁠, where PP and QQ are constants or functions of xx only. Its solution is y (I.F.)=∫(Q×I.F.) dx+Cy\,(\text{I.F.}) = \int(Q\times\text{I.F.})\,dx + C⁠, where I.F.=e∫P dx\text{I.F.} = e^{\int P\,dx} (Section 9.4.3). Lesson: linear equations, the integrating factor

2Why the integrating factor works

If g′=Pgg' = Pg⁠, then g y′+Pg y=g y′+g′ y=(yg)′g\,y' + Pg\,y = g\,y' + g'\,y = (yg)' by the product rule; g=e∫P dxg = e^{\int P\,dx} has g′=Pgg' = Pg⁠. Basics: (y · g)′ = g(y′ + Py)

3Integration by parts

∫f g dx=f∫g dx−∫(f′∫g dx)dx\int f\,g\,dx = f\int g\,dx - \int\left(f'\int g\,dx\right)dx⁠, with ff the first function (Section 7.6). Basics: every method ends with an integral

4Exponentials

ddxe2x=2e2x\frac{d}{dx}e^{2x} = 2e^{2x}⁠, so ∫e2x dx=e2x2\int e^{2x}\,dx = \frac{e^{2x}}{2}⁠; and e2x⋅e−2x=1e^{2x}\cdot e^{-2x} = 1⁠. Basics: the function whose rate is k times itself

Solution

  1. Recognise the linear form: P=2P = 2⁠, Q=sin⁡xQ = \sin x

    dydx+(2) y=sin⁡x.\frac{dy}{dx} + (2)\,y = \sin x.
    Compare with dydx+Py=Q\frac{dy}{dx} + Py = Q⁠. The coefficient of dydx\frac{dy}{dx} is already 1, so nothing needs dividing. yy and dydx\frac{dy}{dx} appear to the first power only, P=2P = 2 is a constant and Q=sin⁡xQ = \sin x depends on xx only, so the equation is linear. (It is not separable: dydx=sin⁡x−2y\frac{dy}{dx} = \sin x - 2y is not a product of a function of xx and a function of yy⁠.)
    Section 9.4.3, step (i). Lesson: linear equations
  2. The integrating factor: e2xe^{2x}

    I.F.=e∫P dx=e∫2 dx=e2x.\text{I.F.} = e^{\int P\,dx} = e^{\int 2\,dx} = e^{2x}.
    Any one antiderivative of PP will do. A constant added to 2x2x would only multiply the I.F. by a nonzero constant, which cancels from both sides later, so no constant is written here.
    Section 9.4.3, step (ii). Basics: exponentials
  3. Multiply by e2xe^{2x}⁠: the left side is one derivative

    e2xdydx+2e2xy=e2xsin⁡xddx(ye2x)=e2xsin⁡x.\begin{aligned} e^{2x}\frac{dy}{dx} + 2e^{2x}y &= e^{2x}\sin x \\ \frac{d}{dx}\left(ye^{2x}\right) &= e^{2x}\sin x. \end{aligned}
    By the product rule, ddx(ye2x)=e2xdydx+y⋅2e2x\frac{d}{dx}\left(ye^{2x}\right) = e^{2x}\frac{dy}{dx} + y\cdot 2e^{2x}⁠, exactly the left side. This is what the integrating factor is for.
    Product rule (Chapter 5, Section 5.3). Basics: (y · g)′ = g(y′ + Py)
  4. Integrate both sides, with one constant

    ye2x=∫e2xsin⁡x dx+C.…(1)ye^{2x} = \int e^{2x}\sin x\,dx + C.\quad\ldots(1)
    This is y (I.F.)=∫(Q×I.F.) dx+Cy\,(\text{I.F.}) = \int(Q\times\text{I.F.})\,dx + C⁠. The CC is the one arbitrary constant of the general solution, so the integral found in Step 5 gets no constant of its own.
    Section 9.4.3, step (iii). Basics: one constant for order 1
  5. Find I=∫e2xsin⁡x dxI = \int e^{2x}\sin x\,dx⁠: by parts twice

    Take sin⁡x\sin x as the first function and e2xe^{2x} as the second, so ∫e2x dx=e2x2\int e^{2x}\,dx = \frac{e^{2x}}{2}⁠:

    I=sin⁡x⋅e2x2−∫cos⁡x⋅e2x2 dx.I = \sin x\cdot\frac{e^{2x}}{2} - \int\cos x\cdot\frac{e^{2x}}{2}\,dx.

    Again by parts, now with cos⁡x\cos x first:

    ∫cos⁡x⋅e2x2 dx=12[cos⁡x⋅e2x2+∫sin⁡x⋅e2x2 dx]=e2xcos⁡x4+I4.\begin{aligned} &\int\cos x\cdot\frac{e^{2x}}{2}\,dx \\ &= \frac{1}{2}\bigg[\cos x\cdot\frac{e^{2x}}{2} \\ &\qquad + \int\sin x\cdot\frac{e^{2x}}{2}\,dx\bigg] \\ &= \frac{e^{2x}\cos x}{4} + \frac{I}{4}. \end{aligned}

    So

    I=e2xsin⁡x2−e2xcos⁡x4−I454I=e2x(2sin⁡x−cos⁡x)4I=e2x(2sin⁡x−cos⁡x)5.\begin{aligned} I &= \frac{e^{2x}\sin x}{2} - \frac{e^{2x}\cos x}{4} - \frac{I}{4} \\ \frac{5}{4}I &= \frac{e^{2x}(2\sin x - \cos x)}{4} \\ I &= \frac{e^{2x}(2\sin x - \cos x)}{5}. \end{aligned}

    Check, by differentiating back with the product rule:

    ddx[e2x(2sin⁡x−cos⁡x)5]=e2x5[2(2sin⁡x−cos⁡x)+(2cos⁡x+sin⁡x)]=e2x5⋅5sin⁡x=e2xsin⁡x.\begin{aligned} &\frac{d}{dx}\left[\frac{e^{2x}(2\sin x - \cos x)}{5}\right] \\ &= \frac{e^{2x}}{5}\big[2(2\sin x - \cos x) \\ &\qquad + (2\cos x + \sin x)\big] \\ &= \frac{e^{2x}}{5}\cdot 5\sin x = e^{2x}\sin x. \end{aligned}
    In the second integration by parts, the derivative of cos⁡x\cos x is −sin⁡x-\sin x⁠, so the minus sign of the formula and this minus sign make +∫sin⁡x⋅e2x2 dx+\int\sin x\cdot\frac{e^{2x}}{2}\,dx⁠, which is +I2+\frac{I}{2}⁠; with the factor 12\frac12 in front this is I4\frac{I}{4}⁠. After two rounds the original integral comes back, so we solve for II like an ordinary unknown: add I4\frac{I}{4} to both sides and multiply by 45\frac45⁠. Keep the trigonometric function as the first function both times; switching halfway only undoes the first step.
    Section 7.6, integration by parts. Basics: every method ends with an integral
  6. Solve for yy

    Putting II into (1):

    ye2x=e2x(2sin⁡x−cos⁡x)5+Cy=15(2sin⁡x−cos⁡x)+Ce−2x.\begin{aligned} ye^{2x} &= \frac{e^{2x}(2\sin x - \cos x)}{5} + C \\ y &= \frac{1}{5}(2\sin x - \cos x) + Ce^{-2x}. \end{aligned}
    Multiply both sides by e−2xe^{-2x} (never zero): e2xe−2x=1e^{2x}e^{-2x} = 1⁠, and CC becomes Ce−2xCe^{-2x}⁠. The solution holds for every real xx⁠, since PP and QQ are defined everywhere.
    Section 9.4.3: the general solution. Lesson: Exercise 9.5 player
  7. Check by substituting back

    From y=15(2sin⁡x−cos⁡x)+Ce−2xy = \frac{1}{5}(2\sin x - \cos x) + Ce^{-2x}⁠:

    dydx=2cos⁡x+sin⁡x5−2Ce−2x,2y=4sin⁡x−2cos⁡x5+2Ce−2x,\begin{aligned} \frac{dy}{dx} &= \frac{2\cos x + \sin x}{5} - 2Ce^{-2x}, \\ 2y &= \frac{4\sin x - 2\cos x}{5} + 2Ce^{-2x}, \end{aligned}

    and adding,

    dydx+2y=5sin⁡x5=sin⁡x,\frac{dy}{dx} + 2y = \frac{5\sin x}{5} = \sin x,

    for every CC⁠: the Ce−2xCe^{-2x} terms cancel (−2Ce−2x+2Ce−2x=0-2Ce^{-2x} + 2Ce^{-2x} = 0⁠).

    Substituting back proves the answer and shows the role of each part: Ce−2xCe^{-2x} alone solves dydx+2y=0\frac{dy}{dx} + 2y = 0⁠, and 15(2sin⁡x−cos⁡x)\frac{1}{5}(2\sin x - \cos x) supplies the sin⁡x\sin x⁠.
    A solution makes L.H.S. = R.H.S. (Section 9.3). Lesson: general and particular solutions
Result

The general solution is y=15(2sin⁡x−cos⁡x)+Ce−2xy = \frac{1}{5}(2\sin x - \cos x) + Ce^{-2x}⁠, where CC is an arbitrary constant, for all real xx⁠. (Textbook answer: y=15(2sin⁡x−cos⁡x)+Ce−2xy = \frac{1}{5}(2\sin x - \cos x) + Ce^{-2x}⁠.)

Check it with numbers

Take C=1C = 1 and x=1x = 1⁠: sin⁡1≈0.8414710\sin 1 \approx 0.8414710⁠, cos⁡1≈0.5403023\cos 1 \approx 0.5403023⁠, e−2≈0.1353353e^{-2} \approx 0.1353353⁠, so y≈0.3638632y \approx 0.3638632⁠. The equation says dydx=sin⁡x−2y≈0.1137446\frac{dy}{dx} = \sin x - 2y \approx 0.1137446⁠.

The curve itself: y(1.001)≈0.3639771167y(1.001) \approx 0.3639771167 and y(0.999)≈0.3637496281y(0.999) \approx 0.3637496281⁠, so

0.3639771167−0.36374962810.002≈0.11374.\begin{aligned} &\frac{0.3639771167 - 0.3637496281}{0.002} \\ &\approx 0.11374. \end{aligned}
Common mistakes
  1. Writing ∫e2x dx=e2x\int e^{2x}\,dx = e^{2x}; it is e2x2\frac{e^{2x}}{2}⁠, and missing the 12\frac12 gives the wrong coefficients 15\frac15 and the wrong 54I\frac{5}{4}I⁠.
  2. Losing the sign in the second by-parts step: ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin x⁠, so the I4\frac{I}{4} comes with a minus sign on the right and moves over as +I4+\frac{I}{4}⁠.
  3. Writing +C+C instead of +Ce−2x+Ce^{-2x} after dividing by e2xe^{2x}⁠.
  4. Adding a second constant when finding II⁠; the general solution has the one constant of Step 4.
What to take away
  1. A constant P=kP = k gives the I.F. ekxe^{kx}⁠.
  2. ∫eaxsin⁡bx dx\int e^{ax}\sin bx\,dx and ∫eaxcos⁡bx dx\int e^{ax}\cos bx\,dx⁠: by parts twice, then solve for the integral.
  3. Always check by substituting back: the CC part must cancel.

Every fact used, and where it comes from

FactUsed inSource
Linear equation; I.F. =e∫P dx= e^{\int P\,dx}⁠; y (I.F.)=∫(Q×I.F.) dx+Cy\,(\text{I.F.}) = \int(Q\times\text{I.F.})\,dx + CSteps 1, 2, 4Section 9.4.3, steps (i) to (iii) (Lesson)
Product ruleStep 3Chapter 5, Section 5.3 (Basics)
Integration by partsStep 5Section 7.6 (Basics)
ddxe2x=2e2x\frac{d}{dx}e^{2x} = 2e^{2x}⁠; ddxsin⁡x=cos⁡x\frac{d}{dx}\sin x = \cos x⁠, ddxcos⁡x=−sin⁡x\frac{d}{dx}\cos x = -\sin xSteps 3, 5, 7Chapter 5, Sections 5.3 and 5.4 (Basics)
Substituting back into the equationStep 7Section 9.3 (Lesson)
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →