Introduction to Linear Differential Equations

A first-order differential equation is said to be linear if the dependent variable (usually yy) and its derivative dydx\frac{dy}{dx} appear only in the first degree and are not multiplied together.

The standard form of a first-order linear differential equation is: dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)\,y = Q(x) Here, P(x)P(x) and Q(x)Q(x) are constants or functions of xx only.

A few important observations:

  • dydx+3y=ex\frac{dy}{dx} + 3y = e^x is linear.
  • dydx+y2=x\frac{dy}{dx} + y^2 = x is not linear because yy is squared.
  • ydydx=xy\frac{dy}{dx} = x is not linear because yy and dydx\frac{dy}{dx} are multiplied.

So in a linear differential equation, both yy and dydx\frac{dy}{dx} must occur only to the first power, and the coefficient of yy must depend only on xx.

The Integrating Factor (I.F.)

To solve a linear differential equation, we multiply the whole equation by a special function called the Integrating Factor (I.F.).

For the equation dydx+P(x)y=Q(x),\frac{dy}{dx} + P(x)y = Q(x), the Integrating Factor is I.F.=eP(x)dx.\text{I.F.} = e^{\int P(x)\,dx}.

Why is this useful? Because after multiplying the equation by the I.F., the left-hand side becomes the exact derivative of the product yI.F.y \cdot \text{I.F.}: I.F.dydx+P(x)I.F.y=ddx(yI.F.).\text{I.F.}\cdot \frac{dy}{dx} + P(x)\cdot \text{I.F.}\cdot y = \frac{d}{dx}\big(y\cdot \text{I.F.}\big).

This is the key idea behind the method.

Important logarithm rule

When simplifying the I.F., expressions of the form elnf(x)e^{\ln f(x)} reduce to f(x),f(x), provided f(x)>0f(x) > 0; in applied textbook work we often write the simplified algebraic form directly. For example, e2xdx=e2lnx=eln(x2)=x2.e^{\int \frac{2}{x}dx} = e^{2\ln|x|} = e^{\ln(x^2)} = x^2.

The General Solution

Once the Integrating Factor is found, multiply the equation dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)y = Q(x) by the I.F. Then the equation becomes ddx(yI.F.)=Q(x)I.F..\frac{d}{dx}\big(y\cdot \text{I.F.}\big) = Q(x)\cdot \text{I.F.}. Integrating both sides with respect to xx, we get y(I.F.)=Q(x)(I.F.)dx+C.y\cdot (\text{I.F.}) = \int Q(x)\cdot (\text{I.F.})\,dx + C.

This is the standard formula for the general solution.

Step-by-step algorithm

  1. Write the equation in the form dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)y = Q(x).
  2. Identify P(x)P(x) and Q(x)Q(x).
  3. Find the Integrating Factor: I.F.=eP(x)dx.\text{I.F.} = e^{\int P(x)dx}.
  4. Use y(I.F.)=Q(x)(I.F.)dx+C.y\cdot (\text{I.F.}) = \int Q(x)\cdot (\text{I.F.})\,dx + C.
  5. Simplify the result and, if needed, solve explicitly for yy.

This method works only after the equation has been reduced to standard linear form.

The Alternate Form (Linear in xx)

Sometimes the given differential equation is not linear in yy, but it is linear in xx if we treat xx as the dependent variable and yy as the independent variable.

Then the standard form becomes dxdy+P1(y)x=Q1(y).\frac{dx}{dy} + P_1(y)x = Q_1(y). Here, P1(y)P_1(y) and Q1(y)Q_1(y) are constants or functions of yy only.

The method is exactly analogous:

  • Integrating Factor: I.F.=eP1(y)dy\text{I.F.} = e^{\int P_1(y)\,dy}
  • General solution: x(I.F.)=Q1(y)(I.F.)dy+Cx\cdot (\text{I.F.}) = \int Q_1(y)\cdot (\text{I.F.})\,dy + C

So the core idea remains the same; only the roles of xx and yy are interchanged.

Example 1: Standard Linear Equation

Solve the differential equation: dydx+2y=e3x\frac{dy}{dx} + 2y = e^{3x}.

Solution: Step 1: Compare with the standard form dydx+Py=Q.\frac{dy}{dx} + P y = Q. Here, P=2,Q=e3x.P = 2, \qquad Q = e^{3x}.

Step 2: Find the Integrating Factor. I.F.=e2dx=e2x.\text{I.F.} = e^{\int 2\,dx} = e^{2x}.

Step 3: Multiply the whole equation by e2xe^{2x}. e2xdydx+2e2xy=e5x.e^{2x}\frac{dy}{dx} + 2e^{2x}y = e^{5x}. The left-hand side is ddx(ye2x).\frac{d}{dx}(ye^{2x}). So, ddx(ye2x)=e5x.\frac{d}{dx}(ye^{2x}) = e^{5x}.

Step 4: Integrate both sides. ye2x=e5xdx+C=e5x5+C.ye^{2x} = \int e^{5x}\,dx + C = \frac{e^{5x}}{5} + C.

Step 5: Solve for yy. y=e5x5e2x+Ce2x=e3x5+Ce2x.y = \frac{e^{5x}}{5e^{2x}} + Ce^{-2x} = \frac{e^{3x}}{5} + Ce^{-2x}.

Answer: y=e3x5+Ce2xy = \frac{e^{3x}}{5} + Ce^{-2x}

Example 2: Normalizing the Equation

Solve: xdydx+2y=x2(x0)x \frac{dy}{dx} + 2y = x^2 \quad (x \neq 0).

Solution: Step 1: The coefficient of dydx\frac{dy}{dx} must be 1. Divide the entire equation by xx: dydx+2xy=x.\frac{dy}{dx} + \frac{2}{x}y = x. So, P=2x,Q=x.P = \frac{2}{x}, \qquad Q = x.

Step 2: Find the Integrating Factor. I.F.=e2xdx=e2lnx.\text{I.F.} = e^{\int \frac{2}{x}\,dx} = e^{2\ln|x|}. Since e2lnx=x2e^{2\ln|x|} = x^2, we take I.F.=x2.\text{I.F.} = x^2.

Step 3: Multiply the equation by x2x^2: x2dydx+2xy=x3.x^2\frac{dy}{dx} + 2xy = x^3. The left side is ddx(x2y).\frac{d}{dx}(x^2y). Hence, ddx(x2y)=x3.\frac{d}{dx}(x^2y) = x^3.

Step 4: Integrate: x2y=x3dx+C=x44+C.x^2y = \int x^3\,dx + C = \frac{x^4}{4} + C.

Step 5: Explicit form, if required: y=x24+Cx2.y = \frac{x^2}{4} + \frac{C}{x^2}.

Answer: x2y=x44+Cx^2 y = \frac{x^4}{4} + C

Example 3: Trigonometric Linear Equation

Solve: dydx+ysecx=tanx\frac{dy}{dx} + y \sec x = \tan x.

Solution: Step 1: Identify P=secx,Q=tanx.P = \sec x, \qquad Q = \tan x.

Step 2: Find the Integrating Factor. We know secxdx=lnsecx+tanx.\int \sec x\,dx = \ln|\sec x + \tan x|. Therefore, I.F.=elnsecx+tanx=secx+tanx.\text{I.F.} = e^{\ln|\sec x + \tan x|} = \sec x + \tan x.

Step 3: Apply the solution formula: y(secx+tanx)=tanx(secx+tanx)dx+C.y(\sec x + \tan x) = \int \tan x(\sec x + \tan x)\,dx + C. Expand the integrand: =(secxtanx+tan2x)dx+C.= \int (\sec x\tan x + \tan^2 x)\,dx + C. Use the identity tan2x=sec2x1.\tan^2 x = \sec^2 x - 1. Then, (secxtanx+sec2x1)dx.\int (\sec x\tan x + \sec^2 x - 1)\,dx.

Step 4: Integrate term by term: secxtanxdx=secx,\int \sec x\tan x\,dx = \sec x, sec2xdx=tanx,\int \sec^2 x\,dx = \tan x, 1dx=x.\int 1\,dx = x. So, y(secx+tanx)=secx+tanxx+C.y(\sec x + \tan x) = \sec x + \tan x - x + C.

Answer: y(secx+tanx)=secx+tanxx+Cy(\sec x + \tan x) = \sec x + \tan x - x + C

Example 4: Initial Value Problem (IVP)

Find the particular solution of dydx+ycotx=2x+x2cotx\frac{dy}{dx} + y \cot x = 2x + x^2 \cot x, given that y=0y = 0 when x=π2x = \frac{\pi}{2}.

Solution: Step 1: Identify P=cotx,Q=2x+x2cotx.P = \cot x, \qquad Q = 2x + x^2\cot x.

Step 2: Find the Integrating Factor. I.F.=ecotxdx=elnsinx=sinx.\text{I.F.} = e^{\int \cot x\,dx} = e^{\ln|\sin x|} = \sin x.

Step 3: Multiply through by sinx\sin x: ysinx=(2x+x2cotx)sinxdx+C.y\sin x = \int (2x + x^2\cot x)\sin x\,dx + C. Since cotxsinx=cosx\cot x \cdot \sin x = \cos x, this becomes ysinx=(2xsinx+x2cosx)dx+C.y\sin x = \int (2x\sin x + x^2\cos x)\,dx + C.

Step 4: Recognize the integrand as an exact derivative. ddx(x2sinx)=2xsinx+x2cosx.\frac{d}{dx}(x^2\sin x) = 2x\sin x + x^2\cos x. Therefore, (2xsinx+x2cosx)dx=x2sinx.\int (2x\sin x + x^2\cos x)\,dx = x^2\sin x. So the general solution is ysinx=x2sinx+C.y\sin x = x^2\sin x + C.

Step 5: Use the condition y=0y=0 when x=π2x=\frac{\pi}{2}. 0sin(π2)=(π2)2sin(π2)+C0\cdot \sin\left(\frac{\pi}{2}\right) = \left(\frac{\pi}{2}\right)^2 \sin\left(\frac{\pi}{2}\right) + C 0=π24+C0 = \frac{\pi^2}{4} + C C=π24.C = -\frac{\pi^2}{4}.

Step 6: Substitute back: ysinx=x2sinxπ24.y\sin x = x^2\sin x - \frac{\pi^2}{4}.

Answer: ysinx=x2sinxπ24y\sin x = x^2\sin x - \frac{\pi^2}{4}

Example 5: Linear in xx (Alternate Form)

Solve: (y2+1)dxdy+x=etan1y(y^2 + 1) \frac{dx}{dy} + x = e^{\tan^{-1} y}.

Solution: Step 1: Divide by (y2+1)(y^2+1) to get standard linear form in xx: dxdy+1y2+1x=etan1yy2+1.\frac{dx}{dy} + \frac{1}{y^2+1}x = \frac{e^{\tan^{-1} y}}{y^2+1}. Thus, P1=1y2+1,Q1=etan1yy2+1.P_1 = \frac{1}{y^2+1}, \qquad Q_1 = \frac{e^{\tan^{-1} y}}{y^2+1}.

Step 2: Find the Integrating Factor with respect to yy: I.F.=e1y2+1dy=etan1y.\text{I.F.} = e^{\int \frac{1}{y^2+1}\,dy} = e^{\tan^{-1} y}.

Step 3: Apply the solution formula: xetan1y=etan1yy2+1etan1ydy+Cx e^{\tan^{-1} y} = \int \frac{e^{\tan^{-1} y}}{y^2+1} \cdot e^{\tan^{-1} y}\,dy + C xetan1y=e2tan1yy2+1dy+C.x e^{\tan^{-1} y} = \int \frac{e^{2\tan^{-1} y}}{y^2+1}\,dy + C.

Step 4: Use substitution. Let t=tan1y    dt=1y2+1dy.t = \tan^{-1} y \implies dt = \frac{1}{y^2+1}dy. Then the integral becomes e2tdt=e2t2=e2tan1y2.\int e^{2t}\,dt = \frac{e^{2t}}{2} = \frac{e^{2\tan^{-1} y}}{2}.

Step 5: Final solution: xetan1y=12e2tan1y+C.x e^{\tan^{-1} y} = \frac{1}{2}e^{2\tan^{-1} y} + C.

Answer: xetan1y=12e2tan1y+Cx e^{\tan^{-1} y} = \frac{1}{2} e^{2\tan^{-1} y} + C

Example 6: Finding the Integrating Factor

Find the Integrating Factor of the differential equation: xlnxdydx+y=2lnxx \ln x \frac{dy}{dx} + y = 2 \ln x.

Solution: Step 1: Divide by xlnxx\ln x to normalize the equation: dydx+1xlnxy=2x.\frac{dy}{dx} + \frac{1}{x\ln x}y = \frac{2}{x}. So, P(x)=1xlnx.P(x) = \frac{1}{x\ln x}.

Step 2: Compute the Integrating Factor: I.F.=e1xlnxdx.\text{I.F.} = e^{\int \frac{1}{x\ln x}\,dx}. Let t=lnx    dt=1xdx.t = \ln x \implies dt = \frac{1}{x}dx. Then 1xlnxdx=1tdt=lnt=ln(lnx).\int \frac{1}{x\ln x}dx = \int \frac{1}{t}dt = \ln|t| = \ln(\ln x). Hence, I.F.=eln(lnx)=lnx.\text{I.F.} = e^{\ln(\ln x)} = \ln x.

Answer: I.F. =lnx= \ln x

Example 7: Involving Inverse Trigonometry

Solve: (1x2)dydxxy=1(1 - x^2) \frac{dy}{dx} - xy = 1.

Solution: Step 1: Divide by (1x2)(1-x^2): dydxx1x2y=11x2.\frac{dy}{dx} - \frac{x}{1-x^2}y = \frac{1}{1-x^2}. So, P=x1x2,Q=11x2.P = -\frac{x}{1-x^2}, \qquad Q = \frac{1}{1-x^2}.

Step 2: Find the Integrating Factor. Pdx=x1x2dx.\int P\,dx = \int -\frac{x}{1-x^2}\,dx. Let t=1x2    dt=2xdx.t = 1-x^2 \implies dt = -2x\,dx. Then x1x2dx=12dtt=12lnt=12ln1x2.\int -\frac{x}{1-x^2}\,dx = \frac{1}{2}\int \frac{dt}{t} = \frac{1}{2}\ln|t| = \frac{1}{2}\ln|1-x^2|. Hence, I.F.=e12ln1x2=1x2.\text{I.F.} = e^{\frac{1}{2}\ln|1-x^2|} = \sqrt{|1-x^2|}. In the standard textbook interval where 1x2>01-x^2>0, this is written as I.F.=1x2.\text{I.F.} = \sqrt{1-x^2}.

Step 3: Apply the formula: y1x2=11x21x2dx+Cy\sqrt{1-x^2} = \int \frac{1}{1-x^2}\sqrt{1-x^2}\,dx + C y1x2=11x2dx+C.y\sqrt{1-x^2} = \int \frac{1}{\sqrt{1-x^2}}\,dx + C.

Step 4: Integrate: 11x2dx=sin1x.\int \frac{1}{\sqrt{1-x^2}}\,dx = \sin^{-1}x. So, y1x2=sin1x+C.y\sqrt{1-x^2} = \sin^{-1}x + C.

Answer: y1x2=sin1x+Cy\sqrt{1-x^2} = \sin^{-1}x + C

Example 8: A Tricky Substitution Leading to an LDE

Solve: dydx+y=y2ex\frac{dy}{dx} + y = y^2 e^x. (This is a Bernoulli differential equation, reducible to a Linear Differential Equation.)

Solution: Step 1: Divide the equation by y2y^2: y2dydx+y1=ex.y^{-2}\frac{dy}{dx} + y^{-1} = e^x.

Step 2: Use the substitution v=y1.v = y^{-1}. Then dvdx=y2dydx    y2dydx=dvdx.\frac{dv}{dx} = -y^{-2}\frac{dy}{dx} \implies y^{-2}\frac{dy}{dx} = -\frac{dv}{dx}. Substitute into the equation: dvdx+v=ex.-\frac{dv}{dx} + v = e^x. Multiply by 1-1: dvdxv=ex.\frac{dv}{dx} - v = -e^x. This is linear in vv.

Step 3: Identify P=1,Q=ex.P = -1, \qquad Q = -e^x. So, I.F.=e1dx=ex.\text{I.F.} = e^{\int -1\,dx} = e^{-x}.

Step 4: Apply the formula: vex=(ex)(ex)dx+C=(1)dx+Cv e^{-x} = \int (-e^x)(e^{-x})\,dx + C = \int (-1)\,dx + C vex=x+C.v e^{-x} = -x + C.

Step 5: Replace v=1/yv = 1/y: exy=Cx.\frac{e^{-x}}{y} = C - x. Multiply by yy: ex=y(Cx).e^{-x} = y(C-x).

Answer: y(Cx)=exy(C - x) = e^{-x}

Example 9: Complex Integration

Solve: xdydx+y=xcosx+sinxx \frac{dy}{dx} + y = x \cos x + \sin x.

Solution: Step 1: Divide by xx: dydx+1xy=cosx+sinxx.\frac{dy}{dx} + \frac{1}{x}y = \cos x + \frac{\sin x}{x}. Thus, P=1x,Q=cosx+sinxx.P = \frac{1}{x}, \qquad Q = \cos x + \frac{\sin x}{x}.

Step 2: Find the Integrating Factor: I.F.=e1xdx=elnx=x.\text{I.F.} = e^{\int \frac{1}{x}\,dx} = e^{\ln|x|} = x.

Step 3: Apply the formula: xy=(cosx+sinxx)xdx+Cxy = \int \left(\cos x + \frac{\sin x}{x}\right)x\,dx + C xy=(xcosx+sinx)dx+C.xy = \int (x\cos x + \sin x)\,dx + C.

Step 4: Recognize the integrand: ddx(xsinx)=xcosx+sinx.\frac{d}{dx}(x\sin x) = x\cos x + \sin x. So, xy=xsinx+C.xy = x\sin x + C.

Answer: xy=xsinx+Cxy = x\sin x + C

Example 10: Recognizing Alternate Form

Solve: (x+2y3)dydx=y(x + 2y^3) \frac{dy}{dx} = y.

Solution: Step 1: Solving directly for dydx\frac{dy}{dx} does not give a linear equation in yy. So invert the derivative: dxdy=x+2y3y=xy+2y2.\frac{dx}{dy} = \frac{x+2y^3}{y} = \frac{x}{y} + 2y^2.

Step 2: Rearrange into linear form in xx: dxdy1yx=2y2.\frac{dx}{dy} - \frac{1}{y}x = 2y^2. So, P1=1y,Q1=2y2.P_1 = -\frac{1}{y}, \qquad Q_1 = 2y^2.

Step 3: Find the Integrating Factor with respect to yy: I.F.=e1ydy=elny=1y.\text{I.F.} = e^{\int -\frac{1}{y}\,dy} = e^{-\ln|y|} = \frac{1}{|y|}. In the standard working form, this is written as I.F.=1y.\text{I.F.} = \frac{1}{y}.

Step 4: Apply the formula: x1y=2y21ydy+Cx\cdot \frac{1}{y} = \int 2y^2\cdot \frac{1}{y}\,dy + C xy=2ydy+C=y2+C.\frac{x}{y} = \int 2y\,dy + C = y^2 + C.

Step 5: Multiply by yy: x=y3+Cy.x = y^3 + Cy.

Answer: x=y3+Cyx = y^3 + Cy