A first-order linear differential equation is one of many irritating nuisances encountered in calculus. I thus present to you its rancid definition:
A first-order linear diffential equation is any differential equation of the form
A first-order linear diffential equation is any differential equation of the form
\frac{\dif x}{\dif t} + p(t)x = q(t)
Which has the plain and simple solution
x = e^{-\int p(t) \dif t} \int e^{\int p(t) \dif t}q(t)\dif t
If you too are confused at this, then you've come to the right place.
First, notice that a first-order linear is very similar to the form \frac{\dif u}{\dif t}v+u\frac{\dif v}{\dif t}, which by the product rule would simply equal \frac{\dif }{\dif t}(uv). Our goal is therefore to put the DE into this form.
The key step is to invent a new function, called f(t), and multiply the first-order linear DE by it:
\frac{\dif x}{\dif t}f(t) + f(t)p(t)x = f(t)q(t)
And if we define f(t)p(t) equal to \frac{\dif f}{\dif t}, the whole thing can simplify with the product rule, just as we expected:
\frac{\dif x}{\dif t}f(t) + \frac{\dif f}{\dif t}x = f(t)q(t)
\frac{\dif }{\dif t}(x \cdot f(t)) = f(t)q(t)
Which is much more manageable.
x \cdot f(t) = \int f(t)q(t) \dif t
x = \frac{1}{f(t)} \int f(t)q(t) \dif t
And you have the solution, assuming you're fine with not explicitly defining f. If that is not the case, then let's find f.
The only condition we gave was
\frac{\dif f}{\dif t}=f(t)p(t)
Rearanging and integrating:
\int \frac{1}{f(t)}\dif f = \int p(t) \dif t
\ln(f(t)) = \int p(t) \dif t
f(t) = e^{\int p(t) \dif t}
And finally substituting it into the solution:
x = e^{-\int p(t) \dif t} \int e^{\int p(t) \dif t}q(t)\dif t
\mathbb{Q.E.D.}