if $f'(x)\ne0, g(x)>0 \forall x \in 0$, prove that $|f(x)| < 5$ 
if $f(x)$ is a twice differentiable real-valued function satisfying $f'(x)\ne0, f(0) = -3, f'(0) = 4$, such that $f(x) + f''(x) = -xg(x)f'(x), \space g(x) > 0$ for all $x > 0$. Prove that $|f(x)| \le 5$

There was a hint in the problem to first prove that $(f(x))^2 + (f'(x))^2$ is decreasing for all $x \in R^+$ and to use this result to prove the above statement. This relation can be easily proved since
$$\frac{d}{dx}((f(x))^2 + (f'(x))^2) = 2f'(x)(f(x) + f''(x)) \\
 = -2xg(x)(f'(x))^2 \\
 < 0 \space \space \forall \space x \in R^+$$
I could not use this result to prove that $|f(x)| < 5$. Any hints/solutions in solving this problem are appreciated!
 A: $\boxed{\textit{Solution:}}~$We consider 2 cases.
$\bullet~$When $x > 0$.
as we know that $g(x) \geqslant 0$, for $x > 0$, we have for the interval $[0, t]$ for $t > 0$.
\begin{align*}
        &f(x) + f''(x) = - x g(x) f'(x)\\
        \implies & f(x) f'(x) + f'(x) f''(x) = - x g(x) \{ f(x) \}^{2} \leqslant 0 \quad [\text{ as } x \geqslant 0 \text{  } ] \\
        \implies & \int_{0}^{t} f(x) f'(x) dx + \int_{0}^{t} f'(x) f''(x) dx \leqslant 0\\
        \implies & \bigg[ \frac{[f(t)]^2}{2} - \frac{[f(0)]^2}{2} \bigg] + \bigg[ \frac{[f'(t)]^2}{2} - \frac{[f'(0)]^2}{2} \bigg] \leqslant 0\\
        \implies & \bigg[ \frac{[f(t)]^2}{2} +  \frac{[f'(t)]^2}{2} \bigg] \leqslant \bigg[ \frac{[f(0)]^2}{2} + \frac{[f'(0)]^2}{2} \bigg]\\
       \implies &\frac{[f(t)]^2}{2} \leqslant \bigg[ \frac{[f(t)]^2}{2} +  \frac{[f'(t)]^2}{2} \bigg] \leqslant \frac{25}{2} ~; [\text{ where } \bigg[ \frac{[f(0)]^2}{2} + \frac{[f'(0)]^2}{2} \bigg] = \frac{3^2}{2} + \frac{4^2}{2} = \frac{25}{2} > 0 \text{  }]\\
        \implies & \frac{[f(t)]^2}{2} \leqslant \frac{25}{2}\\
        \implies & {[f(t)]^2} \leqslant 25 \\
        \implies & \lvert f(t) \rvert \leqslant \sqrt{25} = 5 \quad 
%\text{ hence } 5 \text{ be the bound we require for all } t > 0 
    \end{align*}
$\bullet$ When $x < 0$.
as we know that $g(x) \geqslant 0$, for $x < 0$, we have for the interval $[t, 0]$ for $t < 0$.
\begin{align*}
        &f(x) + f''(x) = - x g(x) f'(x)\\
        \implies & f(x) f'(x) + f'(x) f''(x) = - x g(x) \{ f(x) \}^{2} \geqslant 0 \quad [\text{ as } x \leqslant 0 \text{  } ] \\
        \implies & \int_{t}^{0} f(x) f'(x) dx + \int_{t}^{0} f'(x) f''(x) dx \geqslant 0\\
        \implies & \bigg[ \frac{[f(0)]^2}{2} - \frac{[f(t)]^2}{2} \bigg] + \bigg[ \frac{[f'(0)]^2}{2} - \frac{[f'(t)]^2}{2} \bigg] \geqslant 0\\
        \implies & \bigg[ \frac{[f(t)]^2}{2} +  \frac{[f'(t)]^2}{2} \bigg] \leqslant \bigg[ \frac{[f(0)]^2}{2} + \frac{[f'(0)]^2}{2} \bigg]\\
        \implies & \frac{[f(t)]^2}{2} \leqslant \bigg[ \frac{[f(t)]^2}{2} +  \frac{[f'(t)]^2}{2} \bigg] \leqslant \frac{25}{2} ~; [\text{ where }\bigg[ \frac{[f(0)]^2}{2} + \frac{[f'(0)]^2}{2} \bigg] = \frac{3^2}{2} + \frac{4^2}{2} = \frac{25}{2} > 0 \text{  }]\\
        \implies & \frac{[f(t)]^2}{2} \leqslant \frac{25}{2}\\
        \implies & {[f(t)]^2} \leqslant 25\\
        \implies & \lvert f(t) \rvert \leqslant \sqrt{25} = 5 
%\quad \text{ hence } M_{2} \text{ be the bound we require for all } t < 0 
    \end{align*}
Therefore from the values of $f(0)$ and $f'(0)$ given we have obtained
\begin{align*}
    \lvert f(x) \rvert \leqslant 5\ \quad \text{for all } x \in \mathbb{R} 
\end{align*}
Hence we have proved that the function $f$ is bounded.
