Find a mistake in the following bogus proof

The problem is that $$ \sin(\pi/2 +x) = \sin(x) $$ does not imply that $$ x+\pi/2 = x. $$ This would only be true if $\sin$ was one-to-one on the interval considered.


Theorem. Any continuous and periodic function $f:\mathbb{R}\to \mathbb{R}$ achieve their maximum and minimun values infinitely many times.

Proof. Assume that the period is $T>0.$ Now we consider $f:[0,T]\to \mathbb{R}$ the restriction of $f$ to $[0,T].$ Because of Weirstrass theorem (see https://en.wikipedia.org/wiki/Extreme_value_theorem) there exist $c,d\in [0,T]$ such that $f(c)\le f(x)\le f(d),\forall x\in [0,T].$

Now, since $f$ is periodic we have that $f(c)\le f(x)\le f(d),\forall x\in \mathbb{R}.$ Moreover, note that $f(c+kT)=f(c),\forall k\in\mathbb{Z}$ and $f(d+kT)=f(d),\forall k\in\mathbb{Z}.$ QED.

Note $f(x) = \cos(x)+\sin(x)$ satisfies the hypothesis of the above theorem. So it satisfies the thesis.

The problem in your proof is that $\sin$ is not injective. So, from $\sin x=\sin y$ you can't conclude $x=y.$ Note that $\sin 0=\sin\pi=0$ and $0\ne \pi.$


The equation $\sin(x+\pi/2)=\sin(x)$ has solutions $\pi/4$ and $5\pi/4$ in the interval $[0,2\pi]$. More generally, it has solutions $\pi(n-7/4)$, $n\in\mathbb Z$.

From that equality you want to conclude that $x+\pi/2=x$, which has no solution.