A proof for solution of first order differential equation Let $f\left( x \right)$ and $g\left( x \right)$ be continuous functions on  $\left[ 0,\infty  \right)$ satisfying $f\left( x \right)>0$ for all $x\ge 0$,
$$
\int_{0}^{\infty }{f\left( x \right)dx=\infty \quad and\quad }M=\int_{0}^{\infty }{\frac{{{g}^{2}}\left( x \right)}{f\left( x \right)}dx<\infty }.
$$
My Question: I would like to show that a solution of the differential equation:
$$
{y}'\left( x \right)=f\left( x \right)y\left( x \right)+g\left( x \right)
$$
Satisfying
$$
\int_{0}^{\infty }{f\left( x \right){{y}^{2}}\left( x \right)dx<\infty }
$$
is uniquely determined and satisfies:
$$
 \int_{0}^{\infty }{f\left( x \right){{y}^{2}}\left( x \right)dx<M}.
$$
Note:I think the proof of this statement is based on the formula which gives the solution of first order differential equation and the Cauchy-Schwarz inequality, however i don't know how to continue. Any ideas?
 A: 
This is not an answer, but rather a very extended comment.  After performing a lot of calculation I am stuck.  If someone will be able to resume my reasoning, or prove the result in a different way, I will delete the present note.

The solution of the ODE
\begin{equation*}
y'(x) = f(x) \, y(x) + g(x)
\end{equation*}
has the form
\begin{equation*}
y(x) = e^{F(x)} \biggl( y(0) + \int\limits_{0}^{x} e^{-F(\xi)} \, g(\xi) \, \mathrm{d}\xi \biggr),
\end{equation*}
where
\begin{equation*} 
F(x) := \int\limits_{0}^{x} f(\xi) \, \mathrm{d}\xi.
\end{equation*}
We are looking for a solution that is rather small at infinity.  As the factor $e^{F(x)}$ is very large, the only way to compensate it is to take
$$
\tag{1}
y(0) = - \int\limits_{0}^{\infty} e^{-F(\xi)} \, g(\xi) \, \mathrm{d}\xi.
$$
Let us check if the integral on the right-hand side of $(1)$ is convergent.  We write, for any $0 \le x_1 < x_2$,
$$
\int\limits_{x_1}^{x_2} e^{-F(\xi)} \, \lvert g(\xi) \rvert \, \mathrm{d}\xi = \int\limits_{x_1}^{x_2} e^{-F(\xi)} \, \sqrt{f(\xi)} \cdot \frac{\lvert g(\xi) \rvert}{\sqrt{f(\xi)}} \, \mathrm{d}\xi,
$$
which is, via the Cauchy-Schwarz inequality,
$$
\le \biggl(\int\limits_{x_1}^{x_2} e^{-2F(\xi)} f(\xi) \, \mathrm{d}\xi \biggr)^{\!1/2} \cdot
\biggl(\int\limits_{x_1}^{x_2} \frac{g^2(\xi)}{f(\xi)} \, \mathrm{d}\xi \biggr)^{\! 1/2}.
$$
The second factor in the above is $\le \sqrt{M}$.  Regarding the first factor, by substitution $\zeta = f(\xi)$ we obtain that it is equal to
$$
\sqrt{\frac{1}{2}(e^{-2F(x_1)}-e^{-2F(x_2)})}.
$$
The Cauchy criterion for convergence of improper integrals gives that the right-hand side of $(1)$ is absolutely convergent, so $(1)$ makes sense.
Denote
$$
\varphi(x) := - e^{F(x)} \int\limits_{x}^{\infty} e^{-F(\xi)} \, g(\xi) \, \mathrm{d}\xi.
$$ 
Recall that our aim is to show that
$$
\int\limits_{0}^{\infty} e^{2F(x)} \, f(x) \biggl(\int\limits_{x}^{\infty} e^{-F(\xi)} \, g(\xi) \, \mathrm{d}\xi \biggr)^{\! 2} \, \mathrm{d}x < M.
$$
Applying the Cauchy-Schwarz inequality in a manner similar to that used several lines above we obtain
$$
\biggl(\int\limits_{x}^{\infty} e^{-F(\xi)} \, g(\xi) \, \mathrm{d}\xi \biggr)^{\! 2} \le \biggl( \int\limits_{x}^{\infty} e^{-2F(\xi)} \, f(\xi) \, \mathrm{d}\xi \biggr) \biggl( \int\limits_{x}^{\infty} \frac{g^2(\xi)}{f(\xi)} \, \mathrm{d}\xi \biggr) =\frac{1}{2} e^{-2F(x)} \biggl( \int\limits_{x}^{\infty} \frac{g^2(\xi)}{f(\xi)} \, \mathrm{d}\xi \biggr).
$$
Consequently,
$$
\int\limits_{0}^{\infty} \varphi^2(x) f(x) \, \mathrm{d}x \le \int\limits_{0}^{\infty} f(x) \biggl( \int\limits_{x}^{\infty} \frac{g^2(\xi)}{f(\xi)} \, \mathrm{d}\xi \biggr) \, \mathrm{d}x.
$$ 

Here I am stuck.  Perhaps integration by parts? 

If we have existence, uniqueness is quite easy. Take two solutions, $\varphi_1(\cdot)$ and $\varphi_2(\cdot)$, satisfying the required inequality.  We have then
$$
\int\limits_{0}^{\infty} f(x) \, (\varphi_1(x) - \varphi_2(x))^2 \, \mathrm{d}x < \infty.
$$
Since the difference of the solutions has the form
$$
\varphi_1(x) - \varphi_2(x) = c e^{F(x)}, \quad x \in [0, \infty)
$$
for some $c \in \mathbb{R}$, we have that
$$
c \int\limits_{0}^{\infty} e^{F(x)} \, f(x) \, \mathrm{d}x < \infty
$$
is possible only if $c = 0$.
