Prove that $f(x) \leq K \cdot\exp(L\cdot \int_a^x g(t)dt)$ Suppose that $f, g$ are non negative continuous functions in $[a, b]$, and $K, L$ positives constants such that
$$
f(x) \leq K + L \int_a^x f(t)g(t) dt,\quad \forall x \in [a, b] .
$$
Prove that
$$
f(x) \leq K\exp\left(L\int_a^x g(t)dt\right).
$$
I tried to use the continous proprierty by applying the first inequality for $x = a$
For $x = a,$
$$
f(a) \leq K \implies \exists I \subset [a, b]\ \text{such that}\  f(x) \leq 2K\ \forall x\in I
$$
However I couldn't go much further.
 A: It is Gronwall's inequality, but I will give you a proof for your version:
Define $$h(x)=\int_{a}^{x}f(t)g(t)dt$$, then take derivative of it w.r.t. $x$ and by the assumption given:
$$h'(x)=f(x)g(x)-f(a)g(a)\leq(K+Lh(x))g(x)-f(a)g(a)$$
$$\frac{h'(x)+f(a)g(a)}{K+Lh(x)}\leq g(x)$$
Then integrate w.r.t. $t$ from $a$ to $x$ and note that $h(a)=0$,
then $$RHS=\int_{a}^{x}g(t)dt$$
and $$LHS=\int_{h(a)}^{h(x)}\frac{h'(t)}{K+Lh(t)}dh=\frac{1}{L}\big(\ln|K+Lh(x)|-\ln|K+Lh(a)|\big)=\frac{1}{L}\ln\big|\frac{K+Lh(x)}{K}\big|$$
Take exponents on both sides, then multiply $K$ on both sides, and by assumption,
$$f(x)\leq K+Lh(x)\leq K\exp\big(L\int_{a}^{x}g(t)dt\big)$$
Done.
A: This is a particular case of Gronwall's inequality:

Let $\alpha$ and $\beta\geq0$ be  differentiable and continuous functions on $I:=[a,\infty)$ respectively. If $x$ is a function on $I$ such that
$$\begin{align}
    x(t)\leq \alpha(t) + \int^t_a\beta(s) x(s)\,ds\tag{1}\label{gr-cond}
    \end{align}$$
then
$$
  x(t)\leq \alpha(t) + \int^t_a \alpha(s)\beta(s)\exp\Big(\int^t_s\beta(r)\,dr\Big)\,ds
$$
If in addition $\alpha$ is nondecreasing then,
$$
  x(t)\leq\alpha(t)\exp\Big(\int^t_a\beta(s)\,ds\Big)
$$

Set $h(t)$ to be the right hand side of~\eqref{gr-cond}. By the fundamental theorem of Calculus
$$
\dot{h}(t)=\dot{\alpha}(t) + \beta(t)x(t)\leq\dot{\alpha}(t)+\beta(t)h(t).
$$
That is,
$$ \begin{align}
\dot{h}(t)-\beta(t)h(t) \leq \dot{\alpha}(t)\tag{2}\label{two}
\end{align} $$
As in solving linear differential equations of first order, we may multiply both sides of $\eqref{two}$ By the integrating factor
$$\exp\Big(-\int^t_a\beta(r)\,dr\Big)$$
to obtain
$$
\left(\exp\Big(-\int^t_a\beta(r)\,dr\Big)h(t)\right)' \leq \dot{\alpha}(t)\exp\Big(-\int^t_a\beta(r)\,dr\Big)
$$
Integrating over $[a,t]$  gives
$$
\begin{align}
  \exp\Big(-\int^t_a \beta(r)\,ddr\Big)\,h(t)&\leq \alpha(a)+ \int^t_a\dot{\alpha}(s)\exp\Big(-\int^s_a\beta(r)\,dr\Big)\,ds
\end{align}
$$
Solving for $h$ gives
$$
\begin{align}
  h(t)&\leq \alpha(a)\exp\Big(\int^t_a\beta(r)\,dr\Big)+ \int^t_a\dot{\alpha}(s)\exp\Big(\int^t_s\beta(r)\,dr\Big)\,ds\tag{4}\label{gr-pre-by-parts}
\end{align}
$$
Applying integration by parts to the second integral on the right-hand side leads to
$$
x(t)\leq h(t)\leq \alpha(t) + \int^t_a\alpha(s)\exp\Big(\int^t_s\beta(r)\,dr\Big)\,ds.
$$
If $\alpha$ is non-decreasing, then $\dot{\alpha}\geq0$,  and since $\beta\geq0$, \eqref{gr-pre-by-parts} reduces to
$$
\begin{align}
  x(t)\leq h(t)&\leq  \alpha(a)\exp\Big(\int^t_a\beta(r)\,dr\Big)+ \int^t_a\dot{\alpha}(s)\exp\Big(\int^t_a\beta(r)\,dr\Big)\,ds\\
&= \alpha(a)\exp\Big(\int^t_a\beta(r)\,dr\Big)+ \exp\Big(\int^t_a\beta(r)\,dr\Big)\Big(\alpha(t)-\alpha(a)\Big)\\
  &\leq \alpha(t) \exp\Big(\int^t_a\beta(r)\,dr\Big)
\end{align}
$$

In your case, $\alpha(t)\equiv K$ and $\beta(t)=L g(t)$
A: Start with the more general equation
\begin{align}
    x(t)&\leq \alpha(t) + \int^t_a\beta(s) x(s)\,ds
\end{align}
Define $B(t)=\int_a^t\beta(s)\,ds$. Then
\begin{align}
\frac{d}{ds}\left[
   e^{-B(s)}\int^s_a\beta(r)x(r)\,dr
\right]
&= -\beta(s)e^{-B(s)}\int^s_a\beta(r)x(r)\,dr
   + e^{-B(s)}\beta(s)x(s)
\\
&= \beta(s)e^{-B(s)} \left[
   x(s)-\int^s_a\beta(r)x(r)\,dr
  \right]
\\
&\le α(s)\beta(s)e^{-B(s)} 
\end{align}
Now integrate from $a$ to $t$ and insert into the given differential inequality
\begin{align}
e^{-B(t)}\int^t_a\beta(s)x(s)\,ds&\le \int^t_a α(s)\beta(s)e^{-B(s)} \,ds
\\[.8em]
x(t)&\le α(t)+e^{B(t)}\int^t_a α(s)\beta(s)e^{-B(s)} \,ds
\\&= α(a)e^{B(t)}+\int^t_a \dot α(s)e^{-B(s)} \,ds
\end{align}
The last only applies if $α$ is differentiable. If $α$ is constant, the last term is zero, and the remaining first term gives the claim.
