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

Exercise 9.5 · Q9: Linear: xdydx+y−x+xycot⁡x=0x\frac{dy}{dx} + y - x + xy\cot x = 0

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:

9. xdydx+y−x+xycot⁡x=0 (x≠0)x\dfrac{dy}{dx} + y - x + xy\cot x = 0\ (x \ne 0)

Exam answer

The equation can be written as xdydx+(1+xcot⁡x) y=xx\frac{dy}{dx} + (1 + x\cot x)\,y = x⁠. Dividing both sides by xx⁠,

dydx+(1x+cot⁡x)y=1\frac{dy}{dx} + \left(\frac{1}{x} + \cot x\right)y = 1

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

I.F.=e∫(1x+cot⁡x)dx=elog⁡x+log⁡sin⁡x=elog⁡(xsin⁡x)=xsin⁡x\begin{aligned} \text{I.F.} &= e^{\int\left(\frac{1}{x} + \cot x\right)dx} \\ &= e^{\log x + \log\sin x} \\ &= e^{\log(x\sin x)} = x\sin x \end{aligned}

So the solution is given by

y⋅xsin⁡x=∫1⋅xsin⁡x dx+Cy\cdot x\sin x = \int 1\cdot x\sin x\,dx + C

Integrating by parts with xx as the first function,

xysin⁡x=x(−cos⁡x)−∫1⋅(−cos⁡x) dx+C=−xcos⁡x+sin⁡x+C\begin{aligned} xy\sin x &= x(-\cos x) \\ &\quad - \int 1\cdot(-\cos x)\,dx + C \\ &= -x\cos x + \sin x + C \end{aligned}

Dividing by xsin⁡xx\sin x⁠,

∴\therefore y=1x−cot⁡x+Cxsin⁡xy = \dfrac{1}{x} - \cot x + \dfrac{C}{x\sin x} is the general solution (sin⁡x≠0)(\sin x \ne 0)⁠.

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

The one idea this problem is built on

Collect the yy terms: y+xycot⁡x=(1+xcot⁡x) yy + xy\cot x = (1 + x\cot x)\,y⁠, and move −x-x to the right. Dividing by xx gives the standard linear form with P=1x+cot⁡xP = \frac{1}{x} + \cot x and Q=1Q = 1⁠. Then ∫P dx=log⁡∣x∣+log⁡∣sin⁡x∣=log⁡∣xsin⁡x∣\int P\,dx = \log|x| + \log|\sin x| = \log|x\sin x|⁠, so xsin⁡xx\sin x serves as the integrating factor, and what is left is ∫xsin⁡x dx\int x\sin x\,dx⁠, by parts.

Given, to find, and the plan
Given
xdydx+y−x+xycot⁡x=0x\frac{dy}{dx} + y - x + xy\cot x = 0⁠, with the book's condition x≠0x \ne 0⁠.
To find
The general solution (one arbitrary constant).
Plan
(1) Collect the yy terms and divide by xx⁠. (2) Read off PP⁠, QQ⁠; note where cot⁡x\cot x is defined. (3) I.F. =e∫P dx= e^{\int P\,dx}⁠, with care over the moduli. (4) Multiply and integrate, with one constant. (5) ∫xsin⁡x dx\int x\sin x\,dx by parts. (6) Solve for yy⁠. (7) Check.

Basics you need

1The standard linear form

dydx+Py=Q\frac{dy}{dx} + Py = Q with PP⁠, QQ functions of xx only; make the coefficient of dydx\frac{dy}{dx} equal to 1 first. Solution: y (I.F.)=∫(Q×I.F.) dx+Cy\,(\text{I.F.}) = \int(Q\times\text{I.F.})\,dx + C⁠, I.F.=e∫P dx\text{I.F.} = e^{\int P\,dx} (Section 9.4.3). Lesson: linear equations, the integrating factor

2Two log integrals

∫dxx=log⁡∣x∣\int\frac{dx}{x} = \log|x| (Section 7.2, formula (xii)) and ∫cot⁡x dx=log⁡∣sin⁡x∣\int\cot x\,dx = \log|\sin x| (Section 7.3.1); log⁡a+log⁡b=log⁡ab\log a + \log b = \log ab⁠. Basics: logs and exponentials

3A constant multiple of an I.F. is an I.F.

If gg is an integrating factor, so is kgkg for any constant k≠0k \ne 0⁠; so xsin⁡xx\sin x can replace ∣xsin⁡x∣|x\sin x|⁠. Basics: (y · g)′ = g(y′ + Py)

4Integration 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 the algebraic factor xx first (Section 7.6). Basics: every method ends with an integral

Solution

  1. Collect the yy terms and divide by xx

    xdydx+(1+xcot⁡x) y=x,dydx+(1x+cot⁡x)y=1.\begin{aligned} x\frac{dy}{dx} + (1 + x\cot x)\,y &= x, \\ \frac{dy}{dx} + \left(\frac{1}{x} + \cot x\right)y &= 1. \end{aligned}
    y+xycot⁡x=(1+xcot⁡x) yy + xy\cot x = (1 + x\cot x)\,y⁠, and −x-x moves to the right as +x+x⁠. The question gives x≠0x \ne 0⁠, so dividing by xx is allowed: 1+xcot⁡xx=1x+cot⁡x\frac{1 + x\cot x}{x} = \frac{1}{x} + \cot x and xx=1\frac{x}{x} = 1⁠.
    Section 9.4.3, step (i). Lesson: linear equations
  2. Read off PP and QQ⁠, and where they are defined

    P=1x+cot⁡xP = \frac{1}{x} + \cot x and Q=1Q = 1⁠.

    Both depend on xx only, so the equation is linear. The term cot⁡x=cos⁡xsin⁡x\cot x = \frac{\cos x}{\sin x} needs sin⁡x≠0\sin x \ne 0⁠, that is x≠nπx \ne n\pi for every integer nn⁠. The book writes "(x≠0)(x \ne 0)"; the condition actually needed is sin⁡x≠0\sin x \ne 0⁠, which includes x≠0x \ne 0⁠. The solution lives on an interval between consecutive multiples of π\pi⁠, such as 0<x<π0 < x < \pi⁠.
    Section 9.4.3: PP and QQ are constants or functions of xx only. Lesson: linear equations
  3. The integrating factor: xsin⁡xx\sin x

    ∫P dx=log⁡∣x∣+log⁡∣sin⁡x∣=log⁡∣xsin⁡x∣,I.F.=elog⁡∣xsin⁡x∣=∣xsin⁡x∣.\begin{aligned} \int P\,dx &= \log|x| + \log|\sin x| \\ &= \log|x\sin x|, \\ \text{I.F.} &= e^{\log|x\sin x|} = |x\sin x|. \end{aligned}

    We take I.F.=xsin⁡x\text{I.F.} = x\sin x⁠, as the book does.

    On each interval between consecutive multiples of π\pi⁠, xsin⁡xx\sin x keeps one sign, so ∣xsin⁡x∣|x\sin x| is xsin⁡xx\sin x or −xsin⁡x-x\sin x there, a constant multiple of xsin⁡xx\sin x⁠, and a nonzero constant multiple of an integrating factor is again one. (On 0<x<π0 < x < \pi and on −π<x<0-\pi < x < 0⁠, xsin⁡x>0x\sin x > 0⁠, so the two agree exactly.) Check: (xsin⁡x)′=sin⁡x+xcos⁡x(x\sin x)' = \sin x + x\cos x⁠, and this is (1x+cot⁡x)xsin⁡x=P⋅xsin⁡x\left(\frac{1}{x} + \cot x\right)x\sin x = P\cdot x\sin x⁠.
    Section 9.4.3, step (ii); Section 7.2, formula (xii); Section 7.3.1. Basics: exponentials
  4. Multiply and integrate, with one constant

    ddx(y xsin⁡x)=xsin⁡x,y xsin⁡x=∫xsin⁡x dx+C.\begin{aligned} \frac{d}{dx}(y\,x\sin x) &= x\sin x, \\ y\,x\sin x &= \int x\sin x\,dx + C. \end{aligned}
    By the product rule, ddx(y xsin⁡x)\frac{d}{dx}(y\,x\sin x) =xsin⁡x dydx+y(sin⁡x+xcos⁡x)= x\sin x\,\frac{dy}{dx} + y(\sin x + x\cos x)⁠, which is the left side of Step 1 multiplied by xsin⁡xx\sin x⁠. On the right, Q×I.F.=1⋅xsin⁡xQ\times\text{I.F.} = 1\cdot x\sin x⁠. CC is the one constant.
    Section 9.4.3, step (iii); product rule (Chapter 5, Section 5.3). Basics: (y · g)′ = g(y′ + Py)
  5. ∫xsin⁡x dx\int x\sin x\,dx by parts

    Take xx as the first function and sin⁡x\sin x as the second, so ∫sin⁡x dx=−cos⁡x\int\sin x\,dx = -\cos x⁠:

    ∫xsin⁡x dx=x(−cos⁡x)−∫1⋅(−cos⁡x) dx=−xcos⁡x+sin⁡x.\begin{aligned} &\int x\sin x\,dx \\ &= x(-\cos x) - \int 1\cdot(-\cos x)\,dx \\ &= -x\cos x + \sin x. \end{aligned}
    Differentiating xx gives 1, which leaves the easy ∫cos⁡x dx=sin⁡x\int\cos x\,dx = \sin x⁠. Check: the derivative of −xcos⁡x+sin⁡x-x\cos x + \sin x is −cos⁡x+xsin⁡x+cos⁡x-\cos x + x\sin x + \cos x =xsin⁡x= x\sin x⁠.
    Section 7.6, integration by parts. Basics: every method ends with an integral
  6. Solve for yy

    xysin⁡x=sin⁡x−xcos⁡x+Cy=1x−cot⁡x+Cxsin⁡x.\begin{aligned} xy\sin x &= \sin x - x\cos x + C \\ y &= \frac{1}{x} - \cot x + \frac{C}{x\sin x}. \end{aligned}
    Divide by xsin⁡x≠0x\sin x \ne 0 term by term: sin⁡xxsin⁡x=1x\frac{\sin x}{x\sin x} = \frac{1}{x} and xcos⁡xxsin⁡x=cot⁡x\frac{x\cos x}{x\sin x} = \cot x⁠.
    Section 9.4.3: the general solution. Lesson: Exercise 9.5 player
  7. Check by substituting back

    Differentiate xysin⁡x=sin⁡x−xcos⁡x+Cxy\sin x = \sin x - x\cos x + C on both sides:

    xsin⁡x dydx+y(sin⁡x+xcos⁡x)=cos⁡x−cos⁡x+xsin⁡x=xsin⁡x.\begin{aligned} &x\sin x\,\frac{dy}{dx} \\ &\quad + y(\sin x + x\cos x) \\ &= \cos x - \cos x + x\sin x \\ &= x\sin x. \end{aligned}

    Dividing by sin⁡x\sin x⁠: xdydx+y+xycot⁡x=xx\frac{dy}{dx} + y + xy\cot x = x⁠, that is xdydx+y−x+xycot⁡x=0x\frac{dy}{dx} + y - x + xy\cot x = 0⁠, for every CC⁠.

    Differentiating the solution in the form y (I.F.)=…y\,(\text{I.F.}) = \ldots gives back the multiplied equation; dividing by sin⁡x≠0\sin x \ne 0 gives the original one. The constant disappears on differentiation.
    A solution makes L.H.S. = R.H.S. (Section 9.3). Lesson: general and particular solutions
Result

The general solution is y=1x−cot⁡x+Cxsin⁡xy = \frac{1}{x} - \cot x + \frac{C}{x\sin x}⁠, where CC is an arbitrary constant (x≠0x \ne 0 and sin⁡x≠0\sin x \ne 0⁠, that is x≠nπx \ne n\pi⁠). (Textbook answer: y=1x−cot⁡x+Cxsin⁡xy = \frac{1}{x} - \cot x + \frac{C}{x\sin x}⁠.)

Check it with numbers

Take C=1C = 1 and x=1x = 1⁠: cot⁡1≈0.6420926\cot 1 \approx 0.6420926 and 1sin⁡1≈1.1883951\frac{1}{\sin 1} \approx 1.1883951⁠, so y≈1−0.6420926+1.1883951y \approx 1 - 0.6420926 + 1.1883951 =1.5463025= 1.5463025⁠. The equation says dydx=x−y−xycot⁡xx≈−1.5391719\frac{dy}{dx} = \frac{x - y - xy\cot x}{x} \approx -1.5391719⁠.

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

1.5447664428−1.54784479450.002≈−1.5392.\begin{aligned} &\frac{1.5447664428 - 1.5478447945}{0.002} \\ &\approx -1.5392. \end{aligned}
Common mistakes
  1. Leaving −x-x on the left and reading Q=0Q = 0⁠; move it across: Q=1Q = 1 after dividing by xx⁠.
  2. Forgetting the yy in +y+y when collecting terms: the coefficient is 1+xcot⁡x1 + x\cot x⁠, not xcot⁡xx\cot x⁠.
  3. Writing elog⁡x+log⁡sin⁡x=x+sin⁡xe^{\log x + \log\sin x} = x + \sin x; logs add to the log of a product, so it is xsin⁡xx\sin x⁠.
  4. Dividing CC by xx only: the last term is Cxsin⁡x\frac{C}{x\sin x}⁠.
What to take away
  1. Rearrange first: gather every yy term into one coefficient, then make the coefficient of dydx\frac{dy}{dx} equal to 1.
  2. P=1x+cot⁡xP = \frac{1}{x} + \cot x gives the I.F. xsin⁡xx\sin x⁠: a sum in PP becomes a product in the I.F.
  3. Check the condition the equation really needs: cot⁡x\cot x needs sin⁡x≠0\sin x \ne 0⁠.

Every fact used, and where it comes from

FactUsed inSource
Standard linear form; 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 to 4Section 9.4.3, steps (i) to (iii) (Lesson)
∫dxx=log⁡∣x∣\int\frac{dx}{x} = \log|x|⁠; ∫cot⁡x dx=log⁡∣sin⁡x∣\int\cot x\,dx = \log|\sin x|⁠; log⁡a+log⁡b=log⁡ab\log a + \log b = \log abStep 3Section 7.2, formula (xii); Section 7.3.1 (Basics)
Product ruleSteps 3, 4, 7Chapter 5, Section 5.3 (Basics)
Integration by partsStep 5Section 7.6 (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 →