Differential Equations • Topic 3 of 3

Linear Differential Equations

A first-order differential equation is linear if it can be written in the standard form

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

where $P$ and $Q$ are functions of $x$ alone (either may be constant). "Linear" means $y$ and $\dfrac{dy}{dx}$ each appear only to the first power and are not multiplied together — so $\dfrac{dy}{dx}+xy=x$ is linear, but $\dfrac{dy}{dx}+y^2=x$ and $y\dfrac{dy}{dx}=x$ are not.

The integrating factor (IF)

The trick is to multiply the whole equation by a cleverly chosen factor so that the left-hand side collapses into a single derivative. That factor is the integrating factor:

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

After multiplying by the IF, the left side becomes exactly $\dfrac{d}{dx}\big(y\cdot\text{IF}\big)$. Integrating both sides then gives the general solution:

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

When computing the IF you may drop the constant of integration in $\int P\,dx$ (it only scales the IF and cancels out). Also note $e^{\ln f(x)}=f(x)$ and $e^{-\ln f(x)}=\dfrac{1}{f(x)}$ — these simplifications appear constantly.

Method

  • Rearrange into standard form $\dfrac{dy}{dx}+Py=Q$ and read off $P$ and $Q$.
  • Compute $\text{IF}=e^{\int P\,dx}$.
  • Write $y\cdot\text{IF}=\displaystyle\int Q\cdot\text{IF}\,dx+C$ and evaluate the integral.
  • Divide by the IF to make $y$ the subject (and apply any initial condition for a particular solution).

When $x$ is the dependent variable

Some equations are not linear in $y$ but become linear if you treat $x$ as a function of $y$. The standard form is then

$$\frac{dx}{dy}+P(y)\,x=Q(y),\qquad \text{IF}=e^{\int P\,dy},\qquad x\cdot\text{IF}=\int Q\cdot\text{IF}\,dy+C.$$

This is the same method with the roles of $x$ and $y$ swapped. A typical signal is an equation like $\big(\text{stuff in }y\big)\,dx = \big(\dots\big)\,dy$ that resists being linear in $y$ but is tidy in $\dfrac{dx}{dy}$ — for example $\dfrac{dy}{dx}=\dfrac{1}{x+y^2}$ rearranges to $\dfrac{dx}{dy}-x=y^2$, which is linear in $x$.

Recognising the right method (mixed/miscellaneous problems)

If the equation……use
separates into $f(y)\,dy=g(x)\,dx$Variable separable
has RHS depending only on $y/x$Homogeneous ($y=vx$)
fits $\dfrac{dy}{dx}+Py=Q$Linear, IF $=e^{\int P\,dx}$
is linear only in $x$ as a function of $y$Linear in $x$, IF $=e^{\int P\,dy}$

For miscellaneous problems, always test these in order: separable → homogeneous → linear (in $y$, then in $x$). A quick scan for which variable makes the equation first-degree usually reveals the method in seconds.

Deeper Insight — the integrating factor is engineered, not guessed. The IF is not pulled from a hat: it is the precise multiplier that makes the product rule run backwards. Multiplying $y'+Py=Q$ by $\mu$ gives $\mu y'+\mu Py$; for this to equal $\dfrac{d}{dx}(\mu y)=\mu y'+\mu' y$ we need $\mu'=\mu P$, whose solution is $\mu=e^{\int P\,dx}$. That single requirement derives the formula. Once you see this, two things follow naturally: why the constant in $\int P\,dx$ can be dropped (it only multiplies $\mu$ by a constant that divides out), and why the same idea works verbatim when $x$ is the dependent variable. Understanding the construction means you never have to memorise which side the IF goes on or worry whether the method "applies" — it always applies the moment the equation is linear.

A direction (slope) field for dy/dx = x minus y, with one solution curve threading through the segments Slope field of dy/dx = x − y with a solution curve x y O solution curve Each segment has slope x−y; the curve follows the field at every point
1
Worked Example
Find the integrating factor of $\dfrac{dy}{dx}+\dfrac{y}{x}=x$.
Solution
  1. Here $P=\dfrac{1}{x}$.
  2. $\int P\,dx=\int\dfrac{1}{x}\,dx=\ln x$.
  3. IF $=e^{\ln x}=x$.

Answer: IF $=x$.

2
Worked Example
Solve $\dfrac{dy}{dx}+\dfrac{y}{x}=x$.
Solution
  1. IF $=x$ (from Example 1).
  2. $y\cdot x=\int x\cdot x\,dx=\int x^2\,dx=\dfrac{x^3}{3}+C$.
  3. Divide by $x$.

Answer: $y=\dfrac{x^2}{3}+\dfrac{C}{x}$.

3
Worked Example
Find the integrating factor of $\dfrac{dy}{dx}+2y=e^{x}$.
Solution
  1. $P=2$, a constant.
  2. $\int 2\,dx=2x$, so IF $=e^{2x}$.

Answer: IF $=e^{2x}$.

4
Worked Example
Solve $\dfrac{dy}{dx}+2y=e^{x}$.
Solution
  1. IF $=e^{2x}$.
  2. $y\,e^{2x}=\int e^{x}\cdot e^{2x}\,dx=\int e^{3x}\,dx=\dfrac{e^{3x}}{3}+C$.
  3. Divide by $e^{2x}$.

Answer: $y=\dfrac{e^{x}}{3}+Ce^{-2x}$.

5
Worked Example
Solve $\dfrac{dy}{dx}+y=e^{-x}$.
Solution
  1. $P=1$, IF $=e^{x}$.
  2. $y\,e^{x}=\int e^{-x}\cdot e^{x}\,dx=\int 1\,dx=x+C$.
  3. Divide by $e^{x}$.

Answer: $y=(x+C)e^{-x}$.

6
Worked Example
Solve $x\dfrac{dy}{dx}+y=x^3$.
Solution
  1. Divide by $x$: $\dfrac{dy}{dx}+\dfrac{y}{x}=x^2$, so $P=\dfrac{1}{x}$, IF $=x$.
  2. $y\cdot x=\int x^2\cdot x\,dx=\int x^3\,dx=\dfrac{x^4}{4}+C$.
  3. Divide by $x$.

Answer: $y=\dfrac{x^3}{4}+\dfrac{C}{x}$.

7
Worked Example
Solve $\dfrac{dy}{dx}+2y\tan x=\sin x$.
Solution
  1. $P=2\tan x$, so $\int P\,dx=2\ln|\sec x|=\ln\sec^2 x$, IF $=\sec^2 x$.
  2. $y\sec^2 x=\int \sin x\sec^2 x\,dx=\int \sec x\tan x\,dx=\sec x+C$.
  3. Divide by $\sec^2 x$: $y=\cos x+C\cos^2 x$.

Answer: $y=\cos x+C\cos^2 x$.

8
Worked Example
Solve $x\dfrac{dy}{dx}+y=x^2$ given $y(1)=0$.
Solution
  1. Standard form $\dfrac{dy}{dx}+\dfrac{y}{x}=x$, IF $=x$.
  2. $y\cdot x=\int x\cdot x\,dx=\dfrac{x^3}{3}+C$.
  3. Apply $y(1)=0$: $0=\dfrac{1}{3}+C\Rightarrow C=-\dfrac{1}{3}$.
  4. So $xy=\dfrac{x^3}{3}-\dfrac{1}{3}$.

Answer: $y=\dfrac{x^3-1}{3x}$.

9
Worked Example
Solve $\dfrac{dy}{dx}=\dfrac{1}{x+y^2}$ by treating $x$ as a function of $y$.
Solution
  1. Invert: $\dfrac{dx}{dy}=x+y^2$, i.e. $\dfrac{dx}{dy}-x=y^2$ — linear in $x$ with $P=-1$.
  2. IF $=e^{\int(-1)\,dy}=e^{-y}$.
  3. $x\,e^{-y}=\int y^2 e^{-y}\,dy$. Integrating by parts twice: $\int y^2e^{-y}\,dy=-e^{-y}(y^2+2y+2)$.
  4. So $x\,e^{-y}=-e^{-y}(y^2+2y+2)+C$.

Answer: $x=-(y^2+2y+2)+Ce^{y}$.

10
Worked Example
Solve the linear equation $(1+y^2)\,dx=(\tan^{-1}y-x)\,dy$.
Solution
  1. Rewrite: $\dfrac{dx}{dy}=\dfrac{\tan^{-1}y-x}{1+y^2}$, i.e. $\dfrac{dx}{dy}+\dfrac{x}{1+y^2}=\dfrac{\tan^{-1}y}{1+y^2}$ — linear in $x$.
  2. $P=\dfrac{1}{1+y^2}$, so IF $=e^{\int\frac{dy}{1+y^2}}=e^{\tan^{-1}y}$.
  3. $x\,e^{\tan^{-1}y}=\int \dfrac{\tan^{-1}y}{1+y^2}e^{\tan^{-1}y}\,dy$. Let $t=\tan^{-1}y$: $=\int t\,e^{t}\,dt=(t-1)e^{t}+C$.
  4. So $x\,e^{\tan^{-1}y}=(\tan^{-1}y-1)e^{\tan^{-1}y}+C$.

Answer: $x=(\tan^{-1}y-1)+Ce^{-\tan^{-1}y}$.

11
Worked Example
Solve $\dfrac{dy}{dx}+y=1$.
Solution
  1. $P=1$, IF $=e^{x}$.
  2. $y\,e^{x}=\int 1\cdot e^{x}\,dx=e^{x}+C$.
  3. Divide by $e^{x}$.

Answer: $y=1+Ce^{-x}$.

12
Worked Example
Identify the method for $\dfrac{dy}{dx}=\dfrac{2y-x}{2x+y}$, then begin solving.
Solution
  1. Divide top and bottom by $x$: RHS $=\dfrac{2(y/x)-1}{2+(y/x)}$ — depends only on $y/x$, so it is homogeneous, not linear.
  2. Substitute $y=vx$, $\dfrac{dy}{dx}=v+x\dfrac{dv}{dx}$: $v+x\dfrac{dv}{dx}=\dfrac{2v-1}{2+v}$.
  3. $x\dfrac{dv}{dx}=\dfrac{2v-1}{2+v}-v=\dfrac{2v-1-2v-v^2}{2+v}=\dfrac{-(v^2+1)}{2+v}$, which now separates.

Answer: Homogeneous; after $y=vx$ it separates to $\dfrac{2+v}{v^2+1}\,dv=-\dfrac{dx}{x}$.

Key Points

  • Standard linear form: $\dfrac{dy}{dx}+P(x)\,y=Q(x)$ with $P,Q$ functions of $x$ only.
  • Integrating factor IF $=e^{\int P\,dx}$; multiplying by it makes the left side $\dfrac{d}{dx}(y\cdot\text{IF})$.
  • General solution: $y\cdot\text{IF}=\displaystyle\int Q\cdot\text{IF}\,dx+C$; drop the constant inside $\int P\,dx$.
  • Use $e^{\ln f}=f$ and $e^{-\ln f}=\dfrac{1}{f}$ to simplify integrating factors.
  • If linear only in $x$, use $\dfrac{dx}{dy}+P(y)\,x=Q(y)$ with IF $=e^{\int P\,dy}$ and $x\cdot\text{IF}=\int Q\cdot\text{IF}\,dy+C$.
  • "Linear" requires $y$ and $\dfrac{dy}{dx}$ to the first power only; $y^2$ or $y\,y'$ terms make it non-linear.
  • For mixed problems test in order: separable → homogeneous → linear in $y$ → linear in $x$.
  • Always rearrange to standard form before reading off $P$ and $Q$.
Tap an option to check your answer0 / 4
Q1.The integrating factor of $\dfrac{dy}{dx}+\dfrac{y}{x}=x$ is:
Explanation: $e^{\int (1/x)dx}=e^{\ln x}=x$.
Q2.For $\dfrac{dy}{dx}+2y=e^x$, the IF is:
Explanation: $e^{\int 2dx}=e^{2x}$.
Q3.A linear first-order DE has the form:
Explanation: Standard linear form.
Q4.After multiplying by the IF, the left side becomes:
Explanation: That is the whole point of the IF.