Differential Equations: Common Mistakes and Fixes (1)

easy 2 min read

Question

Solve the differential equation dydx+yx=x2\dfrac{dy}{dx} + \dfrac{y}{x} = x^2, given y(1)=2y(1) = 2.

Solution — Step by Step

This is a linear first-order ODE in standard form dydx+P(x)y=Q(x)\dfrac{dy}{dx} + P(x) y = Q(x) with P(x)=1/xP(x) = 1/x and Q(x)=x2Q(x) = x^2.

μ(x)=ePdx=e(1/x)dx=elnx=x(taking x>0)\mu(x) = e^{\int P\,dx} = e^{\int (1/x)\,dx} = e^{\ln|x|} = x \quad\text{(taking $x > 0$)} xdydx+y=x3    ddx(xy)=x3x\frac{dy}{dx} + y = x^3 \implies \frac{d}{dx}(xy) = x^3

The left side is exactly the derivative of xyxy — that is the whole purpose of the integrating factor.

xy=x3dx=x44+Cxy = \int x^3\,dx = \frac{x^4}{4} + C

So y=x34+Cxy = \dfrac{x^3}{4} + \dfrac{C}{x}.

At x=1x = 1, y=2y = 2:

2=14+C    C=742 = \frac{1}{4} + C \implies C = \frac{7}{4}
y=x34+74x\boxed{y = \frac{x^3}{4} + \frac{7}{4x}}

Why This Works

The integrating factor μ(x)\mu(x) is constructed so that multiplying the ODE by μ\mu makes the left side exactly d(μy)/dxd(\mu y)/dx. After that, both sides can be integrated directly.

The choice μ=ePdx\mu = e^{\int P\,dx} is forced by the product rule: we need μ=μP\mu' = \mu P, which is exactly the differential equation μ\mu itself satisfies.

Alternative Method

For this particular equation, we can also use the substitution v=xyv = xy (since the structure suggests it). Then dv/dx=y+xdy/dx=y+x(x2y/x)=x3dv/dx = y + x\,dy/dx = y + x(x^2 - y/x) = x^3. Integrating gives v=x4/4+Cv = x^4/4 + C, so xy=x4/4+Cxy = x^4/4 + C. Same answer faster.

Common Mistake

Forgetting the constant of integration CC before applying the initial condition. If you write xy=x4/4xy = x^4/4 and plug in y(1)=2y(1) = 2, you get 2=1/42 = 1/4 — a contradiction. Always carry CC through the integration step, then solve for it.

Want to master this topic?

Read the complete guide with more examples and exam tips.

Go to full topic guide →

Try These Next