Find a mistake in the following bogus proof Theorem: The function $f:\mathbb{R} \rightarrow [-10,10]$ defined by $f(x) = \cos(x)+\sin(x)$ for all $x \in \mathbb{R}$ has no maximum or minimum on ($-\infty,+\infty$)
Proof: The function is differentiable on $\mathbb{R}$ so one should be able to find its extrema by setting the derivative to 0. In particular, $$(\sin(x)+\cos(x))' = 0$$
$$\cos(x)-\sin(x) = 0$$
$$\sin(x) = \cos(x)$$
$$\sin(x+\pi/2) = \sin(x)$$
$$x+\pi/2 = x.$$
And the final equation is never true.
Yet WolframAlpha disagrees with my conclusions...
 A: 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.
A: 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.$
A: 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. 
A: Cos (x)=sin (phi/2-x).
So compare both.
You get 2x=phi/2.
x=phi/4.
It has maximum value at phi/4.
Similarly at x=5phi/4 you get minimum.
A: Apart from the one outlined in Thomas's answer, there's another mistake in the proof. Consider a function $f(x) = x$ on $[-10; 10]$. It has $$f^\prime(x) = 1 \neq 0$$ everywhere, but it definitely has its maximum at $x=10$ endpoint and its minimum at $x=-10$ endpoint.
A: The function is continuous and periodic, so by Bolzano Weierstrass it must have a maximum and a minimum.
