can local maximums and minimums be on endpoints? My textbook has these passages written and I'm a bit confused as to whether local maximums and minimums can be on endpoints. why or why not?

Apparently x=4 is not a local maximum. But why?
Other passages:

 A: 
can local maximums and minimums be on endpoints?

Not according to the definition in your second scanned image.

Apparently $x=4$ is not a local maximum. But why?

Short answer: because the "near $c$" language in the definition means "near $c$" on both sides of $c$.
Longer answer: According to the definition in the red box of your second scanned image, 

the number $f(c)$ is a local maximum value of $f$ if $f(c) \geq f(x)$ when $x$ is near $c$

where "near $c$" means

on some open interval containing $c$.

However, for the function $f$ whose graph is plotted in Figure 7, every open interval containing $4$ will contain some values $x > 4$, for which $f(x)$ is not defined. (The domain of $f$ was given to be the closed interval $[-1, 4]$.)  So, it's not possible to have $f(4) \geq f(x)$ for every $x$ in some open interval containing $4$. 
The discussion above addresses the definition of local maximum, but the definition for local minimum is analogous and has the same issue.
A: When you look for optima of a function on a bounded interval (as opposed to the entire space), the optimum point can come from


*

*Local extrema inside the boundary

*Boundary itself.


A good example is $f(x) = x^2$ on $I=[-1,2]$ which has a unique minimum on $\mathbb{R}$, which happens to fall inside $I$, but for the maximum, the situation is more tricky. $f$ has no local maximum over $\mathbb{R}$ but the boundary is limited to $2$ points $(-1,1)$ and $(2,4)$, both of which are candidates for the optimum and indeed it occurs at $(2,4)$.
