# Mountain climbing problem

In mathematics, the mountain climbing problem is a mathematical problem that considers a two-dimensional mountain range (represented as a continuous function), and asks whether it is possible for two mountain climbers starting at sea level on the left and right sides of the mountain to meet at the summit, while maintaining equal altitudes at all times. It has been shown that when the mountain range has only a finite number of peaks and valleys, it is always possible to coordinate the climbers' movements, but this does not necessarily hold when it has an infinite number of peaks and valleys.
This problem was named and posed in this form by James V. Whittaker (1966), but its history goes back to Tatsuo Homma (1952), who solved a version of it. The problem has been repeatedly rediscovered and solved independently in different contexts by a number of people (see references below).
Since the 1990s, the problem was shown to be connected to the weak Fréchet distance of curves in the plane, various planar motion planning problems in computational geometry, the inscribed square problem, semigroup of polynomials, etc. The problem was popularized in the article by Goodman, Pach & Yap (1989), which received the Mathematical Association of America's Lester R. Ford Award in 1990.

## Analysis

The problem can be rephrased as asking whether, for a given pair of continuous functions $f,g$ (corresponding to rescaled versions of the left and right faces of the mountain) where:
* $f(0)=g(0)=0$,
* $f(1)=g(1)=1$, and
* For all $x\in [0,1]$, $f(x),g(x)\in [0,1]$
Is it possible to find another pair of functions $x_{1},x_{2}$ (representing the climbers' horizontal positions at time $t$) satisfying:
* $x_{1}(0)=x_{2}(0)=0$, and
* $x_{1}(1)=x_{2}(1)=1$
Such that the compositions $f\circ x_{1}$ and $g\circ x_{2}$ (which represent the climbers' altitudes at time $t$) are identical?

### Finite number of peaks and valleys

When $f,g$ have only a finite number of peaks and valleys (local maxima and local minima) it is always possible to coordinate the climbers' movements. This can be shown by drawing out a sort of game tree: an undirected graph $G$ with one vertex labeled $(x_{1},x_{2})$ whenever $f(x_{1})=g(x_{2})$ and either $f(x_{1})$ or $g(x_{2})$ is a local maximum or minimum. Two vertices will be connected by an edge if and only if one node is immediately reachable from the other; the degree of a vertex will be greater than one only when the climbers have a non-trivial choice to make from that position.
* At the vertex $(0,0)$, the degree is one: the only possible direction for both climbers to go is onto the mountain. Similarly, at $(1,1)$ the degree is one, because both climbers can only return down the mountain.
* At a vertex where one climber is at a peak or a valley and the other one is not, then the degree is two: the climber at the peak or valley has two choices of which way to go, and the other climber can only go one way.
* At a vertex where both climbers are at peaks or both climbers are at valleys, the degree is four: both climbers may choose independently of each other which direction to go.
* At a vertex where one climber is at a peak and the other is at a valley, the degree is zero: such positions are unreachable. (That is, if such a vertex exists, then the graph $G$ is not connected.)
According to the handshaking lemma, every connected component of an undirected graph has an even number of odd-degree vertices. Since the only odd-degree vertices in all of $G$ are $(0,0)$ and $(1,1)$, these two vertices must belong to the same connected component. That is, $G$ must contain a path from $(0,0)$ to $(1,1)$. That path tells how to coordinate the climbers' movement to the summit.
It has been observed that for a mountain with n peaks and valleys the length of this path (roughly corresponding to the number of times one or the other climber must "backtrack") can be as large as quadratic in n.
This technique breaks down when $f,g$ have an infinite number of local extrema. In that case, $G$ would not be a finite graph, so the handshaking lemma would not apply: $(0,0)$ and $(1,1)$ might be connected but only by a path with an infinite number of vertices, possibly taking the climbers "infinite time" to traverse.

### Infinite number of peaks and valleys

The following result is due to Huneke (1969):
    Suppose $f$ and $g$ are continuous functions from $[0,1]$ to $[0,1]$ with $f(0)=g(0)=0$ and $f(1)=g(1)=1$, and such that neither function is constant on an interval. Then there exist continuous functions $s$ and $t$ from $[0,1]$ to $[0,1]$ with $s(0)=t(0)=0$, $s(1)=t(1)=1$, and such that $f\circ s\,=\,g\circ t$, where "$\circ$" stands for a composition of functions.
On the other hand, it is not possible to extend this result to all continuous functions. For, if $f$ has constant height over an interval while $g$ has infinitely many oscillations passing through the same height, then the first climber may be forced to go back and forth over that interval infinitely many times, making his path to the summit infinitely long. James V. Whittaker (1966) gives a concrete example involving $x\sin(x^{-1})$.