Spivak, Ch. 14, Prob 12d : Prove if $f'$ is periodic with period $a$ and $f$ is periodic (with some period not necessarily $=a$), then $f(a)=f(0)$. In Spivak's Calculus, there is the following problem in Ch. 14 "Fundamental Theorem of Calculus"



*A function $f$ is periodic, with period $a$, if $f(x+a)=f(x)$ for all $x$.

*(d) Prove that if $f'$ is periodic with period $a$ and $f$ is periodic (with some period not necessarily $=a$), then $f(a)=f(0)$.

The solution manual solution (with my filling in some intermediate steps) is as follows

Let $g(x)=f(x+a)-f(x)$.
Then $g'(x)=f'(x+a)-f'(x)=0$, because $f'$ is periodic.
Therefore, $g$ is constant and $g(x)=g(0)$, so
$$f(x+a)-f(x)=f(a)-f(0)$$
$$f(x+a)=f(x)+f(a)-f(0)$$
$$f(na)=f[(n-1)a]+f(a)-f(0)$$
$$=f[(n-2)a+a]+f(a)-f(0)$$
$$=f[(n-2)a]+2f(a)-2f(0)$$
$$=f(0)+nf(a)-nf(0)$$
$$=n(f(a)-f(0))+f(0)$$
Since $f$ must be bounded (since it is periodic), then $f(a)=f(0)$,
otherwise $f$ would be unbounded.

Is there an interesting interpretation for this result?
f apparently can have some period $b\neq a$ which we didn't need to make use of in the proof above. Doesn't the fact that $g$ is constant mean that $f$ has a period of $a$?
$$g(x)=f(x+a)-f(x)=0, \text{ for all } x $$
$$\implies f(x+a)=f(x), \text{ for all }x$$
When I tried to solve this problem I started on the assumption that $f$ had a period $b\neq a$
$$f'(x+a)=f'(x)$$
$$f(x)=\int_0^x f' + f(0)$$
$$f(x+b)=\int_0^{x+b}f’ +f(0)=f(x)$$
But didn't get much further than this.
 A: At no point do we know that $g(x)=0$ for all $x$. We only know that $g'(x)=0$ for all $x$, which means that $f(x+a)-f(x)=c$ for some $c \in \mathbb R$. Notice that if $f$ was just a line, then this property would also hold (and, obviously, unless the line has a slope of $0$, said line is not periodic).
I would note that Spivak's claim relies on the assumption that periodicity implies $f$ is bounded. In general, this is not true (https://math.stackexchange.com/questions/1004426/does-a-periodic-function-have-to-be-bounded#:~:text=This%20function%20is%20defined%20for,R%20since%20it%20is%20periodic).
In order for periodicity to imply boundedness, we also need to know that $f$ is continuous. However, because this problem makes use of $f'$, implicitly, we must have that $f$ is continuous. Therefore, the periodicity assumption of $f$ implies boundedness.
An equivalent result could have been generated by instead stating that $f$ is a bounded function (in addition to the other assumptions about $f'$). In fact, it is not clear to me why Spivak supplied the 'more specific' assumption that $f$ is periodic because, as you have pointed out, no where in the proof do we make use of that fact outside of the boundedness property that comes with periodicity of a continuous function.

Now, to your point about 'does this imply that $f$ has a period of $a$'...yes, it does. Here is why:
Consider the derivative $f'$ on the interval $[0,a]$. Because this function repeats itself for every $n$ interval of the form $[(n-1)a,na]$, it should be clear that in order to correspond to a function $f$ that is bounded, we must have that there is no net growth (or loss) of the function $f$ across each of these intervals.
Suppose that $f'$ carries more positive weight across the $[0,a]$ interval. Then, the function $f$ will have net growth as we jump from $[0,a]$ to $[a,2a], \cdots$. i.e. $f$ would have no upper bound (similarly for if $f'$ carries more negative weight across the $[0,a]$ interval...which would lead to net loss as we jump from $[0,a] \to [a,2a] \to \cdots$ and prevent $f$ from having a lower bound). This is equivalent to stating that our assumptions force us to have $\displaystyle \int_0^a f'=0$.
Now, by the second fundamental theorem of calculus, this implies that $f(a)-f(0)=0 \implies f(a)=f(0)$. Of course, the above logic applies to any interval $[x,x+a]$, which means that $\displaystyle \int_x^{x+a} f'=0 \implies f(x+a)-f(x)=0 \implies f(x+a)=f(x)$
