First-Order Differential Equations
Solving linear first-order equations using the integrating factor, and applying boundary conditions.
Separating the variables (recap)
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.
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
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.
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$.
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)$.
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
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.
$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)