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

Example 17: dydx+ycot⁡x=2x+x2cot⁡x\frac{dy}{dx} + y\cot x = 2x + x^2\cot x⁠, y=0y = 0 when x=π2x = \frac{\pi}{2}

ExamplesLinear differential equations, particular solution · Section 9.4.3
The question

Find the particular solution of the differential equation

dydx+ycot⁡x=2x+x2cot⁡x(x≠0)\begin{gathered} \frac{dy}{dx} + y\cot x = 2x + x^2\cot x \\ (x \ne 0) \end{gathered}

given that y=0y = 0 when x=π2x = \dfrac{\pi}{2}⁠.

Exam answer

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

I.F.=e∫cot⁡x dx=elog⁡sin⁡x=sin⁡x\text{I.F.} = e^{\int\cot x\,dx} = e^{\log\sin x} = \sin x

So the solution is given by

ysin⁡x=∫(2x+x2cot⁡x)sin⁡x dx+C=∫2xsin⁡x dx+∫x2cos⁡x dx+C\begin{aligned} y\sin x &= \int(2x + x^2\cot x)\sin x\,dx \\ &\qquad + C \\ &= \int 2x\sin x\,dx \\ &\qquad + \int x^2\cos x\,dx + C \end{aligned}

Integrating ∫2xsin⁡x dx\int 2x\sin x\,dx by parts with sin⁡x\sin x as the first function,

ysin⁡x=sin⁡x⋅x2−∫cos⁡x⋅x2 dx+∫x2cos⁡x dx+C=x2sin⁡x+C…(i)\begin{aligned} y\sin x &= \sin x\cdot x^2 \\ &\qquad - \int\cos x\cdot x^2\,dx \\ &\qquad + \int x^2\cos x\,dx + C \\ &= x^2\sin x + C\quad\ldots(\text{i}) \end{aligned}

Putting y=0y = 0⁠, x=π2x = \frac{\pi}{2} in (i),

0=(π2)2sin⁡π2+CC=−π24\begin{aligned} 0 &= \left(\frac{\pi}{2}\right)^2\sin\frac{\pi}{2} + C \\ C &= -\frac{\pi^2}{4} \end{aligned}

Putting this value of CC in (i),

ysin⁡x=x2sin⁡x−π24y\sin x = x^2\sin x - \frac{\pi^2}{4}

∴\therefore The particular solution is y=x2−π24sin⁡xy = x^2 - \dfrac{\pi^2}{4\sin x} (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

The equation is linear with P=cot⁡xP = \cot x⁠, so the integrating factor is e∫cot⁡x dx=sin⁡xe^{\int\cot x\,dx} = \sin x⁠. After multiplying, the right side is 2xsin⁡x+x2cos⁡x2x\sin x + x^2\cos x⁠, which is exactly the derivative of x2sin⁡xx^2\sin x⁠. The book reaches this by integrating 2xsin⁡x2x\sin x by parts: the leftover integral cancels the other one. Then the point (π2,0)\left(\frac{\pi}{2}, 0\right) fixes the constant.

Given, to find, and the plan
Given
dydx+ycot⁡x=2x+x2cot⁡x\frac{dy}{dx} + y\cot x = 2x + x^2\cot x⁠, and y=0y = 0 when x=π2x = \frac{\pi}{2}⁠.
To find
The particular solution through (π2,0)\left(\frac{\pi}{2}, 0\right)⁠.
Plan
(1) Read off PP and QQ⁠; note where they are defined. (2) I.F. =e∫P dx= e^{\int P\,dx}⁠. (3) Multiply and see the product rule. (4) Integrate, with one constant. (5) Integrate 2xsin⁡x2x\sin x by parts and watch the cancellation. (6) Use the condition. (7) Solve for yy⁠. (8) Check, and see the curve.

Basics you need

1First order linear equations

dydx+Py=Q\frac{dy}{dx} + Py = Q⁠; 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 + C (Section 9.4.3). Lesson: linear equations, the integrating factor

2∫cot⁡x dx=log⁡∣sin⁡x∣\int\cot x\,dx = \log|\sin x|

Since cot⁡x=cos⁡xsin⁡x\cot x = \frac{\cos x}{\sin x} and the top is the derivative of the bottom (Section 7.3.1). Basics: every method ends with an integral

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: the product rule, read backwards

4Particular solutions

Put the given point into the general solution to find the constant (Section 9.3). Lesson: general and particular solutions

Solution

  1. Recognise the linear form: P=cot⁡xP = \cot x⁠, Q=2x+x2cot⁡xQ = 2x + x^2\cot x

    The equation already has the form dydx+Py=Q\frac{dy}{dx} + Py = Q with

    P=cot⁡x,Q=2x+x2cot⁡x.P = \cot x, \qquad Q = 2x + x^2\cot x.
    yy and dydx\frac{dy}{dx} appear to the first power, and PP⁠, QQ depend on xx only. Both contain cot⁡x=cos⁡xsin⁡x\cot x = \frac{\cos x}{\sin x}⁠, so the equation needs sin⁡x≠0\sin x \ne 0⁠, that is x≠nπx \ne n\pi⁠. The book writes "(x≠0)(x \ne 0)"; the condition actually needed is sin⁡x≠0\sin x \ne 0⁠. The given point x=π2x = \frac{\pi}{2} lies in the interval 0<x<π0 < x < \pi⁠, and we work there.
    Section 9.4.3, step (i). Lesson: linear equations
  2. The integrating factor: sin⁡x\sin x

    I.F.=e∫cot⁡x dx=elog⁡∣sin⁡x∣=∣sin⁡x∣=sin⁡x.\begin{aligned} \text{I.F.} &= e^{\int\cot x\,dx} = e^{\log|\sin x|} \\ &= |\sin x| = \sin x. \end{aligned}
    On 0<x<π0 < x < \pi⁠, sin⁡x>0\sin x > 0⁠, so ∣sin⁡x∣=sin⁡x|\sin x| = \sin x⁠; this is the book's I.F. (On an interval where sin⁡x<0\sin x < 0⁠, ∣sin⁡x∣=−sin⁡x|\sin x| = -\sin x⁠, a constant multiple, so sin⁡x\sin x works there too.)
    Section 9.4.3, step (ii); ∫cot⁡x dx=log⁡∣sin⁡x∣\int\cot x\,dx = \log|\sin x|⁠. Basics: exponentials
  3. Multiply by sin⁡x\sin x⁠: the left side is one derivative

    sin⁡x dydx+ycos⁡x=(2x+x2cot⁡x)sin⁡x,soddx(ysin⁡x)=2xsin⁡x+x2cos⁡x.\begin{aligned} &\sin x\,\frac{dy}{dx} + y\cos x \\ &= (2x + x^2\cot x)\sin x, \quad\text{so} \\ &\frac{d}{dx}(y\sin x) = 2x\sin x + x^2\cos x. \end{aligned}
    cot⁡x⋅sin⁡x=cos⁡x\cot x\cdot\sin x = \cos x⁠. The product rule gives ddx(ysin⁡x)=sin⁡x dydx+ycos⁡x\frac{d}{dx}(y\sin x) = \sin x\,\frac{dy}{dx} + y\cos x⁠, which is the left side.
    Product rule (Chapter 5, Section 5.3). Basics: (y · g)′ = g(y′ + Py)
  4. Integrate, with one constant

    ysin⁡x=∫(2x+x2cot⁡x)sin⁡x dx+C=∫2xsin⁡x dx+∫x2cos⁡x dx+C.\begin{aligned} y\sin x &= \int(2x + x^2\cot x)\sin x\,dx \\ &\quad + C \\ &= \int 2x\sin x\,dx \\ &\quad + \int x^2\cos x\,dx + C. \end{aligned}
    This is y (I.F.)=∫(Q×I.F.) dx+Cy\,(\text{I.F.}) = \int(Q\times\text{I.F.})\,dx + C⁠, with the integrand split into two. The CC is the one arbitrary constant; the integrals below get no constants of their own.
    Section 9.4.3, step (iii). Basics: one constant for order 1
  5. By parts: the two integrals cancel

    In ∫2xsin⁡x dx\int 2x\sin x\,dx take sin⁡x\sin x as the first function and 2x2x as the second, so ∫2x dx=x2\int 2x\,dx = x^2⁠:

    ∫2xsin⁡x dx=sin⁡x⋅x2−∫cos⁡x⋅x2 dx.\begin{aligned} &\int 2x\sin x\,dx \\ &= \sin x\cdot x^2 - \int\cos x\cdot x^2\,dx. \end{aligned}

    So

    ysin⁡x=x2sin⁡x−∫x2cos⁡x dx+∫x2cos⁡x dx+C=x2sin⁡x+C.…(1)\begin{aligned} y\sin x &= x^2\sin x - \int x^2\cos x\,dx \\ &\quad + \int x^2\cos x\,dx + C \\ &= x^2\sin x + C.\quad\ldots(1) \end{aligned}
    The usual choice (2x2x first) would lead nowhere quickly. Choosing sin⁡x\sin x first produces exactly −∫x2cos⁡x dx-\int x^2\cos x\,dx⁠, which cancels the second integral. The reason it works: 2xsin⁡x+x2cos⁡x2x\sin x + x^2\cos x is the derivative of x2sin⁡xx^2\sin x by the product rule, so its integral is x2sin⁡xx^2\sin x⁠.
    Section 7.6, integration by parts. Basics: every method ends with an integral
  6. Use the condition: y=0y = 0 when x=π2x = \frac{\pi}{2}

    0=(π2)2sin⁡π2+C=π24+CC=−π24.\begin{aligned} 0 &= \left(\frac{\pi}{2}\right)^2\sin\frac{\pi}{2} + C = \frac{\pi^2}{4} + C \\ C &= -\frac{\pi^2}{4}. \end{aligned}
    Putting x=π2x = \frac{\pi}{2}⁠, y=0y = 0 in (1); sin⁡π2=1\sin\frac{\pi}{2} = 1⁠. This picks the one curve of the family through (π2,0)\left(\frac{\pi}{2}, 0\right)⁠.
    Section 9.3: a particular solution. Lesson: general and particular solutions
  7. Solve for yy

    ysin⁡x=x2sin⁡x−π24y=x2−π24sin⁡x(sin⁡x≠0).\begin{aligned} y\sin x &= x^2\sin x - \frac{\pi^2}{4} \\ y &= x^2 - \frac{\pi^2}{4\sin x}\quad(\sin x \ne 0). \end{aligned}
    Divide by sin⁡x\sin x⁠, which is positive on 0<x<π0 < x < \pi⁠. The particular solution lives on that interval: as x→0+x \to 0^+ or x→π−x \to \pi^-⁠, sin⁡x→0+\sin x \to 0^+ and y→−∞y \to -\infty⁠.
    Section 9.4.3: the particular solution. Lesson: Examples 14 to 18
  8. Check by substituting back, and see the curve

    From y=x2−π24(sin⁡x)−1y = x^2 - \frac{\pi^2}{4}(\sin x)^{-1}⁠: dydx=2x+π2cos⁡x4sin⁡2x\frac{dy}{dx} = 2x + \frac{\pi^2\cos x}{4\sin^2x}⁠. And ycot⁡x=x2cot⁡x−π2cos⁡x4sin⁡2xy\cot x = x^2\cot x - \frac{\pi^2\cos x}{4\sin^2x}⁠. Adding,

    dydx+ycot⁡x=2x+x2cot⁡x,\frac{dy}{dx} + y\cot x = 2x + x^2\cot x,

    the given equation. At x=π2x = \frac{\pi}{2}⁠: y=π24−π24⋅1=0y = \frac{\pi^2}{4} - \frac{\pi^2}{4\cdot1} = 0⁠.

    X Y Y′ (π/2, 0) x = π O
    Slope field of the equation for 0<x<π0 < x < \pi⁠, with equal scales, and the particular solution y=x2−π24sin⁡xy = x^2 - \frac{\pi^2}{4\sin x} through (π2,0)\left(\frac{\pi}{2}, 0\right)⁠. The yy-axis x=0x = 0 and the dashed line x=πx = \pi⁠, where sin⁡x=0\sin x = 0⁠, bound the interval on which the solution lives; the curve drops to −∞-\infty at both.
    The π2cos⁡x4sin⁡2x\frac{\pi^2\cos x}{4\sin^2x} terms cancel, so the formula satisfies the equation, and it passes through the given point. The picture shows why the answer needs sin⁡x≠0\sin x \ne 0⁠: the curve cannot cross x=0x = 0 or x=πx = \pi⁠.
    A solution makes L.H.S. = R.H.S.; the quotient (or chain) rule for (sin⁡x)−1(\sin x)^{-1} (Chapter 5). Basics: a rule for slopes
Result

The general solution is ysin⁡x=x2sin⁡x+Cy\sin x = x^2\sin x + C⁠, and the particular solution with y=0y = 0 when x=π2x = \frac{\pi}{2} is y=x2−π24sin⁡xy = x^2 - \frac{\pi^2}{4\sin x} (sin⁡x≠0\sin x \ne 0⁠; the curve lives on 0<x<π0 < x < \pi⁠). (Textbook answer: y=x2−π24sin⁡x (sin⁡x≠0)y = x^2 - \frac{\pi^2}{4\sin x}\ (\sin x \ne 0)⁠.)

Check it with numbers

Take x=2x = 2⁠: sin⁡2≈0.9092974\sin 2 \approx 0.9092974 and π24≈2.4674011\frac{\pi^2}{4} \approx 2.4674011⁠, so y≈4−2.46740110.9092974≈1.2864752y \approx 4 - \frac{2.4674011}{0.9092974} \approx 1.2864752⁠. With cot⁡2≈−0.4576576\cot 2 \approx -0.4576576⁠, the equation gives dydx=2x+x2cot⁡x−ycot⁡x≈2.75813\frac{dy}{dx} = 2x + x^2\cot x - y\cot x \approx 2.75813⁠.

The curve itself: y(2.001)≈1.2892324283y(2.001) \approx 1.2892324283 and y(1.999)≈1.2837161611y(1.999) \approx 1.2837161611⁠, so

1.2892324283−1.28371616110.002≈2.75813.\begin{aligned} &\frac{1.2892324283 - 1.2837161611}{0.002} \\ &\approx 2.75813. \end{aligned}
Common mistakes
  1. Writing ∫cot⁡x dx=log⁡cos⁡x\int\cot x\,dx = \log\cos x or −log⁡sin⁡x-\log\sin x⁠; it is log⁡∣sin⁡x∣\log|\sin x|⁠, so the I.F. is sin⁡x\sin x⁠.
  2. Expanding both integrals by parts the usual way and getting lost; take sin⁡x\sin x as the first function in ∫2xsin⁡x dx\int 2x\sin x\,dx⁠, or notice (x2sin⁡x)′=2xsin⁡x+x2cos⁡x(x^2\sin x)' = 2x\sin x + x^2\cos x⁠.
  3. Dividing CC wrongly: y=x2+Csin⁡xy = x^2 + \frac{C}{\sin x}⁠, not x2+Cx^2 + C⁠.
  4. Ignoring where the answer lives: it needs sin⁡x≠0\sin x \ne 0⁠, and the curve through (π2,0)\left(\frac{\pi}{2}, 0\right) is on 0<x<π0 < x < \pi⁠.
What to take away
  1. P=cot⁡xP = \cot x gives I.F. sin⁡x\sin x⁠; P=tan⁡xP = \tan x gives sec⁡x\sec x⁠.
  2. Before integrating Q×I.F.Q\times\text{I.F.}⁠, check whether it is already the derivative of a product.
  3. For a particular solution: general solution first, then the given point fixes CC⁠, then check.

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)
∫cot⁡x dx=log⁡∣sin⁡x∣+C\int\cot x\,dx = \log|\sin x| + CStep 2Section 7.3.1 (Basics)
Product ruleSteps 3, 5Chapter 5, Section 5.3 (Basics)
Integration by partsStep 5Section 7.6 (Basics)
Particular solution from a given point; sin⁡π2=1\sin\frac{\pi}{2} = 1Step 6Section 9.3 (Lesson)
Substituting back; derivative of (sin⁡x)−1(\sin x)^{-1}Step 8Section 9.3; Chapter 5, Section 5.3.1 (Basics)
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 →