1.1 Separable ODEs

A separable first-order ODE can be written in the form

equation (1.1) (1.1)
y=g(x)h(y).y^{\prime}=g(x)h(y).

We will assume that g(x)g(x) is continuous over some range of values of xx, e.g. x(a,b)x\in(a,b), possibly the whole real line (,)(-\infty,\infty). Continuity of g(x)g(x) ensures that we can take the necessary integrals.

1.1.1 A simple solution

Any (constant) solution of the equation h(y)=0h(y)=0 is also a possible solution of (1.1).

Example 1.1.

Show that y=nπy=n\pi (nn\in\mathbb{Z}) is a possible solution of the first-order ODE,

y=xsin(y).y^{\prime}=x\sin(y).
Solution.

Here g(x)=xg(x)=x and h(y)=sin(y)h(y)=\sin(y). Now, h(y)=sin(y)=0h(y)=\sin(y)=0 if y=nπy=n\pi (where nn\in\mathbb{Z}), so the right-hand side of the ODE is zero. Clearly y=nπy=n\pi (constant) x\forall x \Longrightarrow y=0y^{\prime}=0 (i.e. the left-hand side is also zero). Therefore y=nπy=n\pi is a possible solution.

1.1.2 Separation of variables

To derive a more general solution, we must assume that h(y)0h(y)\neq 0, so that we can divide each side by h(y)h(y),

yh(y)=g(x).\frac{y^{\prime}}{h(y)}=g(x).

Integrating each side with respect to xx,

yh(y)dx=g(x)dx.\int\frac{y^{\prime}}{h(y)}~{}{\rm d}x=\int g(x)~{}{\rm d}x.

since dy=ydx\mathrm{d}y=y^{\prime}\,\mathrm{d}x, this implies that

equation (1.2) (1.2)
dyh(y)=g(x)dx.\int\frac{{\rm d}y}{h(y)}=\int g(x)~{}{\rm d}x.

Evaluating these integrals leads to a solution for y(x)y(x). Sometimes the general solution will contain solutions of h(y)=0h(y)=0, but this is not always the case.

Example 1.2.

Find the general solution to

y=x(y+1)2.y^{\prime}=x(y+1)^{2}.
Solution.

Clearly y=1y=-1 is a possible constant solution. If y1y\neq-1, we separate variables,

dy(y+1)2\displaystyle\int\frac{{\rm d}y}{(y+1)^{2}}
=\displaystyle=
xdx\displaystyle\int x~{}{\rm d}x
1y+1\displaystyle\Longrightarrow-\frac{1}{y+1}
=\displaystyle=
x22+C,\displaystyle\frac{x^{2}}{2}+C,

where C is an arbitrary constant of integration. Rearranging this expression,

2y+1\displaystyle-\frac{2}{y+1}
=\displaystyle=
x2+2C\displaystyle x^{2}+2C
y+1\displaystyle\Longrightarrow y+1
=\displaystyle=
2x2+2C\displaystyle-\frac{2}{x^{2}+2C}
y\displaystyle\Longrightarrow y
=\displaystyle=
1(2x2+D),\displaystyle-1-\left(\frac{2}{x^{2}+D}\right),

where D=2CD=2C is a rescaled constant. Alongside the special solution y=1y=-1, this is the most general solution to this first order ODE. Different values of DD lead to a family of solution curves (or integral curves) in the xyxy-plane.

Check (not lectured): Differentiating this function, we see that

y=4x(x2+D)2=x(y+1)2,y^{\prime}=\frac{4x}{\left(x^{2}+D\right)^{2}}=x(y+1)^{2},

as required.

Example 1.3.

Find the general solution of the ODE y=(y+xy)/x2y^{\prime}=(y+xy)/x^{2} and then the particular solution which passes through the point (1,1)(1,1), i.e. y(1)=1y(1)=1.

Solution.

We have

y\displaystyle y^{\prime}
=\displaystyle=
(y+xy)x2\displaystyle\frac{(y+xy)}{x^{2}}
=\displaystyle=
(1+x)yx2.\displaystyle\frac{(1+x)y}{x^{2}}.

Clearly y=0y=0 is a possible solution, but this is incompatible with y(1)=1y(1)=1 so can be ignored. Assuming y0y\neq 0, separation of variables leads to

dyy=(1+xx2)dx=(1x2+1x)dxln|y|=1x+ln|x|+C\int\frac{{\rm d}y}{y}=\int\left(\frac{1+x}{x^{2}}\right){\rm d}x=\int\left(% \frac{1}{x^{2}}+\frac{1}{x}\right)\,\mathrm{d}x\Longrightarrow\ln|y|=-\frac{1}% {x}+\ln|x|+C

(where CC is the constant of integration). Taking the exponential of both sides,

|y|=exp[1x+ln|x|+C]=|x|exp[1x+C]=|x|exp[C]exp[1x],|y|=\exp\left[-\frac{1}{x}+\ln|x|+C\right]=|x|\exp\left[-\frac{1}{x}+C\right]=% |x|\exp[C]\exp\left[-\frac{1}{x}\right],

where exp(x)ex\displaystyle{\exp(x)\equiv\mathrm{e}^{x}}. Dropping the modulus operators from both sides,

y=±xexp[C]exp[1x].y=\pm\,x\exp[C]\exp\left[-\frac{1}{x}\right].

Absorbing the plus/minus sign into a new constant DD (where |D|=exp[C]|D|=\exp[C]),

y=Dxexp[1x].y=Dx\exp\left[-\frac{1}{x}\right].

If y(1)=1y(1)=1, this implies that

1=D1exp[1]De1D=e.1=D\cdot 1\cdot\exp[-1]\equiv D\mathrm{e}^{-1}\Rightarrow D=\mathrm{e}.

So the required solution is,

y=exexp[1x]=xexp[11x](xe[1(1/x)]).y=\mathrm{e}x\exp\left[-\frac{1}{x}\right]=x\exp\left[1-\frac{1}{x}\right]% \left(\equiv x\mathrm{e}^{\left[1-\left(1/x\right)\right]}\right).
Example 1.4.

If N(t)N(t) is the size of a radioactive sample at time tt, then

dNdt=αN,\frac{\mathrm{d}N}{\mathrm{d}t}=-\alpha N,

where α\alpha is a positive constant. How long does it take for half the sample to decay?

Solution.

Assuming that N0N\neq 0, we again proceed by separating variables (note the change of notation!):

dNN=αdtln|N|=αt+C,\int\frac{{\rm d}N}{N}=-\alpha\int\,\mathrm{d}t\Longrightarrow\ln|N|=-\alpha t% +C,

where CC is a constant of integration. Hence,

|N(t)|=eCeαtN(t)=±eCeαtN(t)=Aeαt,|N(t)|=\mathrm{e}^{C}\mathrm{e}^{-\alpha t}\Longrightarrow N(t)=\pm\,\mathrm{e% }^{C}\mathrm{e}^{-\alpha t}\Longrightarrow N(t)=A\mathrm{e}^{-\alpha t},

where AA is a new constant (|A|=eC|A|=\mathrm{e}^{C}) into which the plus/minus sign has been absorbed. If N(0)=N0N(0)=N_{0} (initial sample size) then,

N0=Ae0=AN(t)=N0eαt.N_{0}=A\mathrm{e}^{0}=A\Longrightarrow N(t)=N_{0}\mathrm{e}^{-\alpha t}.

Let tht_{h} be the length of time it takes for half the sample to decay, i.e. N(th)=N0/2N(t_{h})=N_{0}/2. This implies that,

N02=N(th)=N0eαth.\frac{N_{0}}{2}=N(t_{h})=N_{0}\mathrm{e}^{-\alpha t_{h}}.

Hence

12\displaystyle\frac{1}{2}
=\displaystyle=
eαth\displaystyle\mathrm{e}^{-\alpha t_{h}}
(taking logs)ln[12]\displaystyle\mbox{(taking logs)}\;\Longrightarrow\ln\left[\frac{1}{2}\right]
=\displaystyle=
αth\displaystyle-\alpha t_{h}
ln1ln2\displaystyle\Longrightarrow\ln 1-\ln 2
=\displaystyle=
αth(recall that ln(x/y)=lnxlny)\displaystyle-\alpha t_{h}\quad\mbox{(recall that $\ln(x/y)=\ln x-\ln y)$}
0ln2\displaystyle\Longrightarrow 0-\ln 2
=\displaystyle=
αth\displaystyle-\alpha t_{h}
th\displaystyle\Longrightarrow t_{h}
=\displaystyle=
ln2α.\displaystyle\frac{\ln 2}{\alpha}.

This is the time it takes for half the sample to decay (known as the sample’s half-life).