# Given any $x_1<x_2$, there exists $x_3$ between $x_1$ and $x_2$ such that $f(x_3)=g(x_3).$ Show that $f(x)=g(x)$ for every $x\in\mathbb{R}$.

Question: Let $$f,g:\mathbb{R}\to\mathbb{R}$$ be continuous functions such that given any two points $$x_1, there exists a point $$x_3$$ between $$x_1$$ and $$x_2$$ such that $$f(x_3)=g(x_3).$$ Show that $$f(x)=g(x)$$ for every $$x\in\mathbb{R}$$.

Solution: Let $$h:\mathbb{R}\to\mathbb{R}$$ be such that $$h(x)=f(x)-g(x), \forall x\in\mathbb{R}.$$ Note that $$h$$ is continuous on $$\mathbb{R}$$.

Now observe that the property described in the statement of the problem can be restated to the following: given any two points $$x_1, there exists a point $$x_3$$ between $$x_1$$ and $$x_2$$ such that $$h(x_3)=0$$. Let this restated property be denoted by $$(*)$$.

Now fix any point $$c\in\mathbb{R}$$. Next select any point $$b>c$$. Thus, by $$(*)$$, there exists a point $$x_1\in (b,c)$$ such that $$h(x_1)=0$$. Again, by $$(*)$$, there exists a point $$x_2\in (x_1,c)$$ such that $$h(x_2)=0$$. Continuing this procedure we would end up with a sequence $$(x_n)_{n\ge 1}$$ such that $$x_1\in (b,c)$$ and $$x_{n+1}\in (x_n,c), \forall n\in\mathbb{N}$$ and $$h(x_n)=0, \forall n\in\mathbb{N}.$$

Also note that $$(x_n)_{n\ge 1}$$ is a strictly increasing sequence and $$x_n, that is, $$(x_n)_{n\ge 1}$$ is bounded above. This implies that $$(x_n)_{n\ge 1}$$ is convergent and since $$\sup\{x_n:n\in\mathbb{N}\}=c,$$ implies that $$\lim_{n\to\infty}x_n=c.$$

Now since $$h$$ is continuous on $$\mathbb{R}$$, implies that $$h$$ is continuous at $$c$$. Thus, by the sequential definition of limit, since $$\lim_{n\to\infty}x_n=c$$, implies that $$(h(x_n))_{n\ge 1}$$ converges to $$h(c)$$. But, since $$h(x_n)=0, \forall n\in\mathbb{N}$$, implies that $$\lim_{n\to\infty}h(x_n)=0.$$ This implies that $$h(c)=0$$. Now since $$c\in\mathbb{R}$$ is arbitrary, implies that $$h(x)=0, \forall x\in\mathbb{R},$$ i.e, $$f(x)=g(x), \forall x\in\mathbb{R}$$. Hence, we are done.

Is this solution correct and rigorous enough, except that I haven't found a way to prove that $$\sup\{x_n:n\in\mathbb{N}\}=c,$$ or more specifically that $$\lim_{n\to\infty}x_n=c?$$ Also is there any alternative approach to solve the problem?

• Your proof is correct . $x_n \to c$ follows directly from definition of the limit, hence you are done.
– Gono
Sep 1, 2020 at 20:51
• By density of rationnals the sets of point where f and g are equal is also dense. Then you can conclude by the sequential definition of continuity for real functions. Sep 1, 2020 at 20:51
• @Gono No, from the way OP has constructed $x_n$, it is possible that it converges to something strictly smaller than $c$. Sep 1, 2020 at 20:56

Let $$x \in \mathbb{R}$$. For all $$n \geq 1$$, apply the hypothesis on the interval $$[x, x + \frac{1}{n}]$$ : there exists $$x_n$$ in this interval such that $$f(x_n)=g(x_n) \quad \quad (1)$$

Now because $$x \leq x_n \leq x + \frac{1}{n}$$, you have that $$(x_n)$$ tends to $$x$$. Let $$n$$ tend to $$+\infty$$ in the equality $$(1)$$ : by continuity of $$f$$ and $$g$$, you get $$f(x)=g(x)$$

• Nice one ! Good job. Sep 1, 2020 at 20:53

Your proof is needlessly complicated but correct. There is no need to invoke completeness of reals.

Assume on the contrary that there is a point $$c$$ with $$h(c) \neq 0$$. Then by definition of continuity there is a neighborhood $$I$$ of $$c$$ such that $$h$$ is non-zero on $$I$$ (has same sign as that of $$h(c)$$). Now take any two points in $$I$$, say $$p$$ and $$q$$, and by the hypotheses $$h$$ must vanish somewhere in $$(p, q)$$ and hence somewhere in $$I$$.

Your construction is on the right track, but you are right to be suspicious: from the way you have constructed the $$x_n$$, it is possible that the $$x_n$$ do not converge to $$c$$, since the construction only ensures $$b < x_1 < x_2 < \cdots$$; it is possible that the $$x_n$$ converge to some number strictly smaller than $$c$$. (This is why you were not able to verify $$\sup_n x_n = c$$.)
To remedy this, instead choose $$x_n$$ to lie in the interval $$(c-1/n, c)$$. The sequence you construct in this manner will not necessarily be increasing, but that is not important; what is important is that it is bounded from above by $$c$$ and converges to $$c$$.
• Actually I can still construct a strictly increasing sequence within the interval $(c-1/n,c)$. And, I came up with the idea of a strictly increasing sequence for the clarity of definition of the sequence $(x_n)_{n\ge 1}$. Sep 1, 2020 at 21:03