This site is supported by donations to The OEIS Foundation.

# Sign function

The sign function sgn(x), also called the signum function, of a real number $\scriptstyle x \,$ is defined as

$\sgn(x) := \begin{cases} -1 & \text{if } x < 0, \\ 0 & \text{if } x = 0, \\ 1 & \text{if } x > 0. \end{cases}$

This may be compactly written as

$\sgn(x) := [x \ge 0] - [x \le 0],\quad x \in \R, \,$

where $\scriptstyle [\cdot] \,$ is the Iverson bracket.

## "Sign" of complex number

The "sign" of a complex number $\scriptstyle z \,=\, a + bi \,=\, r e^{i \theta} \,=\, |z| e^{i \arg(z)} \,$, where $\scriptstyle |z| \,$ is the absolute value of a complex number and $\scriptstyle \arg(z) \,=\, \theta \,$ is the argument of a nonzero complex number (the argument of 0 being undefined), would generalize to

$\sgn(z) := \begin{cases} 0 & \text{if } z = 0, \\ e^{i \arg(z)} = e^{i \theta} & \text{if } z \ne 0. \end{cases}$

The "sign" of a nonzero complex number would thus give the complex number on the unit circle of the complex plane which has the same argument as $\scriptstyle z \,$.

If we consider the real numbers as a subset of the complex numbers, then

$\sgn(x) := \begin{cases} e^{i \pi} & \text{if } x < 0, \\ 0 & \text{if } x = 0, \\ e^{i 0} & \text{if } x > 0. \end{cases}$