Are there continuous functions who are the same in an interval but differ in at least one other point

calculusreal-analysis

You are given a function $f: \mathbb{R}\rightarrow \mathbb{R}$. Every derivative $\frac{d^n}{dx^n}(f(x)), \,n >0$ of the function is continuous.

Is there a function $g: \mathbb{R}\rightarrow \mathbb{R}$, for which every derivative $\frac{d^n}{dx^n}(g(x)), \,n >0$ is also continuous, such that:
$$\forall x\in[a,b]: \, g(x) = f(x)\land \, \exists x \notin [a,b]: f(x) \neq g(x),\, a \neq b$$

Thanks!

Edit:

I asked the question because I intuitively wondered if there would be functions, which could behave like "the same" in a given interval, but then behave differently so that they start diverging or at least stopped being the same the anymore. The answer to this question gave me a bigger understanding of real analysis.

If you would like to know which made me think about such a problem:
Although this is a vague formulation, generally, this question asks if two (completely) different things can develop (themselves) to be exactly equal in at least one part of there whole existence…

Best Answer

Define the real functions $f$ and $g$ thus: $$ f(x) = \begin{cases} \exp\Big(-\frac{1}{(x - 1)^2}\Big)\ &\text{if } x > 1 \\ 0\ &\text{if } x \in [-1, 1] \\ \exp\Big(-\frac{1}{(x + 1)^2}\Big)\ &\text{if } x < -1 \end{cases} $$ and $$ g(x) = 0\quad \text{for all } x \in \mathbb{R} $$

  • By construction, $f$ and $g$ are both $0$ on $[-1, 1]$ but they differ in value everywhere else.

  • Obviously $g$ is continuously differentiable infinitely many times as it is a constant function.

  • You can also check that $f$ is continuously differentiable infinitely many times at $x = -1$ and $x = 1$ by computing appropriate right and left hand limits of $\frac{d^nf(x)}{dx^n}$ ($n \in \mathbb{Z}_+$) inductively. Let us compute for example $\lim\limits_{x \to 1^+}\frac{df(x)}{dx}$: for $x > 1$, \begin{align*} 0 < \frac{df(x)}{dx} &= \frac{2(x - 1)^{-3}}{\exp\big(\frac{1}{(x - 1)^2}\big)} \\ &= \frac{2y^3}{\exp\big(y^2\big)} \quad\text{ where }y = \frac{1}{x - 1} > 0 \\ &= \frac{2}{\frac{1}{y^3}\sum\limits_{k = 0}^\infty \frac{y^{2k}}{k!}} \quad\text{ divide by }y^3\text{ and use }e^z = \sum\limits_{k = 0}^\infty\frac{z^k}{k!} \\ &= \frac{2}{\frac{1}{y^3}\frac{y^0}{0!} + \frac{1}{y^3}\frac{y^2}{1!} + \frac{1}{y^3}\frac{y^4}{2!} + \sum\limits_{k = 3}^\infty \frac{y^{2k - 3}}{k!}} \\ &< \frac{2}{\frac{1}{y^3} + \frac{1}{y} + \frac{1}{2}y} \end{align*} As $x \to 1^+$, we get $y = \frac{1}{x - 1} \to \infty$ and the right hand fraction $\frac{2}{\frac{1}{y^3} + \frac{1}{y} + \frac{1}{2}y} \to 0$. So, as $x \to 1^+$, $\frac{df(x)}{dx} \to 0$ also by the Squeeze Theorem.

That was a long calculation but take my word: it can be repeated inductively to show that $\lim\limits_{x \to 1+}\frac{d^nf(x)}{dx^n} = 0$ for all $n \in \mathbb{Z}_+!$ At all other points i.e. on $(-\infty, -1) \cup (-1, 1) \cup (1, \infty)$, $f$ is infinitely differentiable because exponentials and constant functions are infinitely differentiable.

Bonus Fact:

Both $\frac{d^n f(x)}{dx^n}$ and $\frac{d^n g(x)}{dx^n}$ also have the same value $0$ on $[-1, 1]$ for all positive integers $n$!