First order linear ODEs |
A first order linear ODE can be written as follows
\[\frac{dy}{dx}+p(x)y=g(x),\]
where \(p\) and \( g\) are functions of \(x\).
Steps to solve: Multiply both sides by the integrating factor \(\displaystyle e^{\int p(x)\, dx}\):
\[\begin{align*}
\frac{dy}{dx}e^{\int p\, dx}+p(x)ye^{\int p\, dx}&=g(x)e^{\int p\, dx}\\
\frac{d}{dx}\left( ye^{\int p\, dx}\right)&=g(x)e^{\int p\, dx}\\
\int d\left( ye^{\int p\, dx}\right)&=\int \left( g(x)e^{\int p\, dx}\right) dx\\
ye^{\int p\, dx}&=\int \left( g(x)e^{\int p\, dx}\right) dx+c\\
y&=e^{-\int p\, dx}\left[\int \left( g(x)e^{\int p\, dx}\right) dx+c\right]\\
\end{align*}\]
Example.
Solve the following first order linear ODE.
\[x\frac{dy}{dx}+(2x^2+1)y=2x,\; y(1)=2\]
Find the valid interval of the solution. Find the behavior of \(y\) when \(x\to \infty\).
Solution. Let's write it in the standard form.
\[\begin{equation}
\frac{dy}{dx}+\left(2x+\frac{1}{x}\right)y=2,\; y(1)=2 \;\;\;\;(11)
\end{equation}\]
The IF is \(e^{\int\left(2x+\frac{1}{x}\right)\, dx}=e^{x^2+\ln|x|}=e^{x^2}e^{\ln|x|}=xe^{x^2}\). Multiply both sides of (11) by the IF \(xe^{x^2}\).
\[\begin{align*}
\frac{dy}{dx}xe^{x^2}+y\left(2x+\frac{1}{x}\right)xe^{x^2}&=2xe^{x^2}\\
\frac{d}{dx}\left(yxe^{x^2} \right)&=2xe^{x^2}\\
\int d\left(yxe^{x^2} \right)&=\int 2xe^{x^2}\, dx \text{ (substitute } u=x^2)\\
yxe^{x^2}&=e^{x^2}+c
\end{align*}\]
From the initial condition \(y(1)=2\), we get
\[2\cdot 1e=e+c \implies c=e.\]
Thus we get \(yxe^{x^2}=e^{x^2}+e\) and the solution is
\[\displaystyle y=\frac{e^{x^2}+e}{xe^{x^2}}.\]
The domain of \(y\) is \((-\infty,0)\cup (0,\infty)\). Because of the initial condition \(y(1)=2\),
the valid interval of the solution is \((0,\infty)\). Note that \(\displaystyle y=\frac{1}{x}+\frac{e}{xe^{x^2}}\to 0\) as \(x\to \infty\).
Example. Solve the following first order linear ODE. \[\frac{dy}{dt}+y\cos t=\cos t,\; y(0)=\pi\] Solution. The IF is \(e^{\int \cos t\, dt}=e^{\sin t}\). Multiply both sides of the ODE by the IF \(e^{\sin t}\). \[\begin{align*} \frac{dy}{dt}e^{\sin t}+y\cos t\; e^{\sin t}&=\cos t\; e^{\sin t}\\ \frac{d}{dt}\left(ye^{\sin t} \right)&=\cos t\; e^{\sin t}\\ \int d\left(ye^{\sin t} \right)&=\int \cos t\; e^{\sin t} \; dt\\ ye^{\sin t}&=\int e^u\, du && (u=\sin t,\, du=\cos t \, dt)\\ &=e^u+c && \\ &=e^{\sin t}+c && \end{align*}\] From the initial condition \(y(0)=\pi\), we get \[\pi\cdot e^0=e^0+c \implies c=\pi-1.\] Thus \(ye^{\sin t}=e^{\sin t}+\pi-1\) and hence the solution is \[\displaystyle y=\frac{e^{\sin t}+\pi-1}{e^{\sin t}}=1+(\pi-1) e^{-\sin t}.\]
Last edited