2
$\begingroup$

What is the best strategy to solve a differential equation of the following form?

$\frac{d f}{d x}(x) = g(x)[k(x) - f(x)]$

2 Answers 2

4

Use an integrating factor. Define $G(x) = \exp \int_0^x g(u) du$, and notice that $G'(x) = g(x)G(x)$. Then:

$\frac{d}{dx} f(x) + g(x) f(x) = g(x)k(x)$

$\frac{d}{dx} (f(x)G(x)) = g(x)k(x)G(x)$ (multiplying by $G(x)$)

$f(x)G(x) = f(0)G(0) + \int_0^x g(v)k(v)G(v) dv$ (integrating)

Hence:

$f(x) = \frac{1}{G(x)} \left( f(0)G(0) + \int_0^x g(v)k(v)G(v) dv \right) = e^{-\int_0^x g(u)du} \left( f(0) + \int_0^x g(v)k(v)e^{\int_0^v g(u) du} dv \right)$

1

This simply looks like a first order non-homogeneous differential equation. check wikipedia I would then go on Wolfram|Alpha and ask him to solve it, most of the time it will tell you how it did it if you are actually interested in the solving method.

Further edit:

Actually, you can simply type f'(x)=g(x)(k(x)-f(x)) in W|A and it will spit out the solution as detailed above. No need to think about that stuff anymore, computers do it for us!

  • 1
    "No need to think about that stuff anymore, computers do it for us!" So wrong.2015-11-27