# Two functions that coincide infinitely often

Can you find two functions $f$ and $g$ defined on a closed interval $[a, b]$, with real values, such that $\exists (x_n)$ an infinite sequence of distinct points in $[a, b]$ such that $$\forall n, f(x_n) =g(x_n)$$ but $$f\neq g$$

EDIT: the question is not interesting as it is stated. I therefore require that $f$ or $g$ do not coincide on any interval.

I have an answer when they are defined on $\mathbb R$, but in this case, I can't find such.

Bonus point if you find some that are continuous, or $C^n$ for large $n$

$f=0$ and $g=\exp(-1/|x|)\sin(1/x)$ (with $g(0)=0$) on $[-1,1]$. The sequence $(x_n)$ is of course that of the zeros $1/\pi n$ of $g$ in $(0,1]$. These form a discrete set (though not of course if one also throws in $0$).

• I don't have any graph software available at the moment, so how smooth is $g$? – Gabriel Romon May 8 '14 at 10:37
• It wiggles a lot, hence a good example. – user67773 May 8 '14 at 10:38
• I don't think graph software is very helpful in telling how smooth this function is. But I made it $\mathcal C^\infty$. (I'll make it an odd function around $0$ so that this makes sense easier at $0$). I is not real analytic at $0$ though. – Marc van Leeuwen May 8 '14 at 10:44

EDIT: The answer below is now obsolete now that the OP has edited the question.

Sure. You can even define ones on $C^\infty$. Take a look at the function:

$$f(x) = \begin{cases} e^{-\frac{1}{1-x^2}} & |x| < 1 \\ 0 & \text{else} \end{cases}$$

and let $g(x) = 0$. $f(x) = g(x)$ everywhere except on the interval $(-1,1)$. This is an example of a bump function.

Restrict the domain to $[0,2]$, perhaps, and take the infinite series of points $( p_n )$ where $p_n$ is an enumeration of the rationals on $(1,2)$.

• Can someone explain the downvote? – A.S May 8 '14 at 10:40
• He asked for a function such that $f\not=g$ for every $x$ in domain – kingW3 May 8 '14 at 10:44
• +1 And that's what he got. For $|x|<1$ there're not equal. There were no further restrictions on set where the functions are equal, in particular nothing about discretness. While this may not be quite what the OP wanted, that's definitely what he asked for. – Marcin Łoś May 8 '14 at 10:45
• Look at my edit, I added an extra requirement. – Gabriel Romon May 8 '14 at 10:52
• @GabrielR. I see the extra requirement, and have edited the answer to note that the answer is now obsolete. – A.S May 8 '14 at 10:52