Question
Solve the differential equation dxdy+ytanx=sinx.
Solution — Step by Step
This is a linear first-order ODE: dxdy+P(x)y=Q(x) with P=tanx, Q=sinx.
IF=e∫Pdx=e∫tanxdx=eln∣secx∣=secx
secxdxdy+ysecxtanx=secxsinx=tanx
The left side is dxd(ysecx). So:
dxd(ysecx)=tanx
Integrate:
ysecx=∫tanxdx=ln∣secx∣+C
y=cosx⋅(ln∣secx∣+C)
Final answer: y=cosx⋅ln∣secx∣+Ccosx
Why This Works
The integrating factor turns a non-exact equation into an exact one. After multiplying, the LHS becomes dxd(y⋅IF), which integrates trivially.
The IF for a linear ODE in standard form is always e∫Pdx — 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=0 first (separable, gives y=Ccosx), then guess y=u(x)cosx and solve for u. More work, same answer.
Common Mistake
Students forget the absolute value in ln∣secx∣. The IF is eln∣secx∣=∣secx∣, but for problems on intervals where secx>0 (like −π/2<x<π/2), we drop the absolute value.
Also: a common error is to write the IF as secxtanx (multiplying instead of exponentiating). Always exponentiate ∫Pdx.
If the equation isn’t already in dy/dx+Py=Q form, divide through to get there first. JEE often disguises linear ODEs by hiding the dy/dx coefficient.