Q.Find the general solution of the differential equation dxdy−y=cosx.
Concept understanding — Integrating Factor Method
Integrating Factor Method
Some first-order differential equations refuse to separate — you cannot get all the y's on one side and all the x's on the other. The integrating factor method is the standard trick for a special (and very common) family of these: the linear first-order equation. The idea is beautifully simple: multiply the whole equation by one cleverly chosen function, and the messy left-hand side collapses into a single derivative that we can integrate directly.
The Standard Form
An equation is linear of first order if it can be written as
dxdy+Py=Q
where P and Q are functions of x alone (or constants). Notice y and dxdy appear only to the first power, and never multiplied together — that is what "linear" means here.
Always rearrange into this exact shape first. The coefficient of dxdy must be 1 before you read off P and Q.
The Integrating Factor
The magic multiplier is
I.F.=e∫Pdx.
Why this one? Multiply the equation by e∫Pdx:
e∫Pdxdxdy+Pe∫Pdxy=Qe∫Pdx.
By the product rule, the left-hand side is exactly dxd(y⋅e∫Pdx), because the derivative of e∫Pdx is Pe∫Pdx. So the equation becomes
dxd(y⋅I.F.)=Q⋅I.F.
The left side is now a single derivative — that is the whole point of choosing this factor.
The Solution
Integrate both sides with respect to x:
y⋅I.F.=∫(Q⋅I.F.)dx+C.
This is the general solution. In words: (solution) × (integrating factor) = integral of (Q × integrating factor), plus a constant.
A Quick Illustration
For dxdy+x1y=x, we read P=x1, Q=x. Then ∫Pdx=logx, so I.F.=elogx=x. The solution is
y⋅x=∫x⋅xdx+C=3x3+C.
The Same Idea the Other Way Round
If an equation is linear in x instead — that is, dydx+Px=Q with P,Q functions of y — the method is identical with the roles of x and y swapped: I.F.=e∫Pdy and x⋅I.F.=∫Q⋅I.F.dy+C.
Don't add a constant of integration when computing ∫Pdx for the I.F. — any one antiderivative works, and the single constant C at the final integration captures the whole family of solutions.
The integrating factor method for linear first-order differential equations is one of the highest-weightage techniques in the NCERT Class 12 Differential Equations chapter, and "integrating factor formula and examples" is a top search term among CBSE and JEE Main aspirants. Getting comfortable converting an equation into the standard dy/dx + Py = Q form is the single most useful skill for this whole topic.
The key idea is that this is a linear first-order ODE — we solve it using an integrating factor.
Step 1 – Identify the standard form
The equation is already in the form dxdy+P(x)y=Q(x) with P(x)=−1 and Q(x)=cosx.
Step 2 – Find the integrating factor
μ(x)=e∫Pdx=e∫−1dx=e−x
Step 3 – Multiply through and integrate
Multiplying: e−xdxdy−e−xy=e−xcosx
The left side is dxd(ye−x), so:
dxd(ye−x)=e−xcosx
Integrate both sides:
ye−x=∫e−xcosxdx
Using integration by parts (or the standard formula), we get:
∫e−xcosxdx=2e−x(sinx−cosx)+C
Step 4 – Solve for y
Multiply through by ex:
y=21(sinx−cosx)+Cex
The general solution is y=21(sinx−cosx)+Cex.
This is a first-order linear ODE solved using the integrating factor method. The general solution is y=21sinx−21cosx+Cex.
The equation dxdy−y=cosx is a first-order linear ordinary differential equation. It has the standard form dxdy+P(x)y=Q(x), where here P(x)=−1 and Q(x)=cosx.
The key idea: we cannot directly integrate because y and its derivative are mixed. But we can multiply both sides by a cleverly chosen function — the integrating factor — that turns the left-hand side into the derivative of a product. Once that happens, we just integrate both sides.
Step-by-step solution
1. Identify the integrating factor.
For an equation of the form dxdy+P(x)y=Q(x), the integrating factor is
μ(x)=e∫P(x)dx.
Here P(x)=−1, so
∫P(x)dx=∫(−1)dx=−x.
Thus
μ(x)=e−x.
2. Multiply the entire equation by μ(x).
Original: dxdy−y=cosx.
Multiply by e−x:
e−xdxdy−e−xy=e−xcosx.
Notice the left-hand side is exactly the derivative of y⋅e−x with respect to x (by the product rule). Check:
dxd(ye−x)=dxdye−x+y⋅(−e−x)=e−xdxdy−e−xy.
So the equation becomes
dxd(ye−x)=e−xcosx.
3. Integrate both sides.
ye−x=∫e−xcosxdx+C.
Now we need the integral I=∫e−xcosxdx. This is a classic integration by parts (or use the formula for ∫eaxcos(bx)dx). Let's do it carefully.
›Proof
Evaluating ∫e−xcosxdx
Use integration by parts twice. Let u=e−x, dv=cosxdx. Then du=−e−xdx, v=sinx.
I=e−xsinx−∫sinx⋅(−e−x)dx=e−xsinx+∫e−xsinxdx.
Now integrate ∫e−xsinxdx by parts again: let u=e−x, dv=sinxdx, so du=−e−xdx, v=−cosx.
∫e−xsinxdx=−e−xcosx−∫(−cosx)(−e−x)dx=−e−xcosx−∫e−xcosxdx.
Substitute back:
I=e−xsinx+(−e−xcosx−I)=e−xsinx−e−xcosx−I.
So 2I=e−x(sinx−cosx), hence
I=21e−x(sinx−cosx).
Thus
ye−x=21e−x(sinx−cosx)+C.
4. Solve for y.
Multiply both sides by ex:
y=21(sinx−cosx)+Cex.
A common mistake is forgetting the constant of integration C or misplacing the sign when integrating by parts. Always check by differentiating your final answer.
The general solution is y=21sinx−21cosx+Cex.
Method: Integrating factor for a linear first-order equation
Use this whenever the equation can be put in the linear standard form dxdy+P(x)y=Q(x) — the unknown y and its derivative appear only to the first power and are not multiplied together.
Steps
Step 1: Identify P(x) and Q(x).
Match the equation to dxdy+P(x)y=Q(x); read off P (the coefficient of y) and Q (everything on the right).
Step 2: Compute the integrating factor.
μ(x)=e∫P(x)dx.
Step 3: Multiply through; the left side becomes an exact derivative.
By design, μdxdy+μPy=dxd(μy), so the equation reads dxd(μy)=μQ.
Step 4: Integrate both sides and solve for y.
μy=∫μQdx+C.
When μQ is a product like e−xcosx, use integration by parts twice and solve for the repeating integral algebraically.
Common Mistakes
Mistake 1: Taking P(x) with the wrong sign.
Why it's wrong: the equation is dxdy+P(x)y=Q(x) with P=−1 here (not +1), so μ=e−x. A sign error gives the wrong integrating factor. Correct approach: rewrite as dxdy+(−1)y=cosx and read P=−1.
Mistake 2: Giving up on ∫e−xcosxdx.
Why it's wrong: it does not have an elementary "obvious" antiderivative but is standard via parts twice, after which you solve algebraically for the repeating integral. Correct approach: apply integration by parts twice and rearrange to get 21e−x(sinx−cosx).
Mistake 3: Forgetting the constant C.
Why it's wrong: the general solution needs the Cex term. Correct approach: add C when integrating, then multiply by ex.
Showing the 12 most recent of 15 on this concept.
- KEAM 2026Set eng-2026-04174 marksMCQQ.The general solution of the differential equation x3dxdy+3x2y=cosx is (A) y=x3sinx+C (B) y=x3sinx+Cx (C) y=x2sinx+C (D) y=x2sinx+C (E) y=x3sinx+C
›Reveal solutionSolution
Recognize the exact derivative dxd(x3y).
Since dxd(x3y)=x3dxdy+3x2y, the equation x3dxdy+3x2y=cosx becomes
dxd(x3y)=cosx.
Integrating: x3y=sinx+C, hence
y=x3sinx+C.
✓Final answerThe correct option is (E).
- KEAM 2026Set eng-2026-04174 marksMCQQ.The integrating factor of the differential equation 2dy=(y+cosx)dx is (A) e−2x (B) e−x/2 (C) e2x (D) ex/2 (E) −ex/2
›Reveal solutionSolution
Put in standard linear form and read off the integrating factor.
From 2dy=(y+cosx)dx:
2dxdy=y+cosx ⇒ dxdy−21y=21cosx.
This is linear with P(x)=−21, so the integrating factor is
e∫Pdx=e−x/2.
✓Final answerThe correct option is (B).
- KEAM 2026Set eng-2026-04184 marksMCQQ.The integrating factor of the differential equation dxdy+20−x2y=10 is (A) (20−x)21 (B) 20−x1 (C) 20−x (D) loge∣20−x∣ (E) loge(20−x)2
›Reveal solutionSolution
The integrating factor is e∫Pdx with P=20−x2, which evaluates to (20−x)21.
For dxdy+Py=Q with P=20−x2,
∫Pdx=∫20−x2dx=−2log∣20−x∣.
Hence IF =e−2log∣20−x∣=∣20−x∣−2=(20−x)21.
✓Final answerThe correct option is (A).
- KEAM 2026Set eng-2026-04224 marksMCQQ.The solution of the differential equation (y+x2)dx=xdy,x>0 is a curve which passes through the point (1,0). The equation of the curve is (A) y=x(x+1) (B) y=x(x−1) (C) y=x2(x−1) (D) y=x2(x+1) (E) y=x(x2−1)
›Reveal solutionSolution
Rewrite as a first-order linear ODE y′−y/x=x, use integrating factor 1/x, then apply the point (1,0).
From (y+x2)dx=xdy: xdxdy=y+x2⇒dxdy−xy=x.
Integrating factor =e−∫dx/x=x1, so dxd(xy)=1.
Thus xy=x+C⇒y=x2+Cx.
At (1,0): 0=1+C⇒C=−1, giving y=x2−x=x(x−1).
✓Final answerThe correct option is (B).
- KEAM 2025Set eng-2025-04234 marksMCQQ.The integrating factor of the differential equation sinxdy=21(sin2x+2ycosx)dx is (A) secx (B) sinx (C) tanx (D) cosx (E) cscx
›Reveal solutionSolution
The equation reduces to y' - (cot x) y = cos x, giving integrating factor e^{-integral cot x dx} = csc x.
Concept and Intuition
Rewrite the equation in standard linear form dy/dx + P(x)y = Q(x); the integrating factor is e^{integral P dx}.
Step-by-Step Solution
- sin x dy = (1/2)(sin2x + 2y cos x) dx; using sin2x = 2 sin x cos x, the RHS = (sin x cos x + y cos x) dx.
- So sin x (dy/dx) = sin x cos x + y cos x, i.e. dy/dx = cos x + y cot x.
- Standard form: dy/dx - (cot x) y = cos x, so P(x) = -cot x.
- IF = e^{integral -cot x dx} = e^{-log|sin x|} = 1/sin x = csc x.
Common Mistakes
- Sign error on P(x) that flips csc x to sin x.
✓Final answerThe correct option is (E) — csc x.
ANSWER: E
- KEAM 2025Set eng-2025-04254 marksMCQQ.The integrating factor of the differential equation (1+x2)dy=(1−2xy)dx is (A) x2+1 (B) loge(x2+1) (C) x2+1x (D) x(x2+1) (E) loge∣x∣
›Reveal solutionSolution
Put in standard linear form dxdy+Py=Q and compute e∫Pdx.
Rewrite (1+x2)dy=(1−2xy)dx as
dxdy+1+x22xy=1+x21.
Here P=1+x22x, so
IF=e∫1+x22xdx=eloge(1+x2)=1+x2.
✓Final answerThe correct option is (A).
- KEAM 2025Set eng-2025-04274 marksMCQQ.The integrating factor of the differential equation dxdy−2y=2x−3 is (A) e2x (B) 2−1e−2x (C) 21e−2x (D) 21e−2x (E) e−2x
›Reveal solutionSolution
[!TLDR]
With P(x)=−2, the integrating factor e∫Pdx=e−2x.
Concept
A linear first-order differential equation in the form dxdy+P(x)y=Q(x) is solved by multiplying through by the integrating factor μ(x)=e∫P(x)dx — the standard method in the NCERT/CBSE differential-equations chapter.
Solution
The equation is
dxdy−2y=2x−3.
Comparing with dxdy+P(x)y=Q(x), we read off P(x)=−2.
The integrating factor is
μ(x)=e∫Pdx=e∫(−2)dx=e−2x.
[!ANSWER]
(E) e−2x
- KEAM 2024Set eng-2024-06054 marksMCQQ.The integrating factor of (1+2e−x)dxdy−2e−xy=1+e−x is (A) 2e−x (B) 1+e−x (C) 1−e−x (D) 1−2e−x (E) 1+2e−x
›Reveal solutionSolution
∫Pdx=log(1+2e−x), so the integrating factor is 1+2e−x.
Divide by (1+2e−x):
dxdy−1+2e−x2e−xy=1+2e−x1+e−x,
so P(x)=−1+2e−x2e−x. With w=1+2e−x, dw=−2e−xdx:
∫Pdx=∫wdw=log∣1+2e−x∣.
Hence IF =elog(1+2e−x)=1+2e−x.
✓Final answerThe correct option is (E).
- KEAM 2024Set eng-2024-06064 marksMCQQ.The integrating factor of the differential equation xdxdy+2y=xex is (A) logex (B) loge2x (C) x (D) x2 (E) 2x
›Reveal solutionSolution
Dividing by x gives P(x)=x2, so the integrating factor is x2.
Divide xdxdy+2y=xex by x: dxdy+x2y=ex.
The integrating factor is e∫x2dx=e2logx=x2.
✓Final answerThe correct option is (D).
- KEAM 2024Set eng-2024-06074 marksMCQQ.The general solution of the differential equation 2ytanx+dxdy=5sinx is (A) y=5secx+Csec2x (B) y=5+Ccosx (C) y=5cosx+C (D) y=5cosx+Ccos2x (E) y=5sec2x+Csecx
›Reveal solutionSolution
Solve the linear ODE with integrating factor sec2x.
Rewrite as dxdy+2tanxy=5sinx. Integrating factor:
μ=e∫2tanxdx=e2logsecx=sec2x.
Then
dxd(ysec2x)=5sinxsec2x=5cos2xsinx.
Integrating the right side: ∫5cos2xsinxdx=cosx5=5secx. So
ysec2x=5secx+C⇒y=5cosx+Ccos2x.
✓Final answerThe correct option is (D).
- KEAM 2024Set eng-2024-06074 marksMCQQ.The integrating factor of the differential equation (3sinxcosx)dy=(1+3ysin2x)dx, where 0<x<2π, is (A) secx (B) sinx (C) tanx (D) cosx (E) cotx
›Reveal solutionSolution
Put in linear form; the coefficient of y gives IF =cosx.
From (3sinxcosx)dy=(1+3ysin2x)dx:
dxdy=3sinxcosx1+3ysin2x=3sinxcosx1+3sinxcosx3sin2xy.
The y-coefficient is cosxsinx=tanx, so
dxdy−tanxy=3sinxcosx1.
Integrating factor:
μ=e∫−tanxdx=elogcosx=cosx.
✓Final answerThe correct option is (D).
- KEAM 2024Set eng-2024-06094 marksMCQQ.The general solution of dxdy+y=5 is (A) −log∣5−y∣=x+C (B) −log∣5−y∣=ex+C (C) (5−y)2=2x+C (D) y=log∣x+C∣ (E) log∣x∣+C
›Reveal solutionSolution
The equation is separable: 5−ydy=dx, which integrates to −log∣5−y∣=x+C.
Write dxdy=5−y, so 5−ydy=dx.
Integrating the left side, ∫5−ydy=−log∣5−y∣, hence
−log∣5−y∣=x+C.
✓Final answerThe correct option is (A).
🎓Unlock everything free for 14 days
- ✓Full step-by-step solutions
- ✓Concept-first explanations
- ✓Methods, shortcuts & mistakes
- ✓PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.