Local maximum of a polynomial in a connected subspace of $\mathbb{R}^n$ Let $X\subset \mathbb{R}^n$ be bounded and connected and let $f:X\to\mathbb{R}$ be a polynomial function. Let $x\in X$ be a point and $m\in X$ be the nearest global maximum to $x$.
Suppose in every neighborhood of $x$ there exists a point $y$ and a path $p_t$ such that $p_0=y$, $p_1=m$, and for every $t<t'$ we have $f(p_t)<f(p_{t'})$ and $d(x,p_t)< d(x,p_{t'})$. I.e., the path is moving away from $x$ and the value of $f$ increases along the path. Then is it true that $x$ is not a local maximum?
Edit: I think the question as stated rules out counter-examples involving $f$ is partially constant, and counter-examples of the type similar to topologist's sine curve.
 A: Edit: This applies to pre-edit version $f(p_t)\leq f(p_{t′})$ for any $t\leq t′$.
No. We will show this with a counterexample. Note the definition of local maximum points:
$x$ is a local maximum of $X$ if there exists some $\epsilon>0$ such that $f(y)\geq f(x)$ for all $y$ in $X$ with $d(x,y)<\epsilon$.
Denote by $S^2$ the two-dimensional disk of radius 1 centered at the origin of $\mathbb{R}^2$. Say $n=2$, $X=S^2$ and $d$ is the usual metric on $\mathbb{R}^2$. Consider a function $f:X\rightarrow\mathbb{R}$ that assigns the value 0 to every $(a,b)\in S^2$ where $a\leq0$, and $a$ to every $(a,b)\in S^2$ where $a>0$.
The only global maximum, we can denote it by $m$, of this connected subspace is $(1,0)\in S^2$ with $f(m)=1$. Any point $x\in X$ with negative first coordinate - for example $(-0.3,0)$ - is a local maximum of $X$, because there exists an open neighborhood $N$ around it - for example the open disk centered at this point with radius $\vert0.3\vert$ - such that $f(x)\geq f(y)$ for all $y\in N$. But for any neighbourhood $N$ around $x$, and any $y$ in $N$, there also exists a path $p$ with $p_0=x$ and $p_1=m$ such that $f(p_t)\leq f(p_{t'})$ for any $t\leq t'$ in $[0,1]$. This path could, for example, be the straight line between $p$ and $m$ in $S^2$. Hence, we found a counterexample to the proposition.
