Gronwall's Lemma intuition Ive recently had this real analysis exercise which is apparently a special case of Gronwall's lemma. The exercise is to show that if $f,g:[a,b]\to[0,+\infty[$ are continuous functions and $\exists\alpha \geq 0$ such that $\forall x\in [a,b]$, $f(x)\leq \alpha + \int_{a}^{x}f(t)g(t)dt$, then we have that $\forall x\in [a,b]$, $f(x)\leq \alpha e^{\int_{a}^{x}g(t)dt}$. From this we easily conclude that if $f$ is bounded by its mobile bound integral then it is identically 0.
My issue with this exercise is that after having given a good crack at it for some time and going nowhere, I looked at the solution and I cannot find a motivation for this solution., though I suspect it exists. The solution looks at the functions $u(x)=\int_a^x f(t)g(t)dt$, $v(x)=u(x)e^{-\int_a^x g(t) dt}$ and their derivatives to get the inequality via a few simple bounds. I can follow this solution easily and I can see why one would look at auxiliary functions and their derivatives, especially $u$, but I cannot justify the choice of $v$.
I suspect some kind of intuition for this might come from a differential equation considering the similarity to linear integrating factors but I haven't managed to find a good connection.
I would really appreciate it if someone had some sort of intuition for this: I'm not looking necessarily for something formal but rather for something rough that motivates why one might think about these particular functions. I don't like coming off of a problem feeling I haven't learned much and this is how I'm feeling after this problem, so please illuminate me.
 A: Here is how I first approached it. We have $f(a) \leq \alpha$. Thus in order to bound $f$, we need a bound on $f'$, because then we can just integrate the bound on $f'$. However, we do not have direct information about $f'$. But since $f(x) \leq u(x) := \alpha + \int_{a}^{x}f(t)g(t)\,dt$, we can try to bound $u(x)$ instead. We have
$$u'(x) = f(x)g(x) \leq u(x)g(x),$$
$$u(a) = \alpha.$$
Now recognizing $\frac{d}{dx}\log(u(x)) = \frac{u'(x)}{u(x)}$, we have a bound on the growth of $u$ that we can integrate from $a$ to $x$. Integrating it gives the Gronwall inequality, provided that $u > 0$ on $[a, b]$. This happens when $\alpha > 0$. To get the inequality for $\alpha = 0$, let $\alpha \searrow 0$.
I'm not sure why the solution used $u$ and $v$. I think to use those you have to know in advance that the bound should hold, using some heuristic method. Their way seems more like they are checking whether their hypothesized bound really holds, rather than a way to come up with the bound. Their method is probably more robust.
