Find all continuous functions satisfying $\int_0^xf=(f(x))^2+C$ for some constant $C \neq 0$. Find all continuous functions $f$ satisfying 
$$\int_0^xf=(f(x))^2+C$$ for some constant $C \neq 0$, assuming that $f$ has at most one $0$.
I have a question about the solution to this problem. It says that 
Clearly $f^2$ is differentiable everywhere, its derivative at $x$ is $f(x)$ (I'm assuming that this is because the left hand side is differentiable, the right hand side must be differentiable as well). So $f$ is differentiable at $x$ whenever $f(x) \neq 0$, and 
$$f(x)=2f(x)f'(x),$$
so $f'(x) = \frac{1}{2}$ at such points. Thus, $f= \frac{1}{2}x+b$ for some $b$ on any interval where it is non-zero; if $f$ has a zero, this gives two possible solutions, with two possible values of $b$, but since $f$ is assumed continuous, they must be the same. So we need $$\int_0^x(\frac{1}{2}t+b)dt=(\frac{1}{2}x+b)^2+C$$ 
so we must have $b=\sqrt{-C}$ or $-\sqrt{-C}$, leading to two solutions for $C \lt 0$.
I don't understand the bolded statements. First, how does the differentiability of $f^2$ guarantee that $f$ is differentiable, and why only at $x$ where $f(x) \neq 0$?
Next, why are there two possible solutions if $f$ has a zero, but since $f$ is continuous they must be the same?
Finally, does the last statement mean that if $C \gt 0$, then there is no solution, since we're restricted to real numbers here?
I would appreciate it if anyone answers my questions.
 A: [EDIT: my previous answer was incomplete. This was updated to derive rigorously the full set of solutions]
1) Assume $f(x)\not=0$. Then $f^2$ differentiable at $x$ implies $(f^2(x+h)-f^2(x))/h$ has a finite limit as $h\to 0$, equivalently ${f(x+h)-f(x)\over h} (f(x+h)+f(x))\to c$. Since $f(x)\not = 0$, $f(x+h)+f(x)\to 2f(x)=k\not =0$ hence $f$ is differentiable at $x$.
2) Now, as in the text, this implies $f(x) = {1\over 2} x +b$ in every interval where $f(x)\not=0$. In other words, the graph of $f$ is a straight line segment parallel to $y=1/2 x$ in every such interval.
There are 3 types of intervals to be considered: maximal intervals $S_-=(u,v)$ in which $f(x)<0$ (hence $f(v)=0$ if $v<+\infty$), maximal intervals $S_0=[u,v]$ in which $f(x)=0$, and maximal intervals $S_+=(u,v)$ in which $f(x)>0$ (hence $f(u)=0$ if $u>-\infty$). Such maximal intervals exist because $f$ is continuous. It has just been shown that that in every interval of the first and third form, the graph of $f$ is a straight segment parallel to $x/2$. Since $f$ is continuous, the end points of two contiguous such  segments must be the same (this is what the text expresses as "the two possible solutions at these points must be the same"). By maximality of the intervals, there may exists at most one interval $S_-$, $S_0$ and $S_+$ of each type: $$S_- = (-\infty, \alpha),\quad S_0 = [\alpha, \beta],\quad {\rm and}\quad  S_+= (\beta, +\infty).$$    
Observe that setting $x=0$ in the proposed equation leads to $0=f(0)^2+C$, hence $C$ must be $\leq 0$ (otherwise there is no solution), and $f(0) = \pm \sqrt{-C}$.
Now, if $C< 0$, $f(0)=\pm\sqrt{-C}$, hence $x=0$ is inside $S_+$ or $S_-$ according to the sign of $f(0)$, and there holds $a.0+b=f(0)=\pm\sqrt{-C}$, hence $b=\pm \sqrt{C}$.
In both cases, the line $x/2+b$ intersects the axis $y=0$ at $x=-2b$. 
In conclusion, if $b=\sqrt{-C}\ (>0)$, the general solution must be of this form, for some $\alpha\leq -2b$:
$$
f(x)=\cases{
x/2 - \alpha/2 , & $x\in (-\infty, -\alpha) $,\cr
0, & $x\in [\alpha,-2b]$, \cr
x/2 + b, & $x\in (-2b, +\infty)$.\cr
}
$$
If $b = -\sqrt{C}\ (<0)$, the general solution must be of this form, for some  $\beta \geq -2b$:
$$
f(x)=\cases{
x/2 + b, & $x\in (-\infty, -2b) $,\cr
0, & $x\in [-2b, \beta]$, \cr
x/2 - \beta/2 , & $x\in (\beta, +\infty)$.\cr
}
$$
(notice that in these solutions, $\alpha$ and $\beta$ may be equal to $-\infty$ or $+\infty$ resp.).
Conversely, it is easily seen that the above functions are solution of the proposed equation. So, we have found the general form of the solution of this equation whenever $C<0$.
If $C=0$, $x=0$ is in $S_0$ hence the general solution must be of the following form, with $\alpha\leq 0$ and $\beta\geq 0$: 
$$
f(x)=\cases{
x/2 - \alpha/2 , & $x\in (-\infty, \alpha) $,\cr
0, & $x\in [\alpha,\beta]$, \cr
x/2 - \beta/2, & $x\in (\beta, +\infty)$.\cr
}
$$
(again,  $\alpha$ may be equal to $-\infty$ and $\beta$ to $+\infty$).
Conversely, such a function is easily seen to be a solution of the equation for every $\alpha\leq 0$ and $\beta\geq 0$.
A: putting $x = 0,$ gives $C = -f^2(0)$  differentiating gives you $f = 2ff'$ which has solution $f = 0$ which implies $C = 0$ or $f = \frac{x}{2} + f(0).$  
$\int_0^x(f(0) + t/2) \, dt = xf(0) + \frac{x^2}{4}$  and $f^2(x) + C = \frac{x^2}{4} + xf(0) + f^2(0) - f^2(0) = xf(0) + \frac{x^2}{4}$ it verifies that 
$$f(x) = \frac{x}{2} + f(0), f(0) \neq 0, C = -f^2(0).$$
