Question
Solve the differential equation:
dxdy+x2y=x2,y(1)=2
Solution — Step by Step
The form is dxdy+P(x)y=Q(x) with P(x)=2/x and Q(x)=x2. Linear first-order ODE — use the integrating factor method.
IF=e∫P(x)dx=e∫(2/x)dx=e2ln∣x∣=x2
Multiplying both sides by x2:
x2dxdy+2xy=x4
The left side is dxd(x2y). So:
dxd(x2y)=x4
x2y=5x5+C
At x=1, y=2: 1⋅2=51+C, so C=2−51=59.
y=5x3+5x29
Final answer: y=5x3+5x29.
Why This Works
The integrating factor μ(x)=e∫Pdx converts the left side into the derivative of a product, dxd(μy). Once that happens, integrating both sides gives the solution directly.
The trick is spotting the linear form. Some equations don’t look linear at first but become linear after a substitution like u=y2 or u=1/y — those are Bernoulli equations.
Alternative Method
For some equations, separation of variables is simpler. But this one has a y term not multiplied by a function of y, so separation fails. The IF method is essentially the only clean approach.
When you see dxdy+(stuff in x)⋅y=(stuff in x), the IF method works mechanically. Just remember: IF=e∫P(x)dx, multiply through, recognise the derivative, integrate, divide by IF.
Common Mistake
Students often forget the ∣x∣ inside the logarithm: ∫2/xdx=2ln∣x∣. The absolute value matters when x<0. Also: some forget that elnu=u (not ue or anything weird) — that’s how the IF simplifies to x2.