Sign function
Sgn redirects here. For the capitalized abbreviation
SGN, see SGN (disambiguation).
For the signature sgn() of a permutation, see even and
odd permutations.
Not to be confused with Sine function.
In mathematics, the sign function or signum function
y
1
The sign function is not continuous at x = 0.
sgn(x) =
x
|x|
=
|x|
x
Similarly, for any real number x,
Signum function y = sgn(x)
(from signum, Latin for sign) is an odd mathematical
function that extracts the sign of a real number. In mathe- |x| = sgn(x) x
matical expressions the sign function is often represented
The signum function is the derivative of the absolute value
as sgn.
function (up to the indeterminacy at zero): Note, the resultant power of x is 0, similar to the ordinary derivative
of
x. The numbers cancel and all we are left with is the
1 Denition
sign of x.
The signum function of a real number x is dened as follows:
1
sgn(x) := 0
d|x|
dx
= sgn(x) for x = 0 .
The signum function is dierentiable with derivative 0
everywhere except at 0. It is not dierentiable at 0 in the
ordinary sense, but under the generalised notion of differentiation in distribution theory, the derivative of the
signum function is two times the Dirac delta function,
which can be demonstrated using the identity
ifx < 0,
ifx = 0,
ifx > 0.
Properties
sgn(x) = 2H(x) 1
[1]
Any real number can be expressed as the product of its
absolute value and its sign function:
(where H(x) is the Heaviside step function using the standard H(0) = 1/2 formalism). Using this identity, it is easy
to derive the distributional derivative:
x = sgn(x) |x| .
d sgn(x)
dx
It follows that whenever x is not equal to 0 we have
1
= 2 dH(x)
= 2(x) . [2]
dx
6 NOTES
The signum can also be written using the Iverson bracket Another generalization of the sign function for real and
notation:
complex expressions is csgn,[3] which is dened as:
1
csgn(z) = 1
The signum can also be written using the oor and the
sgn(Im(z))
absolute value functions:
sgn(x) = [x < 0] + [x > 0] .
sgn(x) =
x
x
.
|x| + 1
| x| + 1
ifRe(z) > 0,
ifRe(z) < 0,
ifRe(z) = 0
where Re(z) is the real part of z and Im(z) is the imaginary
part of z.
We then have (for z 0):
For k 1, a smooth approximation of the sign function
z
z2
is
csgn(z) = =
.
z
z2
sgn(x) tanh(kx) .
4 Generalized signum function
Another approximation is
At real values of x, it is possible to dene a generalized
functionversion of the signum function, (x) such that
x
(x)2 = 1 everywhere, including at the point x = 0 (unsgn(x)
.
like sgn, for which sgn(0)2 = 0). This generalized signum
x2 + 2
allows construction of the algebra of generalized funcwhich gets sharper as 0; note that this is the derivative tions, but the price of such generalization is the loss of
of x2 + 2 . This is inspired from the fact that the above commutativity. In particular, the generalized signum anis exactly equal for all nonzero x if = 0, and has the ticommutes with the Dirac delta function[4]
advantage of simple generalization to higher-dimensional
analogues of the sign function (for example, the partial
derivatives of x2 + y2 ).
(x)(x) + (x)(x) = 0 ;
See Heaviside step function Analytic approximations.
in addition, (x) cannot be evaluated at x = 0; and the special name, is necessary to distinguish it from the function
sgn. ((0) is not dened, but sgn(0) = 0.)
3 Complex signum
The signum function can be generalized to complex numbers as
z
sgn(z) =
|z|
for any complex number z except z = 0. The signum of a
given complex number z is the point on the unit circle of
the complex plane that is nearest to z. Then, for z 0,
5 See also
Absolute value
Heaviside function
Negative number
Rectangular function
Sigmoid function (Hard sigmoid)
sgn(z) = ei arg z ,
Step function (Piecewise constant function)
where arg is the complex argument function.
Three-way comparison
For reasons of symmetry, and to keep this a proper generalization of the signum function on the reals, also in the
complex domain one usually denes, for z = 0:
sgn(0 + 0i) = 0
Zero crossing
6 Notes
[1] Weisstein, Eric W., Sign, MathWorld.
[2] Weisstein, Eric W.,
MathWorld.
Heaviside Step Function,
[3] Maple V documentation. May 21, 1998
[4] Yu.M.Shirokov (1979). Algebra of one-dimensional
generalized functions.
TMF. 39 (3): 471477.
doi:10.1007/BF01017992.
7 TEXT AND IMAGE SOURCES, CONTRIBUTORS, AND LICENSES
Text and image sources, contributors, and licenses
7.1
Text
Sign function Source: https://en.wikipedia.org/wiki/Sign_function?oldid=731406984 Contributors: Georey~enwiki, AugPi, Charles
Matthews, Omegatron, Robbot, Sverdrup, Henrygb, Enochlau, Giftlite, Gene Ward Smith, Markus Kuhn, Gubbubu, Icairns, Panzi,
Mormegil, MuDavid, Petrus~enwiki, Zaslav, Spoon!, Rbj, Burn, Thryduulf, Cgibbard, Linas, Rjwilmsi, Margosbot~enwiki, Mark83,
YurikBot, Wavelength, RobotE, RussBot, Kimchi.sg, Bota47, Igin, Gesslein, Bo Jacoby, A bit iy, SmackBot, Tom Lougheed, BiT, Octahedron80, Nbarth, Bombshell, Ugur Basak Bot~enwiki, SashatoBot, Lambiam, Cronholm144, Jim.belk, Tv145033, Domitori, Tomwerner,
Amalas, Fph, Krauss, Julian Mendez, He Who Is, Escarbot, Ben pcc, JAnDbot, Catslash, Albmont, DWIII, Stephanwehner, Wayp123,
Comp25, Haseldon, VolkovBot, Anonymous Dissident, Rjgodoy, Soler97, SophomoricPedant, Jdaloner, J kabudian, Kwjbot, Kal-El-Bot,
Thatguyint, Addbot, DOI bot, EjsBot, LaaknorBot, Luckas-bot, Yobot, Xqbot, Isheden, FrescoBot, Ertugka, Windrider it, EmausBot,
WikitanvirBot, JordiGH, KlappCK, Ee.rui.xu, YFdyh-bot, Stephan Kulla, Gif-unrelated, Kavigupta, The Disambiguator, TE5ITA, CAPTAIN RAJU, Splitcomplexes and Anonymous: 39
7.2
Images
File:Discontinuity_of_the_sign_function_at_0.svg Source: https://upload.wikimedia.org/wikipedia/commons/c/c1/Discontinuity_of_
the_sign_function_at_0.svg License: CC BY-SA 4.0 Contributors: Own work Original artist: Stephan Kulla (User:Stephan Kulla)
File:Signum_function.svg Source: https://upload.wikimedia.org/wikipedia/commons/4/4f/Signum_function.svg License: CC-BY-SA3.0 Contributors: No machine-readable source provided. Own work assumed (based on copyright claims). Original artist: No machinereadable author provided. Cronholm144 assumed (based on copyright claims).
7.3
Content license
Creative Commons Attribution-Share Alike 3.0