# Some basic questions about minima of a real-valued functions

The following theorem is basically from the Fermat's Theorem page of wikipedia.

Let $X$ denote a subset of $\mathbb{R}$, and suppose $f : X \rightarrow \mathbb{R}$ attains a global minimum at $x \in X$. Then either $x$ is a boundary point of $X$, or $x$ is a non-differentiable point of $f$, or $f'(x)=0.$

A couple of questions.

Q1. If we replace the word "global" with "local," is the new statement valid?

Q2. How far can we generalize the domain of $f$ such that the theorem (or something very much like it) holds? To arbitrary Banach spaces? Arbitrary topological vector spaces?

1) Yes. Suppose $x\in X$ is a local minimum and is not a boundary point and $f$ is differentiable at $x$. If $f'(x)>0$, then for sufficiently small $\epsilon>0$ we have $\frac{f(x-\epsilon)-f(x)}{-\epsilon}>0$ thus $f(x-\epsilon)<f(x)$ so $x$ is not a local minimum, a contradiction. The argument for $f'(x)<0$ is similar. Thus we must have $f'(x)=0$.
2) This holds for at least arbitrary Banach spaces $B$ as well. Suppose $x\in X$ is as in part 1. If $f'(x)\ne 0$, then we have some $v\in B$ such that $f'(x)(v)\ne 0$, and by possibly replacing $v$ with $-v$ we can assume $f'(x)(v)<0$. Recall that $f(x+\epsilon v)=f(x)+\epsilon f'(x)(v)+O(\epsilon^2)$ and thus for sufficiently small $\epsilon>0$ we have $f(x+\epsilon v)<f(x)$ so $x$ is not a local minimum, a contradiction.