Show that $f$ is bounded if $f(x)+f''(x)=-xg(x)f'(x)$ where $g\ge0$ Let $f$ be a twice differentiable real valued function such that 
$f(x)+f''(x)=-xg(x)f'(x)$
Where $g(x)\geq 0$ for all real $x$
Show that $|f(x) |$ is a bounded function. 
 A: Multiplying both sides by $f'(x)$, one has
$$ \frac12[(f(x))^2+(f'(x))^2]'=-xg(x)(f'(x))^2\le 0 $$
for $x>0$. Then integrating both sides from $0$ to $x$, one has
$$ (f(x))^2+(f'(x))^2\le(f(0))^2+(f'(0))^2$$
from which one obtains 
$$ (f(x))^2\le (f(x))^2+(f'(x))^2\le (f(0))^2+(f'(0))^2. $$
So $|f(x)|$ is bounded. If $x<0$, one can use the same way to establish.
A: Start with the observation that
$\dfrac{d}{dx}((f'(x))^2 + (f(x))^2) = 2f'(x)f''(x) + 2 f(x) f'(x); \tag 1$
since we are given that
$f''(x) + f(x) = -x g(x) f'(x), \tag 2$
we find, upon multiplying (2) through by $f'(x)$, that
$f'(x)f''(x) + f(x)f'(x)  = -x g(x) (f'(x))^2; \tag 3$
thus (1) yields
$\dfrac{d}{dx}((f'(x))^2 + (f(x))^2) = -2x g(x) (f'(x))^2. \tag 4$
We may integrate (4) 'twixt $0$ and any $x \ge 0$:
$((f'(x))^2 + (f(x))^2) - ((f'(0))^2 + (f(0))^2)$
$= \displaystyle \int_0^x \dfrac{d}{ds}((f'(s))^2 + (f(s))^2)ds = -2\int_0^x s g(s)(f'(s))^2 ds. \tag 5$
If we set
$M_+(x) = \displaystyle -2\int_0^x s g(s)(f'(s))^2 ds, \tag 6$
we that
$M_+(x) \le 0 \tag 7$
since $s$, $g(s)$, and $(f'(s))^2$ are all non-negative on $[0, x]$.  Therefore
$(f'(x))^2 + (f(x))^2 = (f'(0))^2 + (f(0))^2 + M_+(x) \le (f'(0))^2 + (f(0))^2); \tag 8$
also,
$\vert f(x) \vert^2 = (f(x))^2 \le (f'(x))^2 + (f(x))^2 \le (f'(0))^2 + (f(0))^2, \tag 9$
whence
$\vert f(x) \vert \le \sqrt{(f'(0))^2 + (f(0))^2} \tag {10}$
for all $x \ge 0$.
In the event that $x < 0$, noting that (4) binds for all $x \in \Bbb R$,
we may write
$((f'(0))^2 + (f(0))^2) - ((f'(x))^2 + (f(x))^2)$
$= \displaystyle \int_x^0 \dfrac{d}{ds}((f'(s))^2 + (f(s))^2)ds = -2\int_x^0 s g(s)(f'(s))^2 ds; \tag {11}$
now setting
$M_-(x) = \displaystyle -2\int_x^0 s g(s)(f'(s))^2 ds, \tag{12}$
we see that, since $xg(x)(f'(x))^2 \le 0$ for $x \le 0$,
$M_-(x) \ge 0, \tag{13}$
and re-arranging (11) we obtain
$(f'(x))^2 + (f(x))^2 = (f'(0))^2 + (f(0))^2 - M_-(x) \le (f'(0))^2 + (f(0))^2); \tag{14}$
which again leads to (9) and hence (10).  We see that $\vert f(x) \vert$ is bounded for all $x \in \Bbb R$.
