TITLE: Continuation of strictly monotone functions on $\mathbb{R}$
QUESTION [6 upvotes]: While studying the properties of ordinal utility functions, I came across the following question.
Given a strictly increasing function $f : D \rightarrow \mathbb{R}$, where $D$ is an arbitrary non-empty subset of $ \mathbb{R} $, can one always find a strictly increasing function $g : \mathbb{R} \rightarrow \mathbb{R}$ that is defined everywhere on $\mathbb{R}$ and is equal to $f$ everywhere in the set $D$?
I feel that the answer should be positive, however, there might be some counterexample I'm unaware of.

REPLY [5 votes]: Another counterexample : set $D=(-\infty,0[\cup[1,+\infty)$, and define $f$ on $D$ like this : 
$$f(x)=\begin{cases}\begin{array}{ccc}x& \text{if}& x<0 \\ x-1 & \text{if} & x\geq 1\end{array}\end{cases}$$
Assume that $g$ exists and choose $x\in[0,1)$. For all negative $y$, you'll get :
$$g(y)=f(y)=y<g(x)<g(1)=f(1)=0$$
so $g(x)$ should be greater than any negative number yet less than $0$. This is absurd.