Q:

Show that a differentiable function $f:\mathbb{R} \to \mathbb{R}$ has a global max in $a$ if $a$ is its local max

My task is this:
Let $f:\mathbb{R} \to \mathbb{R}$ be a differentiable function and assume that the only stationary point $f$ has is a local max in the point $A = (a,f(a))$.
Show that $A$ must be a global max for $f$.
My work so far:
Since $f$ is differentiable we have that $\ f'(a) = 0$. Since $A$ is the only stationary point and local max for $f$, we get:
$$\forall x < a \implies f'(x) > 0 \ \land \forall y > a \implies f'(y) < 0.$$
It then follows that: 
$$f(x),\ f(y) < f(a).$$
Which is what we wanted to show.
Is this good enough? Need someone to verify since there are no answers to this in the book I'm using (Multivariate calculus w/linalg by Tom Lindstrøm).

A:

If $f$ is constant on a small neighborhood of $a$, then $f$ has infinitely many critical points. Hence, recalling that $A$ is a local maximum point, there exists $\delta>0$ such that
$$
f(a-\delta) < f(a), \quad f(a)> f(a+\delta).
$$
Assume that there exists a point $b$ such that $f(b)>f(a)$. Without loss of generality, we may suppose that $b>a+\delta>a$. Then $\min_{a \leq x \leq b} f(x)$ is attained inside $(a,b)$, and by Fermat's theorem there exists anohter critical point. This is a contradiction.

