2

Special properties of the function $f(x)=\frac{1}{1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)}$

  1. Is the function $$f(x)=\frac{1}{1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)}$$ an example of a discontinuous function with continuous derivative $f'(x)$?

  2. Is the function $$g(x)=\frac{\theta(1-x^2)}{1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)}= \theta(1-x^2)\cdot f(x) $$ a smooth function? $g(x)\in C^\infty$?... here $\theta(x)$ is the Heaviside step function.

You could see these functions plot in Desmos:

examples


Added later

I believe that these functions behave as flat functions at $x=\{-1;\ 0;\ 1\}$, so in principle the derivative should be zero at these points (if I am not mistaken).

Joako
  • 1,380

1 Answers1

3

The function $\left(1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)\right)^{-1}$ has several issues.

Firstly, it is discontinuous at $-1,0,$ and $1$, and of these, only the discontinuity at $0$ is removable, since the left and right limits of $\frac{1-2|x|}{x^2-|x|}$ go to $-\infty$ and taking the exponential of this will control that discontinuity. However, this is a ``nice'' discontinuity in the sense that correctly replacing it will make $f$ differentiable at 0.

However, for $\pm 1$, the left and right limits have opposite signs and diverge drastically, so the function is discontinuous there (it is a jump discontinuity). We can't define derivatives at a discontinuous point, so the derivative just does not exist here. The derivative appearing continuous in Desmos is due to the numerical processing and the fact that the left and right limits at $-1$ coincide; $\lim_{x\to-1^-}f'(x)=\lim_{x\to-1^+}f'(x)$.

To see this, first note that if $x\leq 0$, then $|x| = -x$, so $\left(1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)\right)^{-1} = \left(1+\exp\left(\frac{1+2x}{x^2+x}\right)\right)^{-1}$ on $(\infty, -1)\cup(-1,0)$. This function is clearly differentiable on these intervals. A thorough application of the chain rule and quotient rule gives

$$f'(x)=\frac{{\mathrm{e}}^{\frac{2\,x+1}{x\,\left(x+1\right)}}\,\left(2\,x^2+2\,x+1\right)}{x^2\,{\left({\mathrm{e}}^{\frac{2\,x+1}{x\,\left(x+1\right)}}+1\right)}^2\,{\left(x+1\right)}^2}$$

We really only care about the exponentials here, since they have a stronger effect on the limit than the polynomial terms, and examining the limit of $\frac{{\mathrm{e}}^{\frac{2\,x+1}{x\,\left(x+1\right)}}}{{\left({\mathrm{e}}^{\frac{2\,x+1}{x\,\left(x+1\right)}}+1\right)}^2}$ shows that this tends to $0$.

You can work out the details of the positive half of the function, but the apparent continuity of the graph of derivative is really due to the numerical processing that Desmos does, although I am not sure what numerical procedure they use.

Pranav
  • 78
  • thanks for taking the time to answer. Maybe I got misunderstood the meaning of a function $f'(x)$ to be continuous, but as you said I have equal limits from the left and the right, but moreover, I have also that $$\lim\limits_{x\to\pm 1^\pm} f'(x) =\lim\limits_{x\to\pm 1} f'(x)=0$$ so the limits in the exact points also exists and are equal to the values from the left and from the right, so for what I see in Wikipedia for limits of functions the function should be indeed continuous there. – Joako Jul 03 '23 at 00:55
  • 1
    @Joako For $f'(x)$ to be continuous at $\pm1$, it has to be defined at $\pm1$, which it isn't. Neither of $f'(\pm1)$ exist. So $f'(x)$ is not continuous at $\pm1$. What you've encountered is the fact the derivative has removable discontinuities. – coiso Jul 03 '23 at 03:55
  • @coiso what this means is that I am forced to describe the function piecewise in order to make it continuous? even if in the "limits sense" it is continuous? defining $$\hat{f}(x)=\begin{cases} \frac{1}{1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)},\quad x<-1,\ 0,\quad x=-1,\ \frac{1}{1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)},\quad -1<x<0\ 1, \quad x=0,\ \frac{1}{1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)},\quad 0<x<1,\ 0\quad x=1,\ \frac{1}{1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)},\quad x>1\end{cases}$$ should behave exactly as $f(x)$, (...) – Joako Jul 03 '23 at 15:50
  • @coiso (...) since their differences are defined only in a zero-measure set of points, right? this is why I am confused. – Joako Jul 03 '23 at 15:52
  • 1
    @Joako You cannot make $f(x)$ continuous. In particular, that $\hat{f}(x)$ is not continuous. But you can "make" $g(x)$ and $f'(x)$ continuous since they have removable discontinuities at $x=\pm1$. – coiso Jul 03 '23 at 16:24
  • @coiso Why not? Why the discontinuity at $x=0$ is different from those on $x=\pm 1$?.. in all of them the function becomes flat so it kind of fulfill having a zero derivative there. – Joako Jul 03 '23 at 18:50
  • 1
    @Joako For $f(x)$, the discontinuity at $x=0$ is removable, but the discontinuity at $x=\pm1$ is obviously not. You can see the graph of $f(x)$ quite blatantly jump in the graphs you posted, meaning the left and right limits of $f$ do not match at $x=\pm1$. – coiso Jul 03 '23 at 20:32
  • @coiso so defining $$\hat{g}(x)=\begin{cases} 1, \quad x=0,\ 0,\quad |x|\geq 1,\ \frac{1}{1+\exp\left(\frac{1-2|x|}{x^2-|x|}\right)},\quad\text{else}\end{cases}$$ will solve the problems? It will make $\hat{g}(x)$ smooth? – Joako Jul 03 '23 at 20:41
  • 1
    I believe that $\hat{g}(x)$ will be smooth. – coiso Jul 03 '23 at 20:51
  • @coiso I tested piecewise in Wolfram-Alpha and looks good, the derivative looks continuous using $\hat{g}(x)$. The smooth part question I asked it now is fixed here. – Joako Jul 04 '23 at 21:32
  • Hi @mathcounterexamples.net maybe you could get interested in the examples of simple piecewise defined functions that behave as discontinuous functions with continuous derivative. – Joako Jul 05 '23 at 04:31