# General Solution To Linear First Order ODEs

2023/10/21 9:38 PM UTC

A linear ordinary differential equation (ODE) is any equation of the form:

$a_{n}(x)\frac{d^{n}y}{dx^{n}} + a_{n-1}(x)\frac{d^{n-1}y}{dx^{n-1}} + \cdots + a_{1}(x)\frac{dy}{dx} + a_{0}(x)y = f(x)$

This differential equation is ordinary because it only contains derivatives of a single dependent variable, y. It is linear because each derivative of $y$ is linear (i.e. there is no $(\frac{dy}{dx})^{2}$ etc.). A first order linear ODE contains only the first derivative.

$\begin{equation} \frac{dy}{dx} + a_{0}(x)y = f(x) \end{equation}$

Linear ODEs of this type have a general solution that can be found through the use of an integrating factor. The goal is to choose an integrating factor, $p(x)$, such that the above form is equivalent to:

$\frac{d}{dx}(py) = p(x)f(x)$

Notice that this can be rewritten as:

$\begin{equation} \frac{dy}{dx} + \frac{1}{p}\frac{dp}{dx} = f(x) \end{equation}$

By comparing (1) and (2), we notice that $p(x)$ is an integrating factor if and only if

$\frac{1}{p}\frac{dp}{dx} = a_{0}(x)$

By inspection we can see that a solution for $p(x)$ is

$p(x) = e^{\int{a_{0}(x)}dx}$

Now the solution of (1) can be found by integration.

\begin{aligned} \int\frac{d}{dx}(py)dx &= \int p(x)f(x)dx\\\\ p(x)y(x) &= \int p(x)f(x)dx + C\\\\ y(x) &= \frac{1}{p(x)}\int p(x)f(x)dx + C \end{aligned}

And we have our solution. Note that there are other ways to solve linear ODEs that may be much faster than this for specific scenarios. However this solution works in all cases.