Maths WorkshopMaths problems with full solutions
Exercise 759Calculus › Differential equations › First-order equationsL2Added 2 Nov 2026

Variation of constants

#variation of constants#linear equation#integration

Statement

Solve on ]0,+∞[]0,+\infty[ the equation
y′−yx=x2.y' - \frac{y}{x} = x^2.

Hint

The homogeneous solution is yh=Cxy_h = Cx. Use variation of constants: y(x)=C(x)xy(x) = C(x)x.

Show solutionHide solution

Solution

Homogeneous equation. y′−y/x=0y' - y/x = 0 gives
y′y=1x  ⟹  ln⁡∣y∣=ln⁡x+const  ⟹  yh(x)=Cx.\frac{y'}{y} = \frac1x \implies \ln|y| = \ln x + \text{const} \implies y_h(x) = Cx.

Variation of constants. Set y(x)=C(x)xy(x) = C(x)x. Then y′=C′x+Cy' = C'x + C, and
y′−yx=C′x+C−C=C′x.y' - \frac{y}{x} = C'x + C - C = C'x.
We need C′x=x2C'x = x^2, so C′(x)=xC'(x) = x, hence C(x)=x22+KC(x) = \frac{x^2}{2} + K.

General solution.
y(x)=(x22+K)x=x32+Kx,K∈R.y(x) = \left(\frac{x^2}{2} + K\right)x = \frac{x^3}{2} + Kx, \qquad K \in \mathbb{R}.

Remark. This is the standard method of variation of constants.