Differential Equations: Speed-Solving Techniques (8)

medium 2 min read

Question

Solve the differential equation dydx+ytanx=sinx\dfrac{dy}{dx} + y\tan x = \sin x.

Solution — Step by Step

This is a linear first-order ODE: dydx+P(x)y=Q(x)\dfrac{dy}{dx} + P(x)y = Q(x) with P=tanxP = \tan x, Q=sinxQ = \sin x.

IF=ePdx=etanxdx=elnsecx=secxIF = e^{\int P\,dx} = e^{\int \tan x\,dx} = e^{\ln|\sec x|} = \sec x

secxdydx+ysecxtanx=secxsinx=tanx\sec x \frac{dy}{dx} + y\sec x \tan x = \sec x \sin x = \tan x

The left side is ddx(ysecx)\dfrac{d}{dx}(y\sec x). So:

ddx(ysecx)=tanx\frac{d}{dx}(y\sec x) = \tan x

Integrate:

ysecx=tanxdx=lnsecx+Cy \sec x = \int \tan x\,dx = \ln|\sec x| + C

y=cosx(lnsecx+C)y = \cos x \cdot (\ln|\sec x| + C)

Final answer: y=cosxlnsecx+Ccosxy = \cos x \cdot \ln|\sec x| + C\cos x

Why This Works

The integrating factor turns a non-exact equation into an exact one. After multiplying, the LHS becomes ddx(yIF)\dfrac{d}{dx}(y \cdot IF), which integrates trivially.

The IF for a linear ODE in standard form is always ePdxe^{\int P\,dx} — memorise this and you can solve any first-order linear equation in 90 seconds.

Alternative Method

For this specific form, you could also try variation of parameters: solve the homogeneous equation dy/dx+ytanx=0dy/dx + y\tan x = 0 first (separable, gives y=Ccosxy = C\cos x), then guess y=u(x)cosxy = u(x)\cos x and solve for uu. More work, same answer.

Common Mistake

Students forget the absolute value in lnsecx\ln|\sec x|. The IF is elnsecx=secxe^{\ln|\sec x|} = |\sec x|, but for problems on intervals where secx>0\sec x > 0 (like π/2<x<π/2-\pi/2 < x < \pi/2), we drop the absolute value.

Also: a common error is to write the IF as secxtanx\sec x \tan x (multiplying instead of exponentiating). Always exponentiate Pdx\int P\,dx.

If the equation isn’t already in dy/dx+Py=Qdy/dx + Py = Q form, divide through to get there first. JEE often disguises linear ODEs by hiding the dy/dxdy/dx coefficient.

Want to master this topic?

Read the complete guide with more examples and exam tips.

Go to full topic guide →

Try These Next