Find all continuous function satisfying $\int_0^xf(x)=(f(x))^2$ Find all continuous function satisfying $\int_0^xf(t)dt=(f(x))^2$. 
$f(x)$ is differentiable at $f(x) \not=0$ since $\sqrt{(f(x)^2}$ is differentiable at $f(x)^2 \not=0$ by the chain rule. 
Then, $f(x) = 2 f(x) f^\prime(x)$ by FTC. And, since $f(x) \not = 0, f^\prime(x) = 1/2$.  Then, $f(x) = x/2 + c$ for some constant $c$.  
Let $x = 0$. Then, we have $f(0) = c$. Sub $f(0)$ into the equation in the question. We have $0 = (c)^2$. Therefore, $c = 0$ (i.e. $f(x) = x/2)$. 
But, I don't understand the following solution:  
$$f(x) = 
     \begin{cases}
       \frac {x-a}{2} &\quad\text{if} \hspace{0.2cm} x<a\\
       0 &\quad\text{if} \hspace{0.2cm} a\le x \le b \\
       \frac{x-b}{2} &\quad\text{if} \hspace{0.2cm} x>b\\
     \end{cases}$$
where $a \le 0$ and $b \ge 0$ are two real numbers. 
I found one explanation regarding this solution. But, I have difficulty in understanding some terminology like maximal interval in the explanation. So, could you explain why should we consider the interval, and how can we derive this solution?  
Thank you in advance. 
 A: As $f$ is continuous, the Fundamental Theorem of Calculus tells us that $F(x):=\int_0^xf(t)\,\mathrm dt$ is differenttiable and that $$F'(x)=f(x).$$
Assume that for some $x$, we have $f(x)\ne 0$.
Then from $F(x)=f(x)^2$, we get
$$\begin{align}\lim_{h\to0}\frac{f(x+h)-f(x)}h&=\lim_{h\to 0}\frac{f(x+h)^2-f(x)^2}{h(f(x)+f(x+h))}\\&= \lim_{h\to 0}\frac{F(x+h)-F(x)}{h(f(x)+f(x+h))}\\&=\frac{\lim_{h\to 0}\frac{F(x+h)-F(x)}{h}}{f(x)+\lim_{h\to 0} f(x+h)}\\&=\frac{F'(x)}{2f(x)}\\&=\frac{f(x)}{2f(x)}\\&=\frac12,\end{align}$$
i.e., $f$ is differentiable with $f'(x)=\frac12$ wherever $f(x)\ne 0$.
Note that we cannot make a statement about the differentiability of $f$ at points where $f(x)=0$!
I made the limit calculation above explicite to show where $f(x)\ne 0$ enters the argument. 
You can do the same with the chain rule $$\frac{\mathrm d}{\mathrm dx}f(x)= \frac{\mathrm d}{\mathrm dx}\sqrt{F(x)}=\frac{F'(x)}{2\sqrt{F(x)}}=\frac{f(x)}{2f(x)}=\frac12$$
which is also applicable only where $\sqrt{\cdot}$ is differentiable, i.e., only when $F(x)>0$.
Assume there exists $x_0$ with $f(x_0)>0$. Let $u=\sup\{\,x<x_0\mid f(x)\le 0\,\}$ amd $v=\inf\{\,x>x_0\mid f(x)\le 0\,\}$ (with the possibility that $u=-\infty$ and/or $v=+\infty$). Then $f$ is differentiable with $f'(x)=\frac12$ on the open interval $(u,v)$ and we conclude that $f(x)=f(x_0)+\frac{x-x_0}2$ there. 
If $u=-\infty$, we find that $f(x_0-2f(x_0))=0$, contradicting the definition of $u$. Hence $u\in\Bbb R$ and by continuity we have both $f(u)=f(x_0)-\frac{u-x_0}2$ and $f(u)=0$. We conclude that $u=x_0-2f(x_0)$.
If $v<\infty$, we similarly obtain $0=f(v)=f(x_0)+\frac{v-x_0}2$, hence $v=x_0-2f(x_0)<x_0$, which is absurd. We conclude $v=\infty$.
Thus

If $f(x_0)>0$ for some $x_0$, then $f(x)=\frac{x-b}2$ for all $x\ge b$ with $b:=x_0-2f(x_0)$.

By a symmetric argument

If $f(x_0)<0$ for some $x_0$, then $f(x)=\frac{x-a}2$ for all $x\le a$ with $a:=x_0-2f(x_0)$.

Clearly, if both signs occur as values, we must have $a\le b$ in the above.
Depending on whether or not $f$ assumes positive and/or negative values, we obtain the following complete lst of solutions:
$$ f(x)=0$$
$$ f(x)=\begin{cases}\frac{x-b}2,&x\ge b\\0,&x\le b\end{cases}\qquad\text{for some }b\in\Bbb R$$
$$ f(x)=\begin{cases}\frac{x-a}2,&x\le a\\0,&x\ge a\end{cases}\qquad\text{for some }a\in\Bbb R$$
$$ f(x)=\begin{cases}\frac{x-a}2,&x\le a\\0,&a\le x\le b\\
\frac{x-b}2,&x\ge b
\end{cases}\qquad\text{for some }a,b\in\Bbb R\text{ with }a\le b$$
We can summarize the first three cases under the last if we allow $a=-\infty$ and/or $b=+\infty$.
