<s>[INST] Calculus Spivak Chapter 14 problem 7; f such that $\int_{1}^{x} f=f^2(x)+C$ i´m having trouble understanding why is $f'(x)=0$ in the solution of this problem of Calculus by Spivak.
find a continuous fuction f such that:
$\int_{0}^{x} f=f^2(x)+C$
Here´s the solution that i´m talking about:
Clearly $f^2$ is differentiable everywhere. So $f$ is differentiable at x whenever $f(x)\neq 0$ and:
$f(x)=2f(x)f'(x)$.
So $f'(x)=0$ at such points.Thus $f(x)$ is constant on any interval where it is non-zero. So $f(x)=0$
Can someone help understand this?
Note: I found this solution at the Answer book for calculus Third edition, I guess it is a mistake or something.
 [/INST] The question is pretty old but I'll just leave the actual answer to the question if anyone looks for it, since it's pretty cool and it's a shame the answer book made the mistake.
First notice that, by the Fundamental Theorem of Calculus, the condition is equivalent to
$$(f^2)' = f,$$
so that we'll just deal with that and find all continuous functions which satisfy this.
First, as in the answer, if $f(x)\neq 0 $ then, by continuity,
\begin{align}
f'(x) &= \lim_{h\to0} \frac{f(x+h)-f(x)}{h}\\
&= \lim_{h\to0} \frac{f^2(x+h)-f^2(x)}{h} \cdot \frac{1}{f(x+h)+f(x)}\\
&= (f^2)'(x)\cdot \frac{1}{2f(x)} = \frac{1}{2}.
\end{align}
Therefore, if $f(x) \neq 0$ for all $x$ in an interval $I$, then there is a number $c$ such that $f(x) = \frac{1}{2} x + c$ for all $x$ in $I$. We'll use this fact multiple times.
First, a trivial solution is $f = 0$, so we'll look for others.
Suppose $f(x_0) > 0$ for some $x_0$. The first step is to show that $f(x) > 0$ for all $x$ in $[x_0, \infty)$: If we had $f(x) = 0$ for some $x > x_0$, we could let $x_1$ be the smallest number $> x_0$ which satisfies $f(x_1)=0$, so that $f(x)>0$ for $x$ in $[x_0, x_1)$. (Note that we are using continuity here.)
This implies that there is a number $c$ such that $f(x) = \frac{1}{2} x + c$ for all $x$ in $[x_0, x_1)$. But then
$$f(x_1) = \lim_{x \to x_1^+} f(x) = \frac{1}{2} x_1 + c > 0,$$
a contradiction. Therefore $f(x) > 0$ for all $x$ in $(x_0, \infty)$. This means that we can find a number $c$ such that $f(x) = \frac{1}{2} x + c$ for all $x > x_1$.
Next step is to show that $f(x) = \frac{1}{2}x + c$ for all $x$ in $[-2c, \infty)$. First, note that we must have $f(x) = 0$ for some $x$ in $[-2c, x_0]$: If we had $f(x) > 0$ for all $x$ in $[-2c, x_0]$, there'd be a number $\bar{c}$ such that $f(x) = \frac{1}{2} x + \bar{c}$ for all $x$ in $[-2c, x_0]$. But $f(x_0) = \frac{1}{2} x_0 + c$, so we must have $c = \bar{c}$. However, this means $f(-2c) = \frac{1}{2} (-2c) + c = 0$, a contradiction. We conclude that there is some $x$ in $[-2c, x_0]$ such that $f(x) = 0$; let $x1$ be the largest one. Then $f(x) > 0$ for all $x$ in $(x_1, x_0]$, so, as before, $f(x) = \frac{1}{2} x + c$ for all $x$ in $(x1, x0]$. But then
$$0 = f(x_1) = \lim_{x \to x_1^+} f(x) = \frac{1}{2} x_1 + c,$$
so $x_1 = -2c$.
In conclusion: If $f(x) > 0$ for some $x$, then there is a number $c$ such that $f(x) = \frac{1}{2} x + c$ for all $x$ in $[-2c, \infty)$.
A similar analysis shows that if $f(x) < 0$ for some $x$ then there is a number $c$ such that $f(x) = \frac{1}{2} x + c$ for all $x$ in $(-\infty, -2c]$.
Note: If there are numbers $c_1, c_2$ with $f(x) = \frac{1}{2} x + c_1$ for $x \in (-\infty, -2c_1]$ and $f(x) = \frac{1}{2} x + c_2$ for $x \in [-2c_2, \infty)$, we must have $-2c_1 \leq -2c_2$. Otherwise, we'd have $-2c_1 \in (-2c_2, \infty)$, so $0 = f(-2c_1) = \frac{1}{2} (-2c_1) + c_2 = c_2 - c_1 \neq 0$, which is false.
Finally, we can list all solutions.

*

*$f = 0$.

*$f(x) = 
\begin{cases}
\frac{1}{2} x + c, & x \geq -2c\\
0, & \text{otherwise}
\end{cases}$, where $c$ is any number.

*$f(x) = 
\begin{cases}
\frac{1}{2} x + c, & x \leq -2c\\
0, & \text{otherwise}
\end{cases}$, where $c$ is any number.

*$f(x) = 
\begin{cases}
\frac{1}{2} x + c_1, & x \leq -2c_1\\
0, & -2c_1 < x < -2c_2\\
\frac{1}{2} x + c_2, & x \geq -2c_2\\
\end{cases}$, where $c_1$ and $c_2$ are any numbers with $-2c_1 \leq -2c_2$.

</s>