# Theorem 5.8 in Baby Rudin: Does the function have to be defined at the endpoints as well?

Here is Theorem 5.8 in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition:

Let $f$ be defined on $[a, b]$; if $f$ has a local maximum at a point $x \in (a, b)$, and if $f^\prime(x)$ exists, then $f^\prime(x)=0$.

The analogous statement for local minima is of course also true.

And, here is Rudin's proof:

Choose $\delta$ in accordance with Definition 5.7, so that $$a < x-\delta < x < x+\delta < b.$$ If $x-\delta < t < x$, then $$\frac{ f(t)-f(x)}{t-x} \geq 0.$$ Letting $t \to x$, we see that $f^\prime(x) \geq 0$.

If $x < t < x+\delta$, then $$\frac{ f(t) - f(x) }{ t-x} \leq 0,$$ which shows that $f^\prime(x) \leq 0$. Hence $f^\prime(x) = 0$.

And, here is Definition 5.7 in Baby Rudin:

Let $f$ be a real function defined on a metric space $X$. We say that $f$ has a local maximum at a point $p \in X$ if there exists $\delta > 0$ such that $f(q) \leq f(p)$ for all $q \in X$ with $d(p, q) < \delta$.

Local minima are defined likewise.

Now my question is, in Theorem 5.8, do we have to assume that the function $f$ is defined at the endpoints $a$ and $b$ as well? Or, is it sufficient for $f$ to be defined only in the segment $(a, b)$?

• I could be wrong but I don't see where it's used the fact that $f$ is defined in $a$ and $b$ ($f:[a,b]\to\Bbb R$), thus I don't think that it is useful: in fact here we are talking about local maximum, inside the interval of definition – Giulio Apr 25 '17 at 18:40
• If $f$ is only defined on $(a,b)$, we can extend it to $[a,b]$ by defining $f(a) = f(b) = 0$. This doesn't affect whether $f'$ exists at any local maximum in $(a,b)$. – Matthew Leingang Apr 25 '17 at 18:43

No, you don't have to assume that $f$ is defined and behaves nicely at $a$ and $b$. What is proven here is the following:
If $f:\>\Omega\to{\mathbb R}$ is differentiable on the open set $\Omega\subset{\mathbb R}$, and if $f$ has a local maximum at the point $x\in\Omega$, then $f'(x)=0$.