TITLE: Condition to guarantee $f=0$ on $[a,b]$
QUESTION [6 upvotes]: I have been stuck for several days on this old Analysis problem (I am doing some study on my own).  I have tried several things (which I'll indicate below), but I cannot seem to figure it out.  Here is how the problem is presented:
Problem: "Let $f$ be a continuous real-valued function on $[a,b]$.  Suppose there exists a constant $M \geq 0 $ such that
$$|f(x)| \leq M \int_a^x |f(t)| dt$$
for all $x \in [a,b]$.  Show that $f(x)=0$ for all $x \in [a,b]$."
My Thoughts:
I have tried using the mean value theorem iteratively, but that seems to always lead me down a dead end road.  I deduced that $f(a)=0$.  If only $f$ were assumed to be differentiable, then maybe I could play with trying to get the derivative to be $0$, but unfortunately it's only continuous.  My other thought was to (somehow) use the condition to show that $\int_a^b |f(x)| dx = 0$.  I also played around a bit with contradiction, but to no avail.  Even if one of these hair-brained thoughts is correct, I am not really sure what to do next.
If you have any ideas, suggestions, or solutions, I would really appreciate it if you are willing to share them.  Thank you for your time.

REPLY [3 votes]: This is a special case of Grönwall's inequality, an essential tool for any analyst.  See the "Integral form for continuous functions" section at the above Wikipedia link, and apply it with $\alpha(t) = 0$ and $\beta(t) = M$.  You conclude $f(x) \le 0$ everywhere.  Then apply it again to $-f$.
The Wikipedia page also gives the proof, which is pretty much the "integrating factor" argument given by Martin R's answer.