Core Pure · Methods in Differential Equations · Year 2

First-Order Differential Equations

Solving linear first-order equations using the integrating factor, and applying boundary conditions.

13 min read 3 worked examples

Separating the variables (recap)

When separation works

If a first-order equation can be written $\dfrac{dy}{dx}=f(x)g(y)$, you can solve it by separating: $\displaystyle\int\frac1{g(y)}\,dy=\int f(x)\,dx$. This handles many first-order equations, but not all of them — in particular, it fails whenever $y$ and $x$ are genuinely mixed together (such as $\dfrac{dy}{dx}+P(x)y=Q(x)$), which needs a different technique.

Example 1 · A quick separating-the-variables warm-up
Find the general solution to $\dfrac{dy}{dx}=2xy$.

Here $f(x)=2x$ and $g(y)=y$, so the variables separate: $\displaystyle\int\frac1y\,dy=\int2x\,dx$.

Integrate both sides: $\ln|y|=x^2+c$.

Rearrange: $y=e^{x^2+c}=Ae^{x^2}$, where $A=e^c$ is an arbitrary constant.

Linear first-order equations

Definition 7.1 — standard linear form

A first-order linear differential equation can be written

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

where $P$ and $Q$ are functions of $x$ only.

Theorem 7.2 — the integrating factor

Multiplying through by the integrating factor $I(x)=e^{\int P(x)\,dx}$ turns the left-hand side into an exact derivative:

$$\frac{d}{dx}\Big(I(x)\,y\Big)=I(x)\,Q(x)$$

which can then be integrated directly to solve for $y$.

ProofWhy I(x) makes the LHS an exact derivative
1
Consider $\dfrac{d}{dx}\Big(I(x)y\Big)$ using the product rule: $I(x)\dfrac{dy}{dx}+y\,I'(x)$.
2
Since $I(x)=e^{\int P(x)\,dx}$, the chain rule gives $I'(x)=P(x)\,e^{\int P(x)\,dx}=P(x)I(x)$.
3
So $\dfrac{d}{dx}\Big(I(x)y\Big)=I(x)\dfrac{dy}{dx}+P(x)I(x)y=I(x)\left(\dfrac{dy}{dx}+P(x)y\right)$.
4
Multiplying the original equation $\dfrac{dy}{dx}+P(x)y=Q(x)$ through by $I(x)$ gives exactly this expression on the left, equal to $I(x)Q(x)$ on the right.
∎
Example 2 · Using the integrating factor
Find the general solution to $\dfrac{dy}{dx}-\dfrac4xy=x^3$, for $x>0$.

Here $P(x)=-\dfrac4x$, so $I(x)=e^{\int-\frac4x\,dx}=e^{-4\ln x}=x^{-4}$.

Multiply through: $x^{-4}\dfrac{dy}{dx}-4x^{-5}y=x^{-1}$, i.e. $\dfrac{d}{dx}\left(x^{-4}y\right)=x^{-1}$.

Integrate both sides: $x^{-4}y=\ln x+c$.

So $y=x^4(\ln x+c)$.

Example 3 · Rearranging into standard form first
Find the general solution to $x\dfrac{dy}{dx}+3y=\dfrac1x$, for $x>0$.

Divide by $x$: $\dfrac{dy}{dx}+\dfrac3xy=\dfrac1{x^2}$.

$I(x)=e^{\int\frac3x\,dx}=e^{3\ln x}=x^3$.

$\dfrac{d}{dx}\left(x^3y\right)=x^3\times\dfrac1{x^2}=x$.

Integrate: $x^3y=\dfrac{x^2}2+c$, so $y=\dfrac1{2x}+\dfrac c{x^3}$.

Using boundary conditions

From general to particular solution

A first-order equation's general solution has one arbitrary constant. Substituting a given point $(x_0,y_0)$ into the general solution determines this constant, giving the unique particular solution through that point.

Example 4 · Finding a particular solution
Find the particular solution to $\dfrac{dy}{dx}+2y=e^{-2x}$, given that $y=3$ when $x=0$.

$I(x)=e^{\int2\,dx}=e^{2x}$.

$\dfrac{d}{dx}\left(e^{2x}y\right)=e^{2x}\cdot e^{-2x}=1$.

Integrate: $e^{2x}y=x+c$.

Substitute $x=0,y=3$: $3=0+c$, so $c=3$.

Particular solution: $y=e^{-2x}(x+3)$.

Exam-style questions

Question 1 6 marks

Find the general solution to the differential equation $\dfrac{dy}{dx}+\dfrac2xy=6x$, for $x>0$, giving your answer in the form $y=f(x)$.

$I(x)=e^{\int\frac2x\,dx}=e^{2\ln x}=x^2$. (M1, A1)

$\dfrac{d}{dx}\left(x^2y\right)=6x^3$. (M1, A1)

Integrate: $x^2y=\dfrac32x^4+c$, so $y=\dfrac32x^2+\dfrac c{x^2}$. (A1, A1)

Question 2 8 marks

Find the particular solution to $\dfrac{dy}{dx}+y\tan x=\sec x$, given that $y=2$ when $x=0$, for $-\dfrac\pi2\lt x\lt\dfrac\pi2$.

$I(x)=e^{\int\tan x\,dx}=e^{\ln(\sec x)}=\sec x$ (since $\sec x>0$ here). (M1, A1, A1)

$\dfrac{d}{dx}\left(y\sec x\right)=\sec^2x$. (M1, A1)

Integrate: $y\sec x=\tan x+c$. (A1)

Substitute $x=0,y=2$: $2=0+c$, so $c=2$. Particular solution: $y=\sin x+2\cos x$. (A1, A1)

Question 3 6 marks

Find the general solution to $\dfrac{dy}{dx}=y\cosh x$, giving your answer in the form $y=f(x)$.

Separate the variables: $\displaystyle\int\frac1y\,dy=\int\cosh x\,dx$. (M1, A1)

$\ln|y|=\sinh x+c_1$. (A1)

$y=e^{\sinh x+c_1}=Ae^{\sinh x}$, where $A=e^{c_1}$. (M1, A1, A1)