# Solution to Linear First Order Ordinary Differential Equation

## Theorem

A linear first order ordinary differential equation in the form:

$\dfrac {\d y} {\d x} + \map P x y = \map Q x$

has the general solution:

$\ds y = e^{-\int P \rd x} \paren {\int Q e^{\int P \rd x} \rd x + C}$

## Proof 1

Consider the first order ordinary differential equation:

$\map M {x, y} + \map N {x, y} \dfrac {\d y} {\d x} = 0$

We can put our equation:

$(1): \quad \dfrac {\d y} {\d x} + \map P x y = \map Q x$

into this format by identifying:

$\map M {x, y} \equiv \map P x y - \map Q x, \map N {x, y} \equiv 1$

We see that:

$\dfrac {\partial M} {\partial y} - \dfrac {\partial N} {\partial x} = \map P x$

and hence:

$\map P x = \dfrac {\dfrac {\partial M} {\partial y} - \dfrac {\partial N} {\partial x} } N$

is a function of $x$ only.

It immediately follows from Integrating Factor for First Order ODE that:

$e^{\int \map P x \rd x}$

is an integrating factor for $(1)$.

So, multiplying $(1)$ by this factor:

$e^{\int \map P x \rd x} \dfrac {\d y} {\d x} + e^{\int \map P x \rd x} \map P x y = e^{\int \map P x \rd x} \map Q x$

The result follows by an application of Solution to Exact Differential Equation.

$\blacksquare$

## Proof 2

From the Product Rule for Derivatives:

 $\ds \frac \d {\d x} \paren {e^{\int \map P x \rd x} y}$ $=$ $\ds e^{\int \map P x \rd x} \dfrac {\d y} {\d x} + y e^{\int \map P x \rd x} \map P x$ $\ds$ $=$ $\ds e^{\int \map P x \rd x} \paren {\dfrac {\d y} {\d x} + \map P x y}$

Hence, multiplying $(1)$ all through by $e^{\int \map P x \rd x}$:

$\dfrac \d {\d x} \paren {e^{\int \map P x \rd x} y} = \map Q x e^{\int \map P x \rd x}$

Integrating with respect to $x$ now gives:

$\ds e^{\int \map P x \rd x} y = \int \map Q x e^{\int \map P x \rd x} \rd x + C$

whence we get the result by dividing by $e^{\int \map P x \rd x}$.

$\blacksquare$

## Also reported as

This result is also reported as:

$\ds y e^{\int P \rd x} = \int Q e^{\int P \rd x} \rd x + C$