Find all continuous functions $f$ satisfying $\int\limits_0^x f=(f(x))^2+C$, for some constant $C\neq 0$. Why is the assumption $C\neq 0$ necessary? The following is a problem from Chapter 14 "The Fundamental Theorem of Calculus" from Spivak's Calculus



*(a) Find all continuous functions $f$ satisfying

$$\int\limits_0^x f=(f(x))^2+C, \text{ for some constant } C \neq 0\tag{1}$$
assuming that $f$ has at most one $0$.
(b) Also find a solution that is $0$ on an interval $(-\infty, b]$ with $0<b$, but non-zero for $x>b$
(c) Finally, for $C=0$ and any interval $[a,b]$ with $a<0<b$, find a solution that is $0$ on $[a,b]$, but non-zero elsewhere.

My question is: why the assumption that $C \neq 0$?
The solution to this problem doesn't seem to require that assumption.
Here is my solution to part $(a)$
First, note that
$$\int_0^0 f = 0 = (f(0))^2+C \implies f(0)=\pm \sqrt{-C}$$
Therefore, if $f$ satisfies $(1)$ then $C<0$.
Assume $f$ is continuous. Then we can apply the FTC1 to $(1)$
$$f(x)=2f(x)f'(x)$$
$$f(x)(1-2f'(x))=0\tag{2}$$
By assumption, $f$ is zero at most at one point. Assume $f(x_0)=0$.
Then at all $x\neq x_0$ we have $$f'(x)=\frac{1}{2}\tag{3}$$
But we know that a function of the form $f(x)=\frac{x}{2}+b$ satisfies $(3)$.
Therefore, we can use the FTC2 to obtain
$$\int_0^x \frac{1}{2}=f(x)-f(0)=\frac{x}{2}$$
$$f(x)=\frac{x}{2}+f(0)$$
$$f(x)=\frac{x}{2}\pm \sqrt{-C}=\frac{x}{2}\pm k, k\in\mathbb{R}$$
This represents the set of all lines with slope $1/2$.
If we choose $C=0$ then we have
$$f(x)=\frac{x}{2}$$
$$\int_0^x \frac{x}{2}dx = \frac{x^2}{4}=\left ( \frac{x}{2} \right )^2=(f(x))^2$$
So the question remains: why the assumption that $C\neq 0$?
Here is the solution to part $(b)$
For this item, we are dropping the assumption that $f$ is zero at only one point. As before, we have eq. $(2)$.
If $f(x)=0$ for all $x \in (-\infty,b]$, then for $x>b$ we have $f'(x)=\frac{1}{2}$.
This means that
$$f(x)=\begin{cases} 0, \text{ if } x\leq b \\ \frac{x}{2}+k, \text{ if } x>b, \text{ with } k \in \mathbb{R} \end{cases}$$
Part (c) is similar, but now $f$ is zero on an interval $[a,b]$ with $a<0<b$.
By the same steps as before, we have that $f'(x)=\frac{1}{2}$ for $x \in (-\infty,a) \bigcup (b,\infty)$.
 A: $\newcommand{\d}{\,\mathrm{d}}$TLDR - it is not necessary, but it makes the proof easier as it sidesteps a small technical issue.
From:

$$\int_0^xf(t)\d t=f(x)^2+C$$

You may deduce by the FTC that the left hand side is differentiable, thus so is the right hand side since they are identically equal. The addition of a constant term does not affect differentiability, so we can conclude that $x\mapsto f(x)^2$ is a differentiable function. We cannot further conclude that $f$ is differentiable, in general. Hear me out: you might say, oh, we can compose $f(x)^2$ with one branch of the square root, which is differentiable, and then $f(x)=\sqrt{f(x)^2}$ is differentiable as a composition of differentiable functions. However, the square root is not actually differentiable, strictly speaking, at $0$ (since it is not defined on any topological neighbourhood of $0$).
With that in mind, $C\lt0$ strictly forces that $f(0)\neq0$. By continuity, that means $f$ is nonzero in some neighbourhood of $0$ and therefore that the composite function $\pm\sqrt{f(x)^2}$ is: a) well defined since $f$ will be of constant sign and b) differentiable since we never hit the branch point at $\sqrt{0}$. Then $f$ is differentiable in a neighbourhood of $0$ and your proof works, locally, and easily extends globally.
However, if $C=0$, then $f(0)=0$ and we cannot conclude differentiability of $f(x)$ since: a) it may not have constant sign in any neighbourhood of zero, so $f(x)=\pm\sqrt{f(x)^2}$ is not necessarily continuously defined, and b) $f(0)=0$ allows for $\sqrt{f(x)^2}$ to be zero at least once in all neighbourhoods of $0$, and therefore not differentiable everywhere (necessarily). In this case, $f(x)^2$ is differentiable does not imply $f(x)$ is differentiable, and your proof fails on this technicality. Indeed, your approach doesn't resolve $f(x)=\frac{1}{2}|x|$, which is a solution for $x\ge0$ with $C=0$. This function still doesn't work, as outlined below, but it shows a small difficulty with your reasoning.
However, if $C=0$ then the solution $f(x)=\frac{x}{2}$ is still unique - it is just harder to prove. Note that: $$f(x)^2=\int_0^xf(t)\d t\ge0,\,\forall x$$Implies that $f$ must be always positive on $(0,\infty)$, and always negative on $(-\infty,0)$. Then, although $f$ is maybe not differentiable at $0$, where $f(0)=0$ and $0=x_0$ as treated in your proof, it is differentiable everywhere else since we really can enforce $f(x)=\operatorname{sgn}(x)\cdot\sqrt{f(x)^2}$ which is differentiable on $(-\infty,0)\cup(0,\infty)$. Then you obtain $f(x)=\frac{x}{2}$, using your proof, on this interval, with an obviously forced extension to the whole real line. Spivak gave $C\neq0$, as Aschleper mentions in the comments, probably because it makes the proof easier, without the student needing to worry about fiddly technicalities such as this.
