21

It is easily shown that the function $$\begin{cases} \exp \left(\frac{1}{x^2-1} \right) & |x| < 1 \\ 0 & \text{otherwise} \\ \end{cases}$$ is smooth and has compact support in $\mathbb R$. I tried playing with it to find a function with the following properties:

a. $f(x)=0$ for $x \le 0$

b. $f(x)=1$ for $x \ge 1$

c. $f$ is monotonically increasing.

d. $f$ is smooth.

Is it possible to find an explicit formula for such $f$?

user1337
  • 24,859

3 Answers3

16

Let $$h(x) = \left\{\begin{array}{c} 0 & x \leq 0 \\ e^{-1/x} & x > 0 \end{array} \right. $$

Then consider $$ g(x) = \frac{h(x)}{ h(x) + h(1-x)} $$

It is smooth because it is the ratio of smooth functions with the denominator never $0$.

To verify it is increasing, we can calculate the sign of the numerator of $g'(x)$ using quotient rule between $0 < x < 1$:

$$\begin{align} N g'(x) = & h'(x)(h(x) + h(1-x)) - h(x)(h'(x) + h'(1-x)) \\ = & \frac{1}{x^2} h(x) h(1-x) + \frac{1}{(1-x)^2} h(x)h(1-x) \\ > & 0 \end{align}$$

muzzlator
  • 7,375
6

I've found this other explicit construction of a transition function (I believe it's from Spivak's Calculus on Manifolds).

  1. Let $$g(x)=\begin{cases} \exp \left( \frac{1}{x^2-1} \right) & |x|<1 \\ 0 & |x| \geq 1 \end{cases}$$ and let $A:=\int_{-\infty}^\infty g(x) \mathrm{d}x$.

  2. The function $$f(x):=\frac{1}{A} \int_{-\infty}^x g(t) \mathrm{d} t$$ satisfies the requirements (up to a simple change of variables of the form $x \mapsto ax+b)$.

user1337
  • 24,859
2

I tried playing with it to [...]

This will be the same function as the accepted one above, but approached in a different way that might inspire how to get there by playing.

First, the question is really easy if the requirements are instead

  1. $b(-∞) = 0$
  2. $b(+∞) = 1$
  3. $b$ is monotonically increasing.
  4. $b$ is smooth.

There are a bunch of those, but let's pick $b(x) = ½(1+\tanh(½x))$.

Of course we didn't want an infinite domain, so we still have to compress $(-∞, +∞)$ down to $(0, 1)$.

What do we need for that?

  1. $u(0^{+}) = -∞$
  2. $u(1^{-}) = +∞$
  3. $u$ is monotonically increasing.
  4. $u$ is smooth.

Conveniently, that's also easy. We just add poles at $x = 0$ and $x = 1$, leaving us with

$$ u(x) = {1\over{1-x}} - {1\over{x}} $$

What if we combine them? https://www.desmos.com/calculator/oca6bndx7l graph of b(u(x))

Which turns out to be exactly the same as the above answer:

$$\begin{align} f(x) &= b(u(x)) \\ &= ½(1+\tanh(½u(x))) \\ &= ½{{2e^{u(x)}}\over{e^{u(x)}+1}} \\ &= {{1}\over{1+e^{-u(x)}}} \\ &= {{1}\over{1+e^{ {1\over{x}} - {1\over{1-x}} }}} \\ &= {{ e^{-{1}\over{x}} }\over{ e^{-{1}\over{x}} + e^{-{1}\over{1-x}} }} \\ &= {{ h(x) }\over{ h(x) + h(1-x) }} \end{align}$$

It's left as an exercise to the reader to show why picking the logistic function for $b$ worked, but other things don't. For example, using arctan gives a discontinuous first derivative.

me22
  • 201
  • I’m not sure I understand how you’ve presented this answer: You say “there’s a bunch of those, let’s pick one” when coming up with the tanh. But then you end by saying actually other functions that satisfy the constraints don’t work? – SBK Dec 12 '24 at 07:24