$f:\mathbb R \to \mathbb R$ be twice differentiable , $f(x)+f''(x)=-xg(x)f'(x) , g(x) \ge 0 , \forall x \in \mathbb R$ , then $f$ is bounded? Let $g:\mathbb R \to [ 0,\infty)$ be a function and $f:\mathbb R \to \mathbb R$ be a twice differentiable function such that 
$f(x)+f''(x)=-xg(x)f'(x) , \forall x \in \mathbb R$ , then is it true that $f$ is bounded i.e. $\exists M \ge0 $ such that 
$|f(x)| \le M , \forall x \in \mathbb R$ ? 
 A: Here is my answer. The function $f$ is indeed bounded on $\mathbb{R}$. From 
$$
f(x)+f^{\prime \prime }(x)+xg(x)f^{\prime }(x)=0,\ x\in \mathbb{R}
$$ multiply by $2f^{\prime }(x)$ the equation, we get $$
2f(x)f^{\prime }(x)+2f^{\prime }(x)f^{\prime \prime }(x)+2xg(x)\left[
f^{\prime }(x)\right] ^{2}=0,\ \ \ \ for\ all\ x\in 
\mathbb{R}
$$ then
$$
\left[ f^{2}(x)\right] ^{\prime }+\left[ \left( f^{\prime }\right) ^{2}(x)%
\right] ^{\prime }+2xg(x)\left[ f^{\prime }(x)\right] ^{2}=0,\ \ \ \ for\
all\ x\in 
\mathbb{R}
$$ Now, integrate 
$$
\int \left( \left[ f^{2}(x)\right] ^{\prime }+\left[ \left( f^{\prime
}\right) ^{2}(x)\right] ^{\prime }+2xg(x)\left[ f^{\prime }(x)\right]
^{2}\right) dx=C,\ \ \ \ for\ all\ x\in 
\mathbb{R}
$$ then%
$$
f^{2}(x)-f^{2}(0)+\left( f^{\prime }\right) ^{2}(x)-\left( f^{\prime
}\right) ^{2}(0)+\int_{0}^{x}2tg(t)\left[ f^{\prime }(t)\right] ^{2}dt=0,\ \
\ \ for\ all\ x\in 
\mathbb{R}
$$ therefore%
$$
f^{2}(x)+\left( f^{\prime }\right) ^{2}(x)+\int_{0}^{x}2tg(t)\left[
f^{\prime }(t)\right] ^{2}dt=f^{2}(0)+\left( f^{\prime }\right) ^{2}(0),\
\ \ \ for\ all\ x\in 
\mathbb{R}
$$ Assume that $f$ is not bounded on $\left[ 0,+\infty \right) ,$ then there
exists a sequence $(x_{n})$ such that $\lim_{n\rightarrow \infty
}x_{n}=+\infty $ and $\lim_{n\rightarrow \infty }f^{2}(x_{n})=+\infty .$
Then, $\lim_{n\rightarrow \infty }f^{2}(x_{n})+\left( f^{\prime }\right)
^{2}(x_{n})=+\infty $ (because $f^{2}(x_{n})+\left( f^{\prime }\right)
^{2}(x_{n})\geq f^{2}(x_{n})\overset{n\rightarrow \infty }{\rightarrow }%
\infty $). Since the right hand side is constant, then we should have%
$$
\lim_{n\rightarrow \infty }\int_{0}^{x_{n}}2tg(t)\left[ f^{\prime }(t)\right]
^{2}dt=-\infty 
$$
which is impossible since the integrand function is completely positive on $%
\left[ 0,+\infty \right) .$ It follows that $f$ is bounded on $\left[
0,+\infty \right) .$ The same idea allows one to show that $f$ is bounded on 
$\left( -\infty ,0\right] .$ In fact,
Assume that $f$ is not bounded on $\left( -\infty ,0\right] ,$ then there
exists a sequence $(x_{n})$ such that $\lim_{n\rightarrow \infty
}x_{n}=-\infty $ and $\lim_{n\rightarrow \infty }f^{2}(x_{n})=+\infty .$
Then, $\lim_{n\rightarrow \infty }f^{2}(x_{n})+\left( f^{\prime }\right)
^{2}(x_{n})=+\infty $ (because $f^{2}(x_{n})+\left( f^{\prime }\right)
^{2}(x_{n})\geq f^{2}(x_{n})\overset{n\rightarrow \infty }{\rightarrow }%
\infty $). Since the right hand side is constant, then we should have%
$$
-\infty =\lim_{n\rightarrow \infty }\int_{0}^{x_{n}}2tg(t)\left[ f^{\prime
}(t)\right] ^{2}dt=-\lim_{n\rightarrow \infty }\int_{x_{n}}^{0}2tg(t)\left[
f^{\prime }(t)\right] ^{2}dt
$$
then%
$$
\lim_{n\rightarrow \infty }\int_{x_{n}}^{0}2tg(t)\left[ f^{\prime }(t)\right]
^{2}dt=+\infty 
$$
which is impossible since ($x_{n}<0)$ and the integrand function is
completely negative on $\left( -\infty ,0\right] $ (there is $t$ inside). It
follows that $f$ is bounded on $\left( -\infty ,0\right] .$ Therefore, $f$
is bounded on the whole $
\mathbb{R}$
A: Given that
$f(x)+f''(x)=-xg(x)f'(x), \tag{1}$
we may multiply through by $f'(x)$:
$f(x)f'(x) + f'(x)f''(x) = -x g(x) (f'(x))^2, \tag{2}$
and since
$\dfrac{1}{2}((f(x))^2 + (f'(x))^2)' = f(x)f'(x) + f'(x)f''(x), \tag{3}$
(2) becomes
$\dfrac{1}{2}((f(x))^2 + (f'(x))^2)' = -x g(x) (f'(x))^2. \tag{4}$
Taking $x \ge 0$ for the moment, we may integrate (4) 'twixt $0$ and $x$, thusly:
$\dfrac{1}{2}((f(x))^2 + (f'(x))^2) - \dfrac{1}{2}((f(0))^2 + (f'(0))^2) = \dfrac{1}{2}\int_0^x ((f(s))^2 + (f'(s))^2)' ds$
$=  -\int_0^x s g(s) (f'(s))^2 ds, \tag{5}$
or
$\dfrac{1}{2}((f(x))^2 + (f'(x))^2) = \dfrac{1}{2}((f(0))^2 + (f'(0))^2) - \int_0^x s g(s) (f'(s))^2 ds. \tag{6}$
It will be observed that, for $s \ge 0$, $s g(s) (f'(s))^2 \ge 0$, whence 
$\int_0^x s g(s) (f'(s))^2 ds \ge 0, \tag{7}$
and so from (6) and (7) we have
$\dfrac{1}{2}((f(x))^2 + (f'(x))^2) = \dfrac{1}{2}((f(0))^2 + (f'(0))^2) - \int_0^x s g(s) (f'(s))^2 ds \le \dfrac{1}{2}((f(0))^2 + (f'(0))^2); \tag{8}$
indeed, since $(f(x))^2 + (f'(x))^2 \ge 0$, we may write
$0 \le \dfrac{1}{2}((f(x))^2 + (f'(x))^2) = \dfrac{1}{2}((f(0))^2 + (f'(0))^2) - \int_0^x s g(s) (f'(s))^2 ds \le \dfrac{1}{2}((f(0))^2 + (f'(0))^2), \tag{9}$
for all $x \ge 0$.  Thus
$0 \le (f(x))^2 \le (f(x))^2 + (f'(x))^2 \le (f(0))^2 + (f'(0))^2, \tag{10}$
showing $f(x)$ is bounded for $x \ge 0$; indeed,
$\vert f(x) \vert \le \sqrt{f(0))^2 + (f'(0))^2} \tag{11}$
for all non-negative $x$.  For $x \le 0$, we integrate from $x$ to $0$, viz.,
$\dfrac{1}{2}((f(0))^2 + (f'(0))^2) - \dfrac{1}{2}((f(x))^2 + (f'(x))^2) =  -\int_x^0 s g(s) (f'(s))^2 ds; \tag{12}$
re-arranging:
$\dfrac{1}{2}((f(x))^2 + (f'(x))^2) = \dfrac{1}{2}((f(0))^2 + (f'(0))^2) + \int_x^0 s g(s) (f'(s))^2 ds; \tag{13}$
for $s \le 0$, $s g(s) (f'(s))^2 \le 0$, whence $\int_x^0 sg(s)(f'(s))^2 ds \le 0$ and we again conclude
$0 \le \dfrac{1}{2}((f(x))^2 + (f'(x))^2) \le  \dfrac{1}{2}((f(0))^2 + (f'(0))^2), \tag{14}$
which as before leads to the conclusion that
$\vert f(x) \vert \le \sqrt{(f(0))^2 + (f'(0))^2} \tag{15}$
for all $x \le 0$ as well.  $f(x)$ is bounded by $\sqrt{(f(0))^2 + (f'(0))^2}$ for all $x$.
Hope this helps.  Cheers,
and as ever,
Fiat Lux!!!
A: @user123733, You are right, it is possible to avoid completly the intergration. Here is an answer using your the idea in your comment which uses only
derivatives from Calculus 1. 
Multiply the equation
\begin{equation*}
f(x)+f^{\prime \prime }(x)+xg(x)f^{\prime }(x)=0,\ x\in 
\mathbb{R}
\end{equation*}
by $2f^{\prime }(x)$, we get
\begin{equation*}
2f(x)f^{\prime }(x)+2f^{\prime }(x)f^{\prime \prime }(x)+2xg(x)\left[
f^{\prime }(x)\right] ^{2}=0,\ \ \ \ for\ all\ x\in 
%TCIMACRO{\U{211d} }
%BeginExpansion
\mathbb{R}
%EndExpansion
.
\end{equation*}
Then
\begin{equation*}
\left[ f^{2}(x)\right] ^{\prime }+\left[ \left( f^{\prime }\right) ^{2}(x)%
\right] ^{\prime }+2xg(x)\left[ f^{\prime }(x)\right] ^{2}=0,\ \ \ \ for\
all\ x\in 
%TCIMACRO{\U{211d} }%
%BeginExpansion
\mathbb{R}
%EndExpansion
.
\end{equation*}
So,
\begin{equation*}
\left[ f^{2}(x)+\left( f^{\prime }\right) ^{2}(x)\right] ^{\prime }=-2xg(x)%
\left[ f^{\prime }(x)\right] ^{2},\ \ \ \ for\ all\ x\in 
%TCIMACRO{\U{211d} }%
%BeginExpansion
\mathbb{R}
%EndExpansion
.
\end{equation*}
it follows that the derivative of the function definied by
\begin{equation*}
h(x)=f^{2}(x)+\left( f^{\prime }\right) ^{2}(x),\ for\ all\ x\in 
%TCIMACRO{\U{211d} }
%BeginExpansion
\mathbb{R}
%EndExpansion
\end{equation*}
is of opposit $x^{\prime }s$ sign$;$ it is nonnegative for $x<0$ and
nonpositive for $x>0.$ This implies that the function $h$ is increasing in
the interval $\left( -\infty ,0\right) $ and is decreasing in the interval $%
\left( 0,+\infty \right) .$ Therefore, it admits a unique absolut maximum value at $x=0$
So,
\begin{equation*}
h(x)\leq h(0),\ for\ all\ x\in 
%TCIMACRO{\U{211d} }
%BeginExpansion
\mathbb{R}
%EndExpansion%
\end{equation*}
so
\begin{equation*}
f^{2}(x)+\left( f^{\prime }(x)\right) ^{2}\leq f^{2}(0)+\left( f^{\prime
}(0)\right) ^{2},\ \ \ \ for\ \ all\ x\in 
%TCIMACRO{\U{211d} }%
%BeginExpansion
\mathbb{R}
%EndExpansion%
\end{equation*}
but,  $\left( f^{\prime }(x)\right) ^{2}\geq 0,$ for all $\ x\in 
%TCIMACRO{\U{211d} }%
%BeginExpansion%
\mathbb{R}
%EndExpansion%
,$ then 
\begin{equation*}
f^{2}(x)\leq f^{2}(x)+\left( f^{\prime }(x)\right) ^{2},\ \ \ \ for\ \ all\
x\in 
%TCIMACRO{\U{211d} }
%BeginExpansion%
\mathbb{R}
%EndExpansion%
\end{equation*}
therefore
\begin{equation*}
f^{2}(x)\leq f^{2}(0)+\left( f^{\prime }(0)\right) ^{2},\ \ \ \ for\ \ all\
x\in 
%TCIMACRO{\U{211d} }%
%BeginExpansion
\mathbb{R}
%EndExpansion%
\end{equation*}
which implies that
\begin{equation*}
\left\vert f(x)\right\vert \leq \sqrt{f^{2}(0)+\left( f^{\prime }(0)\right)
^{2}},\ \ \ \ for\ \ all\ x\in 
%TCIMACRO{\U{211d} }
%BeginExpansion
\mathbb{R}
%EndExpansion%
.
\end{equation*}
The proof that $f$ is bounded on $
%TCIMACRO{\U{211d} }
%BeginExpansion
\mathbb{R}%
%EndExpansion%
$ is complete.
