# name this function

Is there a function that has these properties?

Points:

• $f(1)=\tfrac{1}{2}$
• $f(-1)=-\tfrac{1}{2}$
• $f(0)=0$

Bounds: $f$ is bounded between $(-1,1)$:

• $\forall x\in\mathbb{R}: -1 < f(x) < 1$
• $\lim_{x\to \infty} f(x)=1$
• $\lim_{x\to -\infty} f(x)=-1$

Slopes: $f$ is strictly increasing for all $x\in\mathbb{R}$ and at $x=0$, $f'(x)=1$:

$$\frac{d}{dx}f(x)=\begin{cases}0<f'<1&:x<0\\1 &:x=0\\0<f'<1&:x>0 \end{cases}$$

Concavity:

$$\frac{d^2}{dx^2}f(x) = \begin{cases}>0 &:x<0\\ 0 &:x=0\\ <0 &:x>0 \end{cases}$$

Smoothness: $f$ is infinitely differentiable and every derivative is continuous (or perhaps uniformly continuous):

$$\forall n\in\mathbb{N} : \forall x\in\mathbb{R} : \exists y\in\mathbb{R} : f^{(n)}(x) = y$$

I've tried $\tanh(x)$, $\frac{2}{\pi}\arctan(x)$, $\text{erf}(x)$, and others, but all of them were missing at least one of the properties listed above. Is there one that satisfies ALL those properties? If so, prove it or show an example.

Below is a graph (in red) of the type of function I'm looking for. The derivative is in green and the 2nd derivative is in blue. (The function shown is $\arctan x$ so it's not exactly what I'm looking for.) • Out of curiosity, what led you to these specific conditions? Feb 11, 2013 at 1:49
• Why properly scaled $arctan()$ doesn't fit? Feb 11, 2013 at 5:19
• because $\frac{d}{dx} \left(\frac{2}{\pi} \arctan(x)\right) \ne 1$ at $x=0$ Feb 11, 2013 at 5:25
• @mbaitoff, TestSubject528491: You can fix the derivative by taking $\frac{2}{\pi}\arctan\left(\frac{\pi}{2}x\right)$, but this still has the wrong values at $x=\pm 1$. Trying to fix this problem is what led to my answer. Feb 11, 2013 at 5:53

$$f(x)=\begin{cases}1-\frac1{1+x}&\text{if x\ge0,}\\\frac1{1-x}-1&\text{if x<0.}\end{cases}$$

Well, the technically correct answer to the question "Is there a function that has these properties?" is simply "Yes. In fact, there are uncountably many." In principle, you can take any form of sigmoid function you like and tweak it to match all of your conditions. Here is one recipe. Say you have an odd function $s(x)$ satisfying $$\begin{gather} -\infty<\lim\limits_{y\to-\infty}s(y)\le s(x)\le\lim\limits_{y\to+\infty}s(y)<\infty,\\ s'(x)>0,\\ xs''(x)\le0 \end{gather}$$ for all $x$. Then $s_1(x)=s(x)/s'(0)$ has derivative $1$ at $x=0$, and so does $s_2(x)=s_1(ax)/a$ for any $a$. Pick $a$ so that $s_2(1)=s_1(a)/a=\frac12,$ which is always possible because $\lim\limits_{a\to0}s_1(a)/a=1$ and $\lim\limits_{a\to\infty}s_1(a)/a=0$. Finally, define $f(x)=s_2(x)$ for $\lvert x\rvert\le1$, and extend $f$ to approach the desired asymptotes $\pm 1$ as $x\to\pm\infty$. I'm not sure how high a degree of continuity we can guarantee at $x=\pm1$ while maintaining concavity; certainly we can get $C^1$ by letting $$f(x)=1-\frac1{2+b(x-1)}$$ over $x>1$, with $b$ chosen to match $s_2'(1)$, and similarly over $x<-1$; probably we can also get $C^2$ though I'm less sure about that.

Anyway, here's a completely different, explicit solution. We can think of my original suggestion as the odd $f$ such that $f(x)=1+a/(1+x)$ for $x\ge0$, which happens to match three of the conditions $f(0)=0$, $f(1)=\frac12$, $f'(0)=1$ for $a=1$. If we also want $f''(0)=0$ so that $f''$ is defined everywhere, then we do need four degrees of freedom, so let $f(x)=1+a/(1+x)+b/(1+x)^2+c/(1+x)^3+d/(1+x)^4$ for $x\ge0$. Then we get a solution $a=-2$, $b=4$, $c=-5$, $d=2$, which leads to $$f(x)=\begin{cases} \frac{x(x^3+2x^2+4x+1)}{(x+1)^4}&\text{if x\ge0},\\ -f(-x)&\text{if x<0}. \end{cases}$$ • In other words, $f(x)=\mathrm{sign}(x)\left(1-\dfrac{1}{1+|x|}\right)$. Feb 11, 2013 at 2:09
• But $f''(0)$ does not exist. Feb 11, 2013 at 2:13
• Interesting: $f'$ is bounded by $1$, $f''$ is bounded by $2$, $f'''$ is bounded by $6$, $f^{\mathrm{iv}}$ is bounded by $24$. Is $f^{\mathrm{n}}$ always bounded by $n!$? Feb 11, 2013 at 2:48
• @TestSubject528491: The function is odd so it suffices to consider your question for $x>0$. Note that for $x>0$, $n>0$, $f^{(n)}(x)=(-1)^{n+1}\dfrac{n!}{(1+x)^{n+1}}$, so $|f^{(n)}(x)|\leq n!$. Feb 11, 2013 at 2:50
• Indeed, this is merely two shifted copies of $x^{-1}$ on $x\ge1$ glued together. Looking at it that way makes it easy to differentiate.
– user856
Feb 11, 2013 at 3:10

Playing around with Mathematica led me to think the following might work:

$$f(x)=\left(\frac{2}{\pi }\right)^{1/3} \text{ArcTan}\left[\frac{\pi x^3}{2 \left(1+\frac{1}{2} x^2 \text{Cot}\left[\frac{\pi }{16}\right] \left(\pi -2 \text{Tan}\left[\frac{\pi }{16}\right]\right)\right)}\right]^{1/3}.$$

• It does look like it works, but, but... How on earth did you arrive at this incredible expression??
– user856
Feb 11, 2013 at 6:29
• @RN: Thought of $(2/\pi)\arctan((pi/2)x)$; Of course, $f(\pm 1)$ would be wrong. So how to adjust the value at $1$ without messing up the derivative at $1$? Maybe something like $(2/\pi)\arctan((\pi/2)x +c x^3)$; nope, other things fall apart. So various other attempts are made to the inside, including considering something like $g(x)=(2\pi)\arctan(\pi/2 x/(1+cx^{2/3}))$, but that loses twice differentiability. So instead I went with $f(x)=\sqrt{g(x^3)}$ then figured out what $c$ would work; Mathematica told me what $c$ is to get $f(1)=1/2$, and $c$ is what makes it ugly. Feb 11, 2013 at 7:02
• (Sorry for the bad formatting in parts of my comment, but hopefully it is possible to tell what is meant.) Feb 11, 2013 at 7:08

Two additional answers occur to me (aside from a scale factor and shifting):

1. The logistic function $\frac{1}{1+e^{-t}}$; this is essentially the hyperbolic tangent $\frac{e^t - e^{-t}}{e^t + e^{-t}}$.

2. The cumulative normal distribution function $\int_{-\infty}^x e^{-t^2} dt$ with appropriate scaling inside (probably with $-t^2/2$) and outside (something with $\sqrt{\pi}$).

Both of these look like the function you want.

• How are these functions adjusted to meet all of the criteria, including $-1<f(x)<1$, $f'(0)=1$, $f(\pm 1)=\pm \frac12$? Feb 11, 2013 at 6:02
• I've tried these, they do not fit all the criteria. Neither the logistic function nor the erf function meet both $f(1)=.5$ and $f'(0)=1$. (the erf function is the integral of the Gaussian curve you mentioned in your post) Feb 11, 2013 at 6:16