Linear Differential Equations

Complete guide to solving first-order linear differential equations using integrating factor method

Linear Differential Equations

Introduction

A Linear Differential Equation of first order has a specific standard form and is solved using the powerful Integrating Factor (IF) method. This is one of the most important techniques in JEE differential equations.


Definition

A differential equation is linear if it can be written in the form:

$$\boxed{\frac{dy}{dx} + P(x) \cdot y = Q(x)}$$

where $P(x)$ and $Q(x)$ are functions of $x$ only (or constants).

Key Features:

  • $y$ and $\frac{dy}{dx}$ appear to first power only
  • No products like $y \cdot \frac{dy}{dx}$
  • No powers like $y^2$ or $\left(\frac{dy}{dx}\right)^2$

Standard Form

Form 1: In $x$

$$\boxed{\frac{dy}{dx} + P(x)y = Q(x)}$$

Form 2: In $y$ (when $x$ is dependent variable)

$$\boxed{\frac{dx}{dy} + P(y)x = Q(y)}$$

Linear vs Non-Linear

Linear Examples

  • $\frac{dy}{dx} + 3y = x^2$ ✓
  • $\frac{dy}{dx} + xy = \sin x$ ✓
  • $x\frac{dy}{dx} + y = x^3$ ✓ (can be written as $\frac{dy}{dx} + \frac{y}{x} = x^2$)

Non-Linear Examples

  • $\frac{dy}{dx} + y^2 = x$ ✗ ($y^2$ appears)
  • $y\frac{dy}{dx} + x = 0$ ✗ (product of $y$ and $\frac{dy}{dx}$)
  • $\left(\frac{dy}{dx}\right)^2 + y = 0$ ✗ (square of derivative)

Integrating Factor Method

Definition of Integrating Factor

Integrating Factor (IF):

$$\boxed{IF = e^{\int P(x)dx}}$$

where $P(x)$ is the coefficient of $y$ in standard form.


Solution Formula

The general solution of $\frac{dy}{dx} + P(x)y = Q(x)$ is:

$$\boxed{y \cdot IF = \int Q(x) \cdot IF \, dx + C}$$

or equivalently:

$$\boxed{y \cdot e^{\int P dx} = \int Q \cdot e^{\int P dx} dx + C}$$

Step-by-Step Solution Method

Step 1: Write the DE in standard form $\frac{dy}{dx} + Py = Q$

Step 2: Identify $P(x)$ and $Q(x)$

Step 3: Find the Integrating Factor: $IF = e^{\int P(x)dx}$

  • Don’t add constant in this integration!

Step 4: Multiply both sides of DE by IF

Step 5: Recognize LHS as $\frac{d}{dx}(y \cdot IF)$

Step 6: Integrate both sides

Step 7: Solve for $y$


Why Integrating Factor Works

Starting with: $\frac{dy}{dx} + Py = Q$

Multiply by $IF = e^{\int P dx}$:

$$e^{\int P dx} \frac{dy}{dx} + P e^{\int P dx} y = Q e^{\int P dx}$$

Notice that:

$$\frac{d}{dx}\left(y \cdot e^{\int P dx}\right) = e^{\int P dx}\frac{dy}{dx} + y \cdot P e^{\int P dx}$$

(by product rule)

So the LHS becomes:

$$\frac{d}{dx}(y \cdot IF) = Q \cdot IF$$

Now integrate both sides!

Interactive Demo: Visualize Linear DE Solutions

Plot solution curves for first-order linear differential equations.


Memory Tricks

🎯 Standard Form Recognition

“dy/dx PLUS Py equals Q”:

  • Must have $+$ sign (convert $-$ to $+$ if needed)
  • $P$ multiplies $y$
  • $Q$ is on right side

🎯 IF Formula Memory

“I F equals E to the Integral P”:

$$IF = e^{\int P \, dx}$$

Mnemonic: “Integrate P to get IF

🎯 Solution Pattern

“Y-IF equals Integral Q-IF”:

$$y \cdot IF = \int Q \cdot IF \, dx + C$$

Remember:

  • LHS: $y$ times IF
  • RHS: Integral of ($Q$ times IF)

Common Mistakes to Avoid

❌ Mistake 1: Adding Constant in IF

Wrong: $IF = e^{\int P dx + C}$ ✗

Correct: $IF = e^{\int P dx}$ (NO constant here!) ✓

Why: The constant will cancel out anyway, and including it makes the solution complicated.

❌ Mistake 2: Wrong Sign in Standard Form

Wrong: $\frac{dy}{dx} - 2y = x$ → $P = 2$ ✗

Correct: Standard form needs $+$ sign

  • Rewrite as: $\frac{dy}{dx} + (-2)y = x$
  • So $P = -2$ ✓

❌ Mistake 3: Forgetting to Multiply Q by IF

Wrong: $y \cdot IF = \int Q \, dx$ ✗

Correct: $y \cdot IF = \int (Q \cdot IF) \, dx$ ✓

❌ Mistake 4: Treating Non-Linear as Linear

Wrong: $\frac{dy}{dx} + y^2 = x$ is linear ✗

Correct: This is Bernoulli equation (contains $y^2$), not linear ✓


Solved Examples

Example 1: Basic Linear DE (JEE Main)

Solve: $\frac{dy}{dx} + y = e^x$

Solution:

Step 1: Already in standard form: $\frac{dy}{dx} + 1 \cdot y = e^x$

Step 2: $P(x) = 1$, $Q(x) = e^x$

Step 3: $IF = e^{\int 1 \, dx} = e^x$

Step 4: Multiply by IF:

$$e^x \frac{dy}{dx} + e^x y = e^x \cdot e^x = e^{2x}$$

Step 5: LHS = $\frac{d}{dx}(y \cdot e^x)$

Step 6: Integrate:

$$y \cdot e^x = \int e^{2x} dx = \frac{e^{2x}}{2} + C$$

Step 7: Solve for $y$:

$$\boxed{y = \frac{e^x}{2} + Ce^{-x}}$$

Example 2: With Variable Coefficient (JEE Main)

Solve: $\frac{dy}{dx} + y\tan x = \sec x$

Solution:

Standard form: $\frac{dy}{dx} + (\tan x)y = \sec x$

$P = \tan x$, $Q = \sec x$

$IF = e^{\int \tan x \, dx} = e^{\ln|\sec x|} = \sec x$

Multiply by IF:

$$\sec x \frac{dy}{dx} + \sec x \tan x \cdot y = \sec^2 x$$ $$\frac{d}{dx}(y \sec x) = \sec^2 x$$

Integrate:

$$y \sec x = \tan x + C$$ $$\boxed{y = \sin x + C\cos x}$$

Example 3: With Initial Condition (JEE Main)

Solve: $\frac{dy}{dx} + \frac{y}{x} = x^2$ with $y(1) = 1$

Solution:

$P = \frac{1}{x}$, $Q = x^2$

$IF = e^{\int \frac{1}{x}dx} = e^{\ln|x|} = x$ (taking $x > 0$)

Multiply by IF:

$$x\frac{dy}{dx} + y = x^3$$ $$\frac{d}{dx}(xy) = x^3$$

Integrate:

$$xy = \frac{x^4}{4} + C$$ $$y = \frac{x^3}{4} + \frac{C}{x}$$

Using $y(1) = 1$:

$$1 = \frac{1}{4} + C \Rightarrow C = \frac{3}{4}$$ $$\boxed{y = \frac{x^3}{4} + \frac{3}{4x}}$$

Example 4: Requires Rearrangement (JEE Advanced)

Solve: $x\frac{dy}{dx} - y = x^2\sin x$

Solution:

Step 1: Convert to standard form:

$$\frac{dy}{dx} - \frac{y}{x} = x\sin x$$

Rewrite with $+$ sign:

$$\frac{dy}{dx} + \left(-\frac{1}{x}\right)y = x\sin x$$

$P = -\frac{1}{x}$, $Q = x\sin x$

$IF = e^{\int -\frac{1}{x}dx} = e^{-\ln|x|} = \frac{1}{x}$

Multiply by IF:

$$\frac{1}{x}\frac{dy}{dx} - \frac{y}{x^2} = \sin x$$ $$\frac{d}{dx}\left(\frac{y}{x}\right) = \sin x$$

Integrate:

$$\frac{y}{x} = -\cos x + C$$ $$\boxed{y = -x\cos x + Cx}$$

Example 5: Trigonometric Coefficients (JEE Advanced)

Solve: $\cos^2 x \frac{dy}{dx} + y = \tan x$

Solution:

Convert to standard form:

$$\frac{dy}{dx} + \frac{y}{\cos^2 x} = \frac{\tan x}{\cos^2 x}$$ $$\frac{dy}{dx} + y\sec^2 x = \tan x \sec^2 x$$

$P = \sec^2 x$, $Q = \tan x \sec^2 x$

$IF = e^{\int \sec^2 x \, dx} = e^{\tan x}$

Multiply by IF:

$$e^{\tan x}\frac{dy}{dx} + y e^{\tan x}\sec^2 x = \tan x \sec^2 x \cdot e^{\tan x}$$ $$\frac{d}{dx}(y e^{\tan x}) = \tan x \sec^2 x \cdot e^{\tan x}$$

For RHS, let $u = \tan x$, then $du = \sec^2 x \, dx$:

$$\int \tan x \sec^2 x \cdot e^{\tan x} dx = \int u e^u du$$

Using integration by parts: $\int ue^u du = ue^u - e^u + C = e^u(u - 1) + C$

So:

$$y e^{\tan x} = e^{\tan x}(\tan x - 1) + C$$ $$\boxed{y = \tan x - 1 + Ce^{-\tan x}}$$

Practice Problems

Level 1: JEE Main Basics

Problem 1.1: Solve $\frac{dy}{dx} + 2y = 4$.

Solution

$P = 2$, $Q = 4$

$IF = e^{\int 2 \, dx} = e^{2x}$

$y \cdot e^{2x} = \int 4e^{2x} dx = 2e^{2x} + C$

$y = 2 + Ce^{-2x}$

Problem 1.2: Solve $\frac{dy}{dx} - y = 1$.

Solution

$\frac{dy}{dx} + (-1)y = 1$

$P = -1$, $Q = 1$

$IF = e^{-x}$

$y \cdot e^{-x} = \int e^{-x} dx = -e^{-x} + C$

$y = -1 + Ce^x$

Problem 1.3: Solve $\frac{dy}{dx} + \frac{y}{x} = 1$ where $x > 0$.

Solution

$P = \frac{1}{x}$, $Q = 1$

$IF = e^{\ln x} = x$

$y \cdot x = \int x \, dx = \frac{x^2}{2} + C$

$y = \frac{x}{2} + \frac{C}{x}$


Level 2: JEE Main Advanced

Problem 2.1: Solve $\frac{dy}{dx} + y\cot x = 2\cos x$ with $y\left(\frac{\pi}{2}\right) = 0$.

Solution

$P = \cot x$, $Q = 2\cos x$

$IF = e^{\int \cot x \, dx} = e^{\ln|\sin x|} = \sin x$

$y\sin x = \int 2\cos x \sin x \, dx = \int \sin 2x \, dx = -\frac{\cos 2x}{2} + C$

Using $y(\pi/2) = 0$: $0 = -\frac{\cos \pi}{2} + C = \frac{1}{2} + C$, so $C = -\frac{1}{2}$

$y\sin x = -\frac{\cos 2x}{2} - \frac{1}{2}$

$y = -\frac{\cos 2x + 1}{2\sin x} = -\frac{2\cos^2 x}{2\sin x} = -\frac{\cos^2 x}{\sin x}$

Problem 2.2: Solve $(1 + x^2)\frac{dy}{dx} + 2xy = \frac{1}{1 + x^2}$.

Solution

$\frac{dy}{dx} + \frac{2x}{1 + x^2}y = \frac{1}{(1 + x^2)^2}$

$P = \frac{2x}{1 + x^2}$, $Q = \frac{1}{(1 + x^2)^2}$

$IF = e^{\int \frac{2x}{1+x^2}dx} = e^{\ln(1+x^2)} = 1 + x^2$

$y(1 + x^2) = \int \frac{1 + x^2}{(1 + x^2)^2} dx = \int \frac{1}{1 + x^2} dx = \tan^{-1}x + C$

$y = \frac{\tan^{-1}x + C}{1 + x^2}$

Problem 2.3: Solve $x\frac{dy}{dx} + 2y = x^2\log x$.

Solution

$\frac{dy}{dx} + \frac{2}{x}y = x\log x$

$P = \frac{2}{x}$, $Q = x\log x$

$IF = e^{\int \frac{2}{x}dx} = e^{2\ln x} = x^2$

$yx^2 = \int x^3\log x \, dx$

Using integration by parts: $\int x^3\log x \, dx = \frac{x^4\log x}{4} - \int \frac{x^4}{4} \cdot \frac{1}{x} dx = \frac{x^4\log x}{4} - \frac{x^4}{16} + C$

$y = \frac{x^2\log x}{4} - \frac{x^2}{16} + \frac{C}{x^2}$


Level 3: JEE Advanced

Problem 3.1: Solve $\frac{dy}{dx} = \frac{y\log y - y}{x}$.

Solution

Rewrite: $\frac{dy}{dx} = \frac{y(\log y - 1)}{x}$

This is NOT linear in $y$! It’s linear in $x$ as a function of $y$.

Write: $\frac{dx}{dy} = \frac{x}{y(\log y - 1)}$

$\frac{dx}{dy} - \frac{x}{y(\log y - 1)} = 0$

Actually, better approach: $\frac{dy}{dx} - \frac{y}{x} = -\frac{y\log y}{x}$

This is Bernoulli type. Let’s use different approach.

$x\frac{dy}{dx} = y\log y - y$

$x\frac{dy}{dx} - y\log y + y = 0$

$\frac{1}{y\log y - y}\frac{dy}{dx} = \frac{1}{x}$

Actually: $\frac{dx}{dy} = \frac{x}{y\log y - y}$

$\frac{dx}{dy} - \frac{x}{y(\log y - 1)} = 0$

Linear in $x$: $\frac{dx}{dy} + \left(-\frac{1}{y(\log y - 1)}\right)x = 0$

$P = -\frac{1}{y(\log y - 1)}$

$IF = e^{\int -\frac{1}{y(\log y-1)}dy}$

Let $u = \log y - 1$, $du = \frac{dy}{y}$:

$\int -\frac{1}{y(\log y-1)}dy = -\int \frac{du}{u} = -\ln|u| = -\ln|\log y - 1|$

$IF = e^{-\ln|\log y - 1|} = \frac{1}{\log y - 1}$

$x \cdot \frac{1}{\log y - 1} = C$

$x = C(\log y - 1)$

Problem 3.2: Solve $\frac{dy}{dx} + \frac{y}{x\log x} = \frac{1}{x}$.

Solution

$P = \frac{1}{x\log x}$, $Q = \frac{1}{x}$

$IF = e^{\int \frac{1}{x\log x}dx}$

Let $u = \log x$, $du = \frac{dx}{x}$:

$\int \frac{1}{x\log x}dx = \int \frac{du}{u} = \ln|u| = \ln|\log x|$

$IF = e^{\ln|\log x|} = \log x$ (assuming $x > 1$)

$y\log x = \int \frac{\log x}{x} dx$

Let $v = \log x$, $dv = \frac{dx}{x}$:

$\int \frac{\log x}{x}dx = \int v \, dv = \frac{v^2}{2} = \frac{(\log x)^2}{2} + C$

$y = \frac{\log x}{2} + \frac{C}{\log x}$

Problem 3.3: A curve passes through $(1, 1)$ and at any point $(x, y)$ on it, the slope of tangent is $\frac{y}{x} + \sec\left(\frac{y}{x}\right)$. Find the curve.

Solution

$\frac{dy}{dx} = \frac{y}{x} + \sec\left(\frac{y}{x}\right)$

This is homogeneous! Not linear.

Use $y = vx$: $v + x\frac{dv}{dx} = v + \sec v$

$x\frac{dv}{dx} = \sec v$

$\cos v \, dv = \frac{dx}{x}$

$\sin v = \ln|x| + C$

Using $(1, 1)$: $\sin(1) = 0 + C$, so $C = \sin 1$

$\sin\left(\frac{y}{x}\right) = \ln|x| + \sin 1$


When to Use Linear DE Method

Use this method when:

  • DE can be written as $\frac{dy}{dx} + Py = Q$
  • $y$ and $\frac{dy}{dx}$ appear to first power only
  • No products of $y$ and derivatives
  • $P$ and $Q$ are functions of $x$ only

Comparison with Other Methods

MethodWhen to UseForm
Variable SeparableCan separate $x$ and $y$$\frac{dy}{dx} = f(x)g(y)$
HomogeneousFunction of $\frac{y}{x}$$\frac{dy}{dx} = F(y/x)$
LinearFirst power of $y$ and $y'$$\frac{dy}{dx} + Py = Q$

Cross-References


Quick Revision Points

  1. Standard form: $\frac{dy}{dx} + Py = Q$
  2. IF = $e^{\int P \, dx}$ (NO constant here!)
  3. Solution: $y \cdot IF = \int Q \cdot IF \, dx + C$
  4. LHS becomes $\frac{d}{dx}(y \cdot IF)$
  5. Linear means first power of $y$ and $y'$ only
  6. Remember to multiply $Q$ by IF before integrating

Last updated: November 18, 2025