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

Example 15: Linear: xdydx+2y=x2x\frac{dy}{dx} + 2y = x^2

ExamplesLinear differential equations · Section 9.4.3
The question

Find the general solution of the differential equation xdydx+2y=x2 (x≠0)x\dfrac{dy}{dx} + 2y = x^2\ (x \ne 0)⁠.

Exam answer

Dividing both sides by xx⁠,

dydx+2x y=x\frac{dy}{dx} + \frac{2}{x}\,y = x

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

I.F.=e∫2xdx=e2log⁡∣x∣=elog⁡x2=x2\begin{aligned} \text{I.F.} &= e^{\int\frac{2}{x}dx} = e^{2\log|x|} \\ &= e^{\log x^2} = x^2 \end{aligned}

So the solution is given by

y⋅x2=∫x⋅x2 dx+C=∫x3 dx+C=x44+C\begin{aligned} y\cdot x^2 &= \int x\cdot x^2\,dx + C \\ &= \int x^3\,dx + C \\ &= \frac{x^4}{4} + C \end{aligned}

Dividing by x2x^2⁠,

∴\therefore y=x24+Cx−2y = \dfrac{x^2}{4} + Cx^{-2} 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 in yy⁠, but not yet in the standard form, because dydx\frac{dy}{dx} has the coefficient xx⁠. Divide by xx first; only then read off P=2xP = \frac{2}{x} and Q=xQ = x⁠. The integrating factor e∫P dxe^{\int P\,dx} is then x2x^2⁠, and multiplying by it makes the left side ddx(x2y)\frac{d}{dx}\left(x^2y\right)⁠.

Given, to find, and the plan
Given
xdydx+2y=x2x\frac{dy}{dx} + 2y = x^2⁠, with x≠0x \ne 0⁠.
To find
The general solution (one arbitrary constant).
Plan
(1) Divide by xx to reach dydx+Py=Q\frac{dy}{dx} + Py = Q⁠. (2) Read off PP⁠, QQ⁠. (3) I.F. =e∫P dx= e^{\int P\,dx}⁠. (4) Multiply and see the product rule. (5) Integrate, with one constant. (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; the coefficient of dydx\frac{dy}{dx} must be 1 before PP is read off. 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

2Why the I.F. works

g=e∫P dxg = e^{\int P\,dx} has g′=Pgg' = Pg⁠, so g y′+Pg y=(yg)′g\,y' + Pg\,y = (yg)'⁠. Basics: (y · g)′ = g(y′ + Py)

3Logs and exponentials

∫dxx=log⁡∣x∣\int\frac{dx}{x} = \log|x|⁠; 2log⁡∣x∣=log⁡∣x∣2=log⁡x22\log|x| = \log|x|^2 = \log x^2⁠; and elog⁡t=te^{\log t} = t for t>0t > 0⁠. Basics: exponentials

4Power rule

∫x3 dx=x44+C\int x^3\,dx = \frac{x^4}{4} + C (Section 7.2, formula (i)). Basics: every method ends with an integral

Solution

  1. Divide by xx to reach the standard form

    dydx+2x y=x.\frac{dy}{dx} + \frac{2}{x}\,y = x.
    The standard linear form needs dydx\frac{dy}{dx} with coefficient 1. Dividing by xx is allowed because the question says x≠0x \ne 0⁠.
    Section 9.4.3, step (i). Lesson: linear equations
  2. Read off PP and QQ

    P=2xP = \frac{2}{x} and Q=xQ = x⁠.

    Both depend on xx only, and yy appears to the first power, so the equation is linear. (It is not separable: dydx=x−2yx\frac{dy}{dx} = x - \frac{2y}{x} is not a product of a function of xx and a function of yy⁠. It is not homogeneous either, since x2x^2 on the right has a different degree from the other terms.)
    Section 9.4.3: PP and QQ are constants or functions of xx only. Lesson: linear equations
  3. The integrating factor: x2x^2

    I.F.=e∫2x dx=e2log⁡∣x∣=elog⁡x2=x2.\begin{aligned} \text{I.F.} &= e^{\int\frac{2}{x}\,dx} = e^{2\log|x|} \\ &= e^{\log x^2} = x^2. \end{aligned}
    2log⁡∣x∣=log⁡∣x∣2=log⁡x22\log|x| = \log|x|^2 = \log x^2⁠, and elog⁡t=te^{\log t} = t⁠. The book writes e2log⁡xe^{2\log x}⁠; with ∣x∣|x| the result is the same x2x^2 for negative xx too, because ∣x∣2=x2|x|^2 = x^2⁠. No constant is needed in ∫P dx\int P\,dx⁠: it would only multiply the I.F. by a nonzero constant.
    Section 9.4.3, step (ii); elog⁡f(x)=f(x)e^{\log f(x)} = f(x)⁠. Basics: exponentials
  4. Multiply by x2x^2⁠: the left side is one derivative

    x2dydx+2x y=x3ddx(x2y)=x3.\begin{aligned} x^2\frac{dy}{dx} + 2x\,y &= x^3 \\ \frac{d}{dx}\left(x^2y\right) &= x^3. \end{aligned}
    By the product rule, ddx(x2y)=x2dydx+2x y\frac{d}{dx}(x^2y) = x^2\frac{dy}{dx} + 2x\,y⁠, exactly the left side. (Notice this is just the original equation multiplied by xx⁠.)
    Product rule (Chapter 5, Section 5.3). Basics: (y · g)′ = g(y′ + Py)
  5. Integrate, with one constant

    y⋅x2=∫x⋅x2 dx+C=∫x3 dx+C=x44+C.\begin{aligned} y\cdot x^2 &= \int x\cdot x^2\,dx + C \\ &= \int x^3\,dx + C \\ &= \frac{x^4}{4} + 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 Q×I.F.=x⋅x2Q\times\text{I.F.} = x\cdot x^2⁠. The CC here is the one arbitrary constant of the general solution.
    Section 9.4.3, step (iii); Section 7.2, formula (i). Basics: one constant for order 1
  6. Solve for yy

    y=x24+Cx2=x24+Cx−2.y = \frac{x^2}{4} + \frac{C}{x^2} = \frac{x^2}{4} + Cx^{-2}.
    Divide by x2≠0x^2 \ne 0⁠. The solution lives on an interval where x≠0x \ne 0⁠: on x>0x > 0 or on x<0x < 0⁠, since the equation itself is not defined at x=0x = 0⁠.
    Section 9.4.3: the general solution. Lesson: Examples 14 to 18
  7. Check by substituting back

    From y=x24+Cx−2y = \frac{x^2}{4} + Cx^{-2}⁠: dydx=x2−2Cx−3\frac{dy}{dx} = \frac{x}{2} - 2Cx^{-3}⁠, so

    xdydx+2y=x22−2Cx−2+x22+2Cx−2=x2,\begin{aligned} x\frac{dy}{dx} + 2y &= \frac{x^2}{2} - 2Cx^{-2} \\ &\quad + \frac{x^2}{2} + 2Cx^{-2} \\ &= x^2, \end{aligned}

    for every CC⁠.

    The CC terms cancel, as they must: Cx−2Cx^{-2} alone solves xdydx+2y=0x\frac{dy}{dx} + 2y = 0⁠, and x24\frac{x^2}{4} supplies the x2x^2⁠.
    A solution makes L.H.S. = R.H.S. (Section 9.3). Lesson: general and particular solutions
Result

The general solution is y=x24+Cx−2y = \frac{x^2}{4} + Cx^{-2}⁠, where CC is an arbitrary constant (x≠0x \ne 0⁠). (Textbook answer: y=x24+Cx−2y = \frac{x^2}{4} + Cx^{-2}⁠.)

Check it with numbers

Take C=1C = 1 and x=2x = 2⁠: y=1+14=1.25y = 1 + \frac14 = 1.25⁠. The equation gives dydx=x2−2yx=4−2.52=0.75\frac{dy}{dx} = \frac{x^2 - 2y}{x} = \frac{4 - 2.5}{2} = 0.75⁠.

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

1.2507504374−1.24925043760.002≈0.75000.\begin{aligned} &\frac{1.2507504374 - 1.2492504376}{0.002} \\ &\approx 0.75000. \end{aligned}
Common mistakes
  1. Reading P=2P = 2 and Q=x2Q = x^2 straight from xdydx+2y=x2x\frac{dy}{dx} + 2y = x^2⁠. Divide by xx first: P=2xP = \frac{2}{x}⁠, Q=xQ = x⁠.
  2. Writing I.F. =e2log⁡x=2x= e^{2\log x} = 2x⁠. e2log⁡x=elog⁡x2=x2e^{2\log x} = e^{\log x^2} = x^2⁠.
  3. Multiplying QQ by the I.F. wrongly: ∫Q (I.F.) dx=∫x⋅x2 dx\int Q\,(\text{I.F.})\,dx = \int x\cdot x^2\,dx⁠, not ∫x2⋅x2 dx\int x^2\cdot x^2\,dx⁠.
  4. Dividing only x44\frac{x^4}{4} by x2x^2 and leaving +C+C⁠: the answer is +Cx2+\frac{C}{x^2}⁠.
What to take away
  1. Make the coefficient of dydx\frac{dy}{dx} equal to 1 before reading off PP and QQ⁠.
  2. eklog⁡x=xke^{k\log x} = x^k⁠: a PP of the form kx\frac{k}{x} gives the I.F. xkx^k⁠.
  3. Check: the CC part must cancel when you substitute back.

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, 2, 3, 5Section 9.4.3, steps (i) to (iii) (Lesson)
∫dxx=log⁡∣x∣\int\frac{dx}{x} = \log|x|⁠; elog⁡f(x)=f(x)e^{\log f(x)} = f(x)Step 3Section 7.2, formula (xii); Chapter 5, Section 5.4 (Basics)
Product ruleStep 4Chapter 5, Section 5.3 (Basics)
∫xn dx=xn+1n+1+C\int x^n\,dx = \frac{x^{n+1}}{n+1} + CStep 5Section 7.2, formula (i) (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 →