Math Lab
Home/Class XII/Ch 9/Linear differential equations

Linear differential equations

The form dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)\,y = Q(x) is a first-order linear differential equation in yy. Linear here means yy and dydx\dfrac{dy}{dx} appear to first power only , no y2y^2, no siny\sin y. The functions PP and QQ depend only on xx.

This is among the most useful DE forms in applied work , it models RC and RL circuits, mixing problems with constant flow, motion under linear drag, and many growth problems with constant input rates.

The integrating-factor idea

Suppose we multiply both sides by a function μ(x)\mu(x) , the integrating factor: μ(x)dydx+μ(x)P(x)y=μ(x)Q(x).\mu(x)\frac{dy}{dx} + \mu(x) P(x)\,y = \mu(x) Q(x). The left side resembles the derivative of a product ddx(μy)=μy+μy\dfrac{d}{dx}(\mu y) = \mu y' + \mu' y, provided μ=μP\mu' = \mu P. Solving this for μ\mu: dμμ=Pdx\dfrac{d\mu}{\mu} = P\,dx, so μ=eP(x)dx\mu = e^{\int P(x)\,dx}.

So the integrating factor is μ(x)=eP(x)dx.\mu(x) = e^{\int P(x)\,dx}. After multiplying, the equation becomes ddx(μy)=μQ\dfrac{d}{dx}(\mu y) = \mu Q, which integrates directly: μ(x)y=μ(x)Q(x)dx+C,y=1μ(x)[μ(x)Q(x)dx+C].\mu(x) y = \int \mu(x) Q(x)\,dx + C, \qquad y = \frac{1}{\mu(x)}\left[\int \mu(x) Q(x)\,dx + C\right].

The procedure

  1. Put the equation in standard form dydx+P(x)y=Q(x)\dfrac{dy}{dx} + P(x) y = Q(x) , coefficient of dydx\dfrac{dy}{dx} must be 11.
  2. Compute P(x)P(x) and the integrating factor μ(x)=ePdx\mu(x) = e^{\int P\,dx}.
  3. Multiply both sides by μ\mu.
  4. Recognise the left side as ddx[μy]\dfrac{d}{dx}[\mu y].
  5. Integrate both sides; solve for yy.

When the roles swap: linear in xx

Sometimes a DE is not linear in yy but is linear in xx. The form dxdy+P(y)x=Q(y)\frac{dx}{dy} + P(y)\,x = Q(y) is solved identically , treating xx as the dependent variable and yy as the independent variable. Integrating factor: μ(y)=eP(y)dy\mu(y) = e^{\int P(y)\,dy}.

You should always test both forms when the obvious arrangement fails.

Worked examples

Example 1. Solve dydx+y=ex\dfrac{dy}{dx} + y = e^x.

Here P=1P = 1, Q=exQ = e^x. μ=ex\mu = e^x. Multiply: exy+exy=e2xe^x y' + e^x y = e^{2x}, i.e. (exy)=e2x(e^x y)' = e^{2x}. Integrate: exy=e2x2+Ce^x y = \dfrac{e^{2x}}{2} + C, so y=ex2+Cexy = \dfrac{e^x}{2} + C e^{-x}.

Example 2. Solve dydx+yx=x2\dfrac{dy}{dx} + \dfrac{y}{x} = x^2.

P=1/xP = 1/x, μ=edx/x=elnx=x\mu = e^{\int dx/x} = e^{\ln|x|} = |x|, take μ=x\mu = x (positive branch). Multiply: xy+y=x3xy' + y = x^3, i.e. (xy)=x3(xy)' = x^3. Integrate: xy=x44+Cxy = \dfrac{x^4}{4} + C, so y=x34+Cxy = \dfrac{x^3}{4} + \dfrac{C}{x}.

Example 3. Solve dydx+ytanx=secx\dfrac{dy}{dx} + y \tan x = \sec x.

P=tanxP = \tan x, tanxdx=lnsecx\int \tan x\,dx = \ln|\sec x|, so μ=secx\mu = \sec x. Multiply: secxy+ysecxtanx=sec2x\sec x \cdot y' + y \sec x \tan x = \sec^2 x, i.e. (secxy)=sec2x(\sec x \cdot y)' = \sec^2 x. Integrate: secxy=tanx+C\sec x \cdot y = \tan x + C, so y=sinx+Ccosxy = \sin x + C \cos x.

Example 4. Solve (x+y)dydx=1(x + y)\dfrac{dy}{dx} = 1.

Rewrite: dydx=1x+y\dfrac{dy}{dx} = \dfrac{1}{x + y}, then flip: dxdy=x+y\dfrac{dx}{dy} = x + y, i.e. dxdyx=y\dfrac{dx}{dy} - x = y. Linear in xx. P=1P = -1, μ=ey\mu = e^{-y}. Multiply: (eyx)=yey(e^{-y} x)' = y e^{-y}. Integrate (by parts): yeydy=yeyey+C\int y e^{-y}\,dy = -y e^{-y} - e^{-y} + C. So eyx=yeyey+Ce^{-y} x = -y e^{-y} - e^{-y} + C, giving x=y1+Ceyx = -y - 1 + C e^y.

Example 5. Solve dydx+2y=e3x\dfrac{dy}{dx} + 2y = e^{3x}, y(0)=1y(0) = 1.

P=2P = 2, μ=e2x\mu = e^{2x}. Multiply: (e2xy)=e5x(e^{2x} y)' = e^{5x}. Integrate: e2xy=e5x5+Ce^{2x} y = \dfrac{e^{5x}}{5} + C, so y=e3x5+Ce2xy = \dfrac{e^{3x}}{5} + C e^{-2x}. Apply IC: 1=15+C1 = \dfrac{1}{5} + C, so C=45C = \dfrac{4}{5}. Particular: y=e3x+4e2x5y = \dfrac{e^{3x} + 4e^{-2x}}{5}.

Example 6. Solve xdydxy=x2x\dfrac{dy}{dx} - y = x^2.

Divide by xx: dydxyx=x\dfrac{dy}{dx} - \dfrac{y}{x} = x. P=1/xP = -1/x, μ=elnx=1/x\mu = e^{-\ln x} = 1/x. Multiply: 1xdydxyx2=1\dfrac{1}{x}\dfrac{dy}{dx} - \dfrac{y}{x^2} = 1, i.e. (yx)=1\left(\dfrac{y}{x}\right)' = 1. Integrate: yx=x+C\dfrac{y}{x} = x + C, so y=x2+Cxy = x^2 + Cx.

Try it yourself

  1. dydx+y=x\dfrac{dy}{dx} + y = x
  2. dydx+2xy=x\dfrac{dy}{dx} + 2xy = x
  3. dydxyx=2x2\dfrac{dy}{dx} - \dfrac{y}{x} = 2x^2
  4. dydx+ycotx=sin2x\dfrac{dy}{dx} + y \cot x = \sin 2x
  5. (1+x2)dydx+2xy=4x2(1 + x^2)\dfrac{dy}{dx} + 2xy = 4x^2
  6. dydx+y=cosx\dfrac{dy}{dx} + y = \cos x
  7. dydxytanx=exsecx\dfrac{dy}{dx} - y \tan x = e^x \sec x
  8. xdydx+y=xcosxx\dfrac{dy}{dx} + y = x \cos x, y(π/2)=0y(\pi/2) = 0.
  9. dxdy+x=y\dfrac{dx}{dy} + x = y (linear in xx)
  10. (x+1)dydxy=ex(x+1)2(x + 1)\dfrac{dy}{dx} - y = e^x (x + 1)^2
  11. dydx2y=x2e2x\dfrac{dy}{dx} - 2y = x^2 e^{2x}
  12. dydx=yxx\dfrac{dy}{dx} = \dfrac{y - x}{x} (rearrange to standard form)
  13. dydx2ycot2x=12xcot2x2csc2x\dfrac{dy}{dx} - 2y \cot 2x = 1 - 2x \cot 2x - 2 \csc 2x
  14. Verify that for dydx+Py=QP\dfrac{dy}{dx} + P y = Q P, the answer is y=Q+CePdxy = Q + C e^{-\int P\,dx} if QQ is constant.

Pitfalls and tricks

  • Always normalise to coefficient 11 on dydx\dfrac{dy}{dx} before computing PP.
  • μ=ePdx\mu = e^{\int P\,dx}. No constant of integration here , any antiderivative works (the constant just rescales μ\mu).
  • The product rule check. After multiplying by μ\mu, the left side must equal (μy)(\mu y)'. Verify by expanding.
  • Linear in xx, not yy? When the natural form has nonlinearity in yy but linearity in xx, swap roles and proceed.
  • Don't forget +C+C when integrating μQ\mu Q. It generates the family of solutions.

Practice quiz

Quick check on this topic.

Quiz
Quick check : Linear DEs
6 questions · pick the best answer
Q1

Standard linear form in yy is

Q2

Integrating factor for y+3y=exy' + 3y = e^x

Q3

After multiplying by IF, the LHS becomes

Q4

Solution of y+y=0y' + y = 0

Q5

yyx=x2y' - \frac{y}{x} = x^2 has IF

Q6

Sometimes a DE is linear in xx instead of yy. Then use