Linear differential equations (first order)

A first-order differential equation is called linear when the dependent variable and its derivative appear only to the first power, with no products like y dydxy\,\dfrac{dy}{dx} or terms like y2y^2. Such an equation usually cannot be split into "xx-stuff on one side, yy-stuff on the other" the way a separable equation can. Instead, CBSE teaches a clever trick: multiply the whole equation by a special function called the integrating factor (IF), chosen precisely so that the left-hand side collapses into the derivative of a single product. Once that happens, the equation solves itself by direct integration. This is the third and last solving technique in the Class 12 Differential Equations chapter, after variables separable and homogeneous equations. The syllabus restricts you to two standard forms — linear in yy, or linear in xx — and one job: identify the form, build the IF, plug into a fixed formula, and integrate. Exact equations and Bernoulli's equation are outside this syllabus.

The core insight

Multiplying dydx+py=q\dfrac{dy}{dx}+py=q by the integrating factor e∫p dxe^{\int p\,dx} turns the left side into ddx(y⋅IF)\dfrac{d}{dx}(y\cdot\mathrm{IF}), so the whole equation integrates directly to give yy.

The core idea

Recognise the standard form. A first-order linear equation in yy looks like

dydx+py=q,\frac{dy}{dx} + py = q,

where pp and qq are constants or functions of xx only — never of yy. If the equation you are given is not already written this way (coefficient of dydx\dfrac{dy}{dx} not equal to 11), divide through first; reading off pp and qq from the un-simplified equation is the single most common source of error.

Build the integrating factor. The IF is defined as

IF=e∫p dx.\mathrm{IF} = e^{\int p\,dx}.

where: pp is the coefficient function from the standard form and ∫p dx\int p\,dx is computed without a constant of integration (any constant would cancel out later, so it is dropped by convention).

Read off the solution formula. Multiplying the standard equation by IF\mathrm{IF} and integrating both sides gives the general solution directly:

y⋅IF=∫(q⋅IF) dx+C.y \cdot \mathrm{IF} = \int (q \cdot \mathrm{IF})\,dx + C.

where: CC is the arbitrary constant of integration, fixed by an initial condition if one is given.

Mind the mirror form. Some equations are more naturally linear in xx (treating xx as the dependent variable), with standard form dxdy+px=q\dfrac{dx}{dy}+px=q, where p,qp,q are functions of yy only. The same machinery applies with xx and yy swapped: IF=e∫p dy\mathrm{IF}=e^{\int p\,dy} and x⋅IF=∫(q⋅IF) dy+Cx\cdot\mathrm{IF} = \int (q\cdot\mathrm{IF})\,dy + C. Deciding which variable the equation is linear in — before touching the formula — is the real skill being tested. A quick giveaway: if isolating dydx\dfrac{dy}{dx} leaves a coefficient or a right-hand side that still depends on yy, the equation is not linear in yy at all, and you should instead try writing it as dxdy+px=q\dfrac{dx}{dy}+px=q and check whether p,qp,q come out depending only on yy.

Why this is different from the earlier two methods. Variables separable equations let you sort every xx-term to one side and every yy-term to the other before integrating; homogeneous equations use the substitution y=vxy=vx to reduce to a separable one. A linear equation of the form dydx+py=q\dfrac{dy}{dx}+py=q generally cannot be separated or reduced by y=vxy=vx at all — the yy and xx dependence are tangled together through the sum pypy. The integrating factor is not a substitution that changes variables; it is a multiplier that reshapes the equation itself so that ordinary integration becomes possible, which is why it is introduced as a genuinely new technique rather than a variant of the first two.

Figure
A flow diagram showing the four steps from a linear differential equation to its general solution
From standard form to general solution Standard form dy/dx + py = q Integrating factor IF = e^(integral p dx) Multiply through d/dx(y . IF) = q . IF Integrate y.IF = integral(q.IF)dx + C Same four steps apply with x and y swapped when the equation is linear in x instead. Deciding which variable the equation is linear in comes before step one.
Derivation AWhy the integrating factor makes the equation directly integrable

The goal is to show, from the product rule alone, that multiplying dydx+py=q\dfrac{dy}{dx}+py=q by IF=e∫p dx\mathrm{IF}=e^{\int p\,dx} turns the left-hand side into the exact derivative ddx(y⋅IF)\dfrac{d}{dx}(y\cdot\mathrm{IF}), which is the entire reason the method works and the fact every student is expected to justify, not just apply.

Step 1. Multiply the standard equation dydx+py=q\dfrac{dy}{dx}+py=q throughout by IF=e∫p dx\mathrm{IF}=e^{\int p\,dx}. This gives IF⋅dydx+p⋅IF⋅y=q⋅IF\mathrm{IF}\cdot\dfrac{dy}{dx} + p\cdot\mathrm{IF}\cdot y = q\cdot\mathrm{IF}. Nothing has been solved yet — this is just a relabelling of the same equation with every term scaled by the same function of xx.

Step 2. Differentiate IF\mathrm{IF} itself using the chain rule. Since IF=e∫p dx\mathrm{IF}=e^{\int p\,dx}, d(IF)dx=e∫p dx⋅ddx(∫p dx)=IF⋅p\dfrac{d(\mathrm{IF})}{dx} = e^{\int p\,dx}\cdot\dfrac{d}{dx}\left(\int p\,dx\right) = \mathrm{IF}\cdot p, because the derivative of ∫p dx\int p\,dx with respect to xx is simply pp by the fundamental theorem of calculus.

Step 3. Now apply the product rule to y⋅IFy\cdot\mathrm{IF}: ddx(y⋅IF)=dydx⋅IF+y⋅d(IF)dx=IF⋅dydx+y⋅(IF⋅p)\dfrac{d}{dx}\big(y\cdot\mathrm{IF}\big) = \dfrac{dy}{dx}\cdot\mathrm{IF} + y\cdot\dfrac{d(\mathrm{IF})}{dx} = \mathrm{IF}\cdot\dfrac{dy}{dx} + y\cdot(\mathrm{IF}\cdot p). Compare this term by term with the left-hand side obtained in Step 1 — they are identical, so IF⋅dydx+p⋅IF⋅y=ddx(y⋅IF)\mathrm{IF}\cdot\dfrac{dy}{dx} + p\cdot\mathrm{IF}\cdot y = \dfrac{d}{dx}\big(y\cdot\mathrm{IF}\big) exactly.

Step 4. Substitute this back into the multiplied equation from Step 1: the left side becomes ddx(y⋅IF)\dfrac{d}{dx}(y\cdot\mathrm{IF}), so the whole equation reads ddx(y⋅IF)=q⋅IF\dfrac{d}{dx}\big(y\cdot\mathrm{IF}\big) = q\cdot\mathrm{IF}. Integrating both sides with respect to xx removes the derivative on the left and leaves y⋅IF=∫(q⋅IF) dx+Cy\cdot\mathrm{IF} = \int(q\cdot\mathrm{IF})\,dx + C, the general solution formula, now shown to follow from nothing more than the product rule and the definition of IF\mathrm{IF}.

Worked example

Solve dydx+yx=x2\dfrac{dy}{dx} + \dfrac{y}{x} = x^2, for x>0x>0.

Step 1. Identify the standard form. The equation already matches dydx+py=q\dfrac{dy}{dx}+py=q with p=1xp=\dfrac{1}{x} and q=x2q=x^2; no rearrangement is needed since the coefficient of dydx\dfrac{dy}{dx} is already 11.

Step 2. Compute the integrating factor: IF=e∫p dx=e∫1x dx=eln⁡x=x\mathrm{IF} = e^{\int p\,dx} = e^{\int \frac{1}{x}\,dx} = e^{\ln x} = x (since x>0x>0, no absolute value is needed).

Step 3. Apply the solution formula: y⋅x=∫(x2⋅x)dx+C=∫x3 dx+C=x44+Cy\cdot x = \int\left(x^2\cdot x\right)dx + C = \int x^3\,dx + C = \dfrac{x^4}{4}+C.

Step 4. Solve for yy: xy=x44+C  ⟹  y=x34+Cxxy = \dfrac{x^4}{4}+C \implies \boxed{y = \dfrac{x^3}{4} + \dfrac{C}{x}}. Checking by differentiating confirms dydx+yx=3x24−Cx2+x24+Cx2=x2\dfrac{dy}{dx}+\dfrac{y}{x} = \dfrac{3x^2}{4}-\dfrac{C}{x^2}+\dfrac{x^2}{4}+\dfrac{C}{x^2} = x^2, which matches the original equation.

Competitive stretch

If the same equation instead carried an initial condition y=1y=1 when x=2x=2, you would substitute directly into the general solution rather than re-deriving anything: 1=234+C2=2+C2  ⟹  C=−21 = \dfrac{2^3}{4}+\dfrac{C}{2} = 2 + \dfrac{C}{2} \implies C = -2, giving the particular solution y=x34−2xy=\dfrac{x^3}{4}-\dfrac{2}{x}. This is the standard "general solution first, then plug in the condition" pattern examiners expect — never try to build the condition into the integrating factor itself.

Common traps

  • Reading off pp and qq before reducing to standard form. If the coefficient of dydx\dfrac{dy}{dx} is not 11, dividing through is compulsory first; skipping this step gives a wrong integrating factor.
  • Choosing the wrong variable to be linear in. An equation linear in xx (form dxdy+px=q\dfrac{dx}{dy}+px=q) forced into the yy-form produces a non-linear mess this method cannot solve.
  • Mishandling ∫1x dx\int\frac{1}{x}\,dx and the exponent-log simplification. This integral is ln⁡∣x∣\ln|x|, so IF=eln⁡∣x∣=∣x∣\mathrm{IF}=e^{\ln|x|}=|x| in general; the absolute value is dropped only once a domain restriction like x>0x>0 is stated.
  • Applying the initial condition to the original equation instead of the integrated one. CC must come from y⋅IF=…y\cdot\mathrm{IF}=\ldots, never from dydx+py=q\dfrac{dy}{dx}+py=q directly.

Ask the tutor: if computing ∫p dx\int p\,dx or simplifying e∫p dxe^{\int p\,dx} feels like the tricky part, ask your AI tutor to walk through it step by step for your specific equation.

Why does the integrating factor have no plus C in its own exponent?

Because any constant kk added inside ∫p dx\int p\,dx would appear as a multiplying factor eke^k on both sides of y⋅IF=∫(q⋅IF)dx+Cy\cdot\mathrm{IF}=\int(q\cdot\mathrm{IF})dx+C, and dividing it out leaves the same relationship between yy and xx. It changes nothing about the final solution, so by convention the constant is simply dropped when computing ∫p dx\int p\,dx for the integrating factor, keeping the algebra as clean as possible.

How do I tell whether an equation is linear in y or linear in x?

Look at where the derivative sits and what it is being divided or multiplied by. If you can isolate dydx\dfrac{dy}{dx} and the rest of the equation involves only xx (and yy to the first power, unmultiplied by any xx-function times yy's own derivative in a nonlinear way), it is linear in yy. If instead dxdy\dfrac{dx}{dy} isolates cleanly with coefficients depending only on yy, treat xx as the dependent variable instead. Try the yy-form first since it is more common in the syllabus; if pp or qq end up depending on yy, switch to the xx-form.

What happens if I forget the constant of integration C?

You lose the general solution and get only one member of an entire family of solutions — usually not the one the question wants. Since first-order equations always produce one arbitrary constant, CC must appear in y⋅IF=∫(q⋅IF)dx+Cy\cdot\mathrm{IF}=\int(q\cdot\mathrm{IF})dx+C and stay until either the question asks only for the general solution (leave it as CC) or gives an initial condition (solve for its specific numeric value).

Before this