1.3 Linear first-order ODEs

1.3.1 Terminology

Recalling our definition of a linear operator,

L⁢(y)=cn⁢(x)⁢y(n)+cn−1⁢(x)⁢y(n−1)+…+c1⁢(x)⁢y′+c0⁢(x)⁢yL(y)=c_{n}(x)y^{(n)}+c_{n-1}(x)y^{(n-1)}+\ldots+c_{1}(x)y^{\prime}+c_{0}(x)y

(where the ci⁢(x)c_{i}(x) are specified functions of xx), any linear first-order ODE can be written in the form

equation (1.6) (1.6)
L⁢(y)≡c1⁢(x)⁢y′+c0⁢(x)⁢y=f⁢(x),L(y)\equiv c_{1}(x)y^{\prime}+c_{0}(x)y=f(x),

where f⁢(x)f(x) is another given function of xx. Without loss of generality, we shall assume c1⁢(x)≠0c_{1}(x)\neq 0.

Note.

The case of c1⁢(x)=0c_{1}(x)=0 is trivial, i.e. c0⁢(x)⁢y=f⁢(x)⟹y=f⁢(x)c0⁢(x)\displaystyle{c_{0}(x)y=f(x)\Longrightarrow y=\frac{f(x)}{c_{0}(x)}}.

Dividing (1.6) by c1⁢(x)c_{1}(x),

equation (1.7) (1.7)
y′+p⁢(x)⁢y=q⁢(x),y^{\prime}+p(x)y=q(x),

where p⁢(x)=c0⁢(x)/c1⁢(x)p(x)=c_{0}(x)/c_{1}(x) and q⁢(x)=f⁢(x)/c1⁢(x)q(x)=f(x)/c_{1}(x). This is the most general form for a (non-trivial) first-order linear ODE.

1.3.2 The integrating factor method

The challenge is to solve y′+p⁢(x)⁢y=q⁢(x)y^{\prime}+p(x)y=q(x). We shall assume that p⁢(x)p(x) and q⁢(x)q(x) are continuous (and hence integrable) over some interval (a,b)(a,b), possibly the whole real line (−∞,∞)(-\infty,\infty). Let

P⁢(x)=∫p⁢(x)⁢dx.P(x)=\int p(x)\,\mathrm{d}x.

For any x∈(a,b)x\in(a,b), the fundamental theorem of calculus tells us that

P′⁢(x)=p⁢(x).P^{\prime}(x)=p(x).

This implies that

dd⁢x⁢[y⁢eP⁢(x)]\displaystyle\frac{\mathrm{d}}{\mathrm{d}x}\left[y\mathrm{e}^{P(x)}\right]
=\displaystyle=
y′⁢eP⁢(x)+P′⁢(x)⁢y⁢eP⁢(x)\displaystyle y^{\prime}\mathrm{e}^{P(x)}+P^{\prime}(x)y\mathrm{e}^{P(x)}
=\displaystyle=
y′⁢eP⁢(x)+p⁢(x)⁢y⁢eP⁢(x)\displaystyle y^{\prime}\mathrm{e}^{P(x)}+p(x)y\mathrm{e}^{P(x)}
=\displaystyle=
[y′+p⁢(x)⁢y]⁢eP⁢(x).\displaystyle\left[y^{\prime}+p(x)y\right]\mathrm{e}^{P(x)}.

The quantity eP⁢(x)≡exp⁡[P⁢(x)]\displaystyle{\mathrm{e}^{P(x)}\equiv\exp\left[P(x)\right]} is known as the integrating factor. As we have just shown, if we multiply our original ODE by this integrating factor, i.e.

[y′+p⁢(x)⁢y]⁢eP⁢(x)=q⁢(x)⁢eP⁢(x),\left[y^{\prime}+p(x)y\right]\mathrm{e}^{P(x)}=q(x)\mathrm{e}^{P(x)},

this is equivalent to

equation (1.8) (1.8)
dd⁢x⁢[y⁢eP⁢(x)]=q⁢(x)⁢eP⁢(x).\frac{\mathrm{d}}{\mathrm{d}x}\left[y\mathrm{e}^{P(x)}\right]=q(x)\mathrm{e}^{% P(x)}.

Integrating this equation,

y⁢eP⁢(x)=C+∫[q⁢(x)⁢eP⁢(x)]⁢dx,y\mathrm{e}^{P(x)}=C+\int\left[q(x)\mathrm{e}^{P(x)}\right]\,\mathrm{d}x,

where CC is a constant. Hence, recalling that P⁢(x)=∫p⁢(x)⁢dx\displaystyle{P(x)=\int p(x)\,\mathrm{d}x},

equation (1.9) (1.9)
y=C⁢e−P⁢(x)+e−P⁢(x)⁢∫[q⁢(x)⁢eP⁢(x)]⁢dx.y=C\mathrm{e}^{-P(x)}+\mathrm{e}^{-P(x)}\int\left[q(x)\mathrm{e}^{P(x)}\right]% \,\mathrm{d}x.

This is the general solution. The term proportional to CC is often referred to as the complementary function, whilst the rest of the right-hand side is known as the particular integral.

Example 1.6.

Find the general solutions of the following first-order ODEs:

i) y′+yx=x\displaystyle{y^{\prime}+\frac{y}{x}=x};
ii) 5⁢x⁢y′+6⁢y=1+x2\displaystyle{5xy^{\prime}+6y=1+x^{2}}.
Solution.

i) This equation is already in the form y′+p⁢(x)⁢y=q⁢(x)y^{\prime}+p(x)y=q(x). Here, p⁢(x)=1/xp(x)=1/x and q⁢(x)=xq(x)=x. Clearly,

P⁢(x)=∫p⁢(x)⁢dx=∫d⁢xx=ln⁡|x|P(x)=\int p(x)\,\mathrm{d}x=\int\frac{\mathrm{d}x}{x}=\ln|x|

(note that the integrating factor is simply a computational tool, so we can ignore any constants of integration here). Hence,

eP⁢(x)=eln⁡|x|=|x|.\mathrm{e}^{P(x)}=\mathrm{e}^{\ln|x|}=|x|.

Without loss of generality, we can ignore the modulus operator here, setting eP⁢(x)=x\displaystyle{\mathrm{e}^{P(x)}=x} (this is because a negative integrating factor would also work in the same way). Multiplying our original equation by this integrating factor, we obtain the following ODE:

x⁢(y′+yx)=x2⟹x⁢y′+y=x2.x\left(y^{\prime}+\frac{y}{x}\right)=x^{2}\Longrightarrow xy^{\prime}+y=x^{2}.

Referrring to (1.8), we have already shown that this is equivalent to

dd⁢x⁢[y⁢eP⁢(x)]=q⁢(x)⁢eP⁢(x)⟹dd⁢x⁢[x⁢y]=x2.\frac{\mathrm{d}}{\mathrm{d}x}\left[y\mathrm{e}^{P(x)}\right]=q(x)\mathrm{e}^{% P(x)}\Longrightarrow\frac{\mathrm{d}}{\mathrm{d}x}\left[xy\right]=x^{2}.

Integrating this equation,

x⁢y\displaystyle xy
=\displaystyle=
C+x33(where C is constant)\displaystyle C+\frac{x^{3}}{3}\quad\mbox{(where $C$ is constant)}
⟹y\displaystyle\Longrightarrow y
=\displaystyle=
Cx+x23,\displaystyle\frac{C}{x}+\frac{x^{2}}{3},

which is the required result.

[Check: y′+yx=−Cx2+2⁢x3+Cx2+x3=x\displaystyle{y^{\prime}+\frac{y}{x}=-\frac{C}{x^{2}}+\frac{2x}{3}+\frac{C}{x^% {2}}+\frac{x}{3}=x}, as required.]

ii) This equation (5⁢x⁢y′+6⁢y=1+x2\displaystyle{5xy^{\prime}+6y=1+x^{2}}) is not in the correct form to apply the integrating factor directly. Dividing through by 5⁢x5x,

y′+6⁢y5⁢x=15⁢x+x5,y^{\prime}+\frac{6y}{5x}=\frac{1}{5x}+\frac{x}{5},

so p⁢(x)=6/5⁢xp(x)=6/5x and q⁢(x)=(1/5⁢x)+(x/5)q(x)=(1/5x)+(x/5). Here,

P⁢(x)=∫p⁢(x)⁢dx=∫6⁢d⁢x5⁢x=65⁢ln⁡|x|=ln⁡(|x|6/5).P(x)=\int p(x)\,\mathrm{d}x=\int\frac{\mathrm{6d}x}{5x}=\frac{6}{5}\ln|x|=\ln% \left(|x|^{6/5}\right).

Hence,

eP⁢(x)=|x|6/5.\mathrm{e}^{P(x)}=|x|^{6/5}.

Again we can drop the modulus operator, so that eP⁢(x)=x6/5\displaystyle{\mathrm{e}^{P(x)}=x^{6/5}}. Applying this integrating factor,

x6/5⁢y′+6⁢y⁢x1/55=x6/5⁢(15⁢x+x5),x^{6/5}y^{\prime}+\frac{6yx^{1/5}}{5}=x^{6/5}\left(\frac{1}{5x}+\frac{x}{5}% \right),

which, by (1.8), is equivalent to

dd⁢x⁢[x6/5⁢y]=x1/55+x11/55.\frac{\mathrm{d}}{\mathrm{d}x}\left[x^{6/5}y\right]=\frac{x^{1/5}}{5}+\frac{x^% {11/5}}{5}.

Integrating each side of this equation,

x6/5⁢y\displaystyle x^{6/5}y
=\displaystyle=
C+x6/56+x16/516(where C is constant)\displaystyle C+\frac{x^{6/5}}{6}+\frac{x^{16/5}}{16}\quad\mbox{(where $C$ is % constant)}
⟹y\displaystyle\Longrightarrow y
=\displaystyle=
C⁢x−6/5+16+x216,\displaystyle Cx^{-6/5}+\frac{1}{6}+\frac{x^{2}}{16},

which is the required solution.

[Check: 5⁢x⁢y′+6⁢y=−6⁢C⁢x−6/5+5⁢x28+6⁢C⁢x−6/5+1+3⁢x28=1+x2\displaystyle{5xy^{\prime}+6y=-6Cx^{-6/5}+\frac{5x^{2}}{8}+6Cx^{-6/5}+1+\frac{% 3x^{2}}{8}=1+x^{2}}, as required.]

1.3.3 Existence and uniqueness

Theorem: If the functions p⁢(x)p(x) and q⁢(x)q(x) are continuous ∀x∈(a,b)\forall x\in(a,b), then there exists a unique function y⁢(x)y(x), defined on the open interval a<x<ba<x<b, satisfying the linear first-order ODE

y′+p⁢(x)⁢y=q⁢(x),y⁢(x0)=y0,y^{\prime}+p(x)y=q(x),\quad y\left(x_{0}\right)=y_{0},

for some given x0∈(a,b)x_{0}\in(a,b) and y0∈ℝy_{0}\in\mathbb{R}.

Proof: Existence has already been demonstrated by the construction of an explicit solution (1.9). For uniqueness, we assume that there are two solutions y1⁢(x)y_{1}(x) and y2⁢(x)y_{2}(x). Consider the function Y⁢(x)=y1⁢(x)−y2⁢(x)Y(x)=y_{1}(x)-y_{2}(x). Clearly

Y′+p⁢(x)⁢Y\displaystyle Y^{\prime}+p(x)Y
=\displaystyle=
(y1−y2)′+p⁢(x)⁢(y1−y2)\displaystyle\left(y_{1}-y_{2}\right)^{\prime}+p(x)\left(y_{1}-y_{2}\right)
=\displaystyle=
[y1′+p⁢(x)⁢y1]−[y2′+p⁢(x)⁢y2]\displaystyle\left[y_{1}^{\prime}+p(x)y_{1}\right]-\left[y_{2}^{\prime}+p(x)y_% {2}\right]
=\displaystyle=
q⁢(x)−q⁢(x)\displaystyle q(x)-q(x)
⟹Y′+p⁢(x)⁢Y\displaystyle\Longrightarrow Y^{\prime}+p(x)Y
=\displaystyle=
0,\displaystyle 0,

whilst Y⁢(x0)=y1⁢(x0)−y2⁢(x0)=y0−y0=0\displaystyle{Y\left(x_{0}\right)=y_{1}\left(x_{0}\right)-y_{2}\left(x_{0}% \right)=y_{0}-y_{0}=0}. Obviously Y=0Y=0 is a possible solution of this ODE, in which case y1⁢(x)=y2⁢(x)y_{1}(x)=y_{2}(x) (i.e. the solution is unique). For Y≠0Y\neq 0, separation of variables leads to

Y′=−p⁢(x)⁢Y⇔∫d⁢YY=−∫p⁢(x)⁢dx⇔ln⁡|Y|=C−P⁢(x),Y^{\prime}=-p(x)Y\iff\int\frac{\mathrm{d}Y}{Y}=-\int p(x)\,\mathrm{d}x\iff\ln|% Y|=C-P(x),

(where, as before. P⁢(x)=∫p⁢(x)⁢dx\displaystyle{P(x)=\int p(x)\,\mathrm{d}x} and CC is a constant). Rearranging this expression, we see that

Y=A⁢e−P⁢(x),Y=A\mathrm{e}^{-P(x)},

where AA is a redefined constant. The only way that this can be compatible with Y⁢(0)=0Y(0)=0 is if A=0⟹Y⁢(x)=0⁢∀xA=0\Longrightarrow Y(x)=0\;\forall x. This again implies that y1⁢(x)=y2⁢(x)y_{1}(x)=y_{2}(x), i.e. unique solution.

Note.

Linearity is crucial to this result. There are many nonlinear ODEs for which solutions are not unique. For example, consider the following differentiable function,

y⁢(x)={0if⁢x≤C(x−C)2if⁢x>C,}y(x)=\left\{\begin{array}[]{l}0\hskip 59.98422pt\mbox{if}\hskip 7.22743ptx\leq C% \\ (x-C)^{2}\hskip 21.68121pt\mbox{if}\hskip 7.22743ptx>C,\end{array}\right\}

where CC is any positive constant (i.e. C≥0C\geq 0). For any valid choice of CC (of which there are infinitely many), this function satisfies the nonlinear ODE

y′=2⁢y,y^{\prime}=2\sqrt{y},

subject to y⁢(0)=0y(0)=0.