2023-09-23 12:46:18 +02:00
# First-order differential equations
2023-10-23 16:32:39 +02:00
## First-order linear differential equations
2023-09-23 12:46:18 +02:00
A first-order **linear** differential equation is one of the type
$$
\frac{dy}{dx} + p(x) y = q(x).
$$
where $p(x)$ and $q(x)$ are given functions, which may be assumed to be continuous. The equation is called **nonhomogeneous** unless $q(x)$ is dentically zero. The corresponding **homogeneous** equation
$$
\frac{dy}{dx} + p(x)y = 0,
$$
is separable and so is easily solved. By seperation of variables
$$
\frac{dy}{dx} = -p(x)y \implies \int \frac{1}{y}dy = \int p(x)dx.
$$
Though, pay attention to absolute values.
There are two methods for solving nonhomogeneous equations.
### Integration factor
The first method is by using an integrating factor. Let $\mu(x)$ be an antiderivative of $p(x)$ and multiply the equation by $e^{\mu(x)}$.
$$
\begin{array}{ll}
e^{\mu(x)} \frac{dy}{dx} + e^{\mu(x)} p(x) y = e^{\mu(x)} q(x) & \implies \frac{d}{dx}(e^{\mu(x)} y) = q(x) e^{\mu(x)}, \\
& \implies e^{\mu(x)} y = \int q(x) e^{\mu(x)}dx, \\
& \implies y(x) = e^{-\mu(x)} \int q(x) e^{\mu(x)}dx.
\end{array}
$$
### Variation of the constant
The second method is by using a variation of a constant. Let $\mu(x)$ be an antiderivative of $p(x)$ and solve the homegeneous equation
$$
\frac{dy}{dx} + p(x)y = 0 \implies y(x) = k e^{-\mu(x)}.
$$
Try:
$$
y'(x) + p(x) y(x) = q(x) = k'(x) e^{\mu(x)},
$$
thus $k'(x) = q(x) e^{\mu(x)}$.
#### Example
Solve $\frac{dy}{dx} + 2xy = x$ with $y(0) = 3$.
First solving the homogeneous equation
$$
\begin{array}{ll}
\frac{dy}{dx} + 2xy = 0 & \implies \int \frac{1}{y} dy = -2\int xdx
\end{array}
$$