Because this function is continuous then on any interval it has a high point and a low point: .

Suppose that then which is contradictory to being open.

A similar argument leads to the conclusion that the maximum and minimum must happenat the endpoints of any closed interval.

Suppose that there are points .

But that would mean that the maximum on the interval is not at endpoint.

The same contradiction would follow if .

In other words must be monotonic.