Trigonometric sign function

trigonometry

I am positive that this definition:
$$
\text{sgn}(x) = \frac{\text{arccot}(x) – \text{arccot}(-x)}{2|\text{arccot}(x)|}
$$

Is correct, but wolframalpha says it's not. I suspect it's because it assumes $\text{arccot}(-x) = -\text{arccot}(x)$ for all $x$, but $\text{arccot}(0) = \text{arccot}(-0) \neq 0$, right?

I sent them feedback about this already. Meanwhile, here is my proof:

Let $x < 0$. Then:
$$
\begin{align*}
\text{sgn}(x) &= \frac{\text{arccot}(x) – \text{arccot}(-x)}{2|\text{arccot}(x)|}\\[1em]
&= \frac{\text{arccot}(-|x|) – \text{arccot}(|x|)}{2|\text{arccot}(-|x|)|}\\[1em]
&= \frac{-\text{arccot}(|x|) – \text{arccot}(|x|)}{2|-\text{arccot}(|x|)|}\\[1em]
&= \frac{-2\text{arccot}(|x|)}{2\text{arccot}(|x|)}\\[1em]
&= -1\\[1em]
\end{align*}
$$

Let $x > 0$. Then:
$$
\begin{align*}
\text{sgn}(x) &= \frac{\text{arccot}(x) – \text{arccot}(-x)}{2|\text{arccot}(x)|}\\[1em]
&= \frac{\text{arccot}(|x|) – \text{arccot}(-|x|)}{2|\text{arccot}(|x|)|}\\[1em]
&= \frac{\text{arccot}(|x|) + \text{arccot}(|x|)}{2\text{arccot}(|x|)}\\[1em]
&= \frac{2\text{arccot}(|x|)}{2\text{arccot}(|x|)}\\[1em]
&= 1\\[1em]
\end{align*}
$$

Finally, let $x = 0$. Then:
$$
\begin{align*}
\text{sgn}(x) &= \frac{\text{arccot}(x) – \text{arccot}(-x)}{2|\text{arccot}(x)|}\\[1em]
&= \frac{\text{arccot}(|x|) – \text{arccot}(|x|)}{2|\text{arccot}(x)|}\\[1em]
&= \frac{0}{2|\text{arccot}(x)|}\\[1em]
&= 0\\[1em]
\end{align*}
$$

Does this check out?

EDIT: $\text{arccot}$ not $\arccos$, dangit.

EDIT 2: This is best I could do when $\text{arccot}(x) = \frac{\pi}{2} – \arctan(x)$:

$$
\begin{align*}
\text{sgn}(x) &= \lim_{p\to +\infty}\Bigg[{\frac{\text{arccot}(-px) – \text{arccot}(px)}{2\text{arccot}(p|x|) + \pi}}\Bigg]
\end{align*}
$$

With the bonus that we get a smooth approximation for $p>0$, e.g. graph for p=5000.

Apparently that's a sigmoid function. Maybe I will ask another question about it!

Best Answer

I think the underlying issue is that Wolfram Alpha defines $\operatorname{arccot} x$ as $\arctan 1/x$ and subsequently stumbles a bit with the discontinuity that creates at $x=0$ According to Wikipedia here $\operatorname{arccot} x$ should have range $(0,\pi)$, but that would create a problem for you. Without having given it too much thought, I think I would prefer my $\operatorname{arccot}$ to be continuous at $x=0$, thus $\operatorname{arccot} x = \pi/2 - \arctan x$

Related Question