When does $\int_{0}^{2a} f(x) dx$ equal to $2 \int_{0}^{a} f(x) dx$? Under what condition(s) does the following equation hold for any $a$?
$$\tag{1} \int_{0}^{2a}f(x) dx = 2 \int_{0}^{a}f(x) dx$$

My attempt was only by guess-work:
For any function $f$ that is defined at $x=0$, setting $a=0$, equation $(1)$ automatically holds.
In other words,
$$\tag{2} \int_{0}^{0}f(x) dx = 2 \int_{0}^{0} f(x) dx$$

Another guess-work:
For $f(x)=c$, where $c$ is a constant, we have
$$\int_{0}^{2a}c dx=cx|_{0}^{2a}=c(2a-0)=2ac, \text{and } 2 \int_{0}^{a}c dx = 2cx|_{0}^{a}=2c(a-0)=2ac$$
In other words,
$$\tag{3} \int_{0}^{2a}f(x) dx = 2 \int_{0}^{a}f(x) dx \text{ when } f \text{ is a constant function}$$

However, $(2)$ does not answer the question because it does not hold for any $a$.
Is $(3)$ the only case?

Your help would be appreciated. THANKS!
 A: If $f$ is assumed to be continuous then we can differentiate the equation w.r.t. $a$ to get $f(2a)=f(a)$.  Iteration of this gives $f(a)=f(a/2^{n})$ for all  $n$ so we can let $n \to \infty$ and conclude that $f(a)=f(0)$ for all $a$.
A: Try $f(x) = F(\ln|x|)$ where $F(t)$ is periodic with period $\ln 2$ on $(-\infty, \infty)$, for example:
$$
f(x) = \sin\left(2\pi\frac{\ln|x|}{\ln 2}\right).
$$
With $f(0)$ defined to be whatever you like.  This function will satisfy $f(2a) = f(a)$.  Any nonconstant $f$ of this form will necessarily be discontinuous at zero.
A: Let $f(x)=g'(x)$ then $\int_0^{a}f(x)dx=g(a)-g(0)$ and so we have $g(2a)=2g(a)$ for all $a$. The only function which satisfies this for any value of $a$ is $g(x)=\alpha x$, so $f(x)=g'(x)=\alpha$, in other words $f$ must be a constant function.
A: Other answers have shown that a continuous solution must be constant. Here's an example to show that without the requirement of continuity, a non-constant solution is possible.
$
f(x) = 
\begin{cases}
x & \text{if $ x\in \mathbb{Q}$ } \\
0 & \text{otherwise}
\end{cases}
$
Since $\mathbb{Q}$ has measure $0$, all of the integrals are $0$ and the condition trivially applies yet $f$ is not constant.
