Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Sign function
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Function returning minus 1, zero or plus 1}} {{Redirect|Sgn||SGN (disambiguation)}} {{distinguish|Sign relation|Sine function}} [[Image:Signum function.svg|thumb|Signum function <math>y = \sgn x</math>]] In [[mathematics]], the '''sign function''' or '''signum function''' (from ''[[wikt:signum#Latin|signum]]'', [[Latin language|Latin]] for "sign") is a [[Function (mathematics)|function]] that has the value {{math|−1}}, {{math|+1}} or {{math|0}} according to whether the [[Sign (mathematics)|sign]] of a given [[real number]] is positive or negative, or the given number is itself zero. In [[mathematical notation]] the sign function is often represented as <math>\sgn x</math> or <math>\sgn (x)</math>.<ref name=":0">{{Cite web|title=Signum function - Maeckes|url=http://www.maeckes.nl/Signum%20functie%20GB.html|access-date=|website=www.maeckes.nl}}</ref> ==Definition== The signum function of a real number <math>x</math> is a [[piecewise]] function which is defined as follows:<ref name=":0" /> <math display="block"> \sgn x :=\begin{cases} -1 & \text{if } x < 0, \\ 0 & \text{if } x = 0, \\ 1 & \text{if } x > 0. \end{cases}</math> The [[law of trichotomy]] states that every real number must be positive, negative or zero. The signum function denotes which unique category a number falls into by mapping it to one of the values {{math|−1}}, {{math|+1}} or {{math|0,}} which can then be used in mathematical expressions or further calculations. For example: <math display="block">\begin{array}{lcr} \sgn(2) &=& +1\,, \\ \sgn(\pi) &=& +1\,, \\ \sgn(-8) &=& -1\,, \\ \sgn(-\frac{1}{2}) &=& -1\,, \\ \sgn(0) &=& 0\,. \end{array}</math> == Basic properties == Any real number can be expressed as the product of its [[absolute value]] and its sign: <math display="block"> x = |x| \sgn x\,.</math> It follows that whenever <math>x</math> is not equal to 0 we have <math display="block"> \sgn x = \frac{x}{|x|} = \frac{|x|}{x}\,.</math> Similarly, for ''any'' real number <math>x</math>, <math display="block"> |x| = x\sgn x\,. </math> We can also be certain that: <math display="block">\sgn (xy)=(\sgn x)(\sgn y)\,,</math> and so <math display="block">\sgn (x^n)=(\sgn x)^n\,.</math> == Some algebraic identities == The signum can also be written using the [[Iverson bracket]] notation: <math display="block">\sgn x = -[x < 0] + [x > 0] \,.</math> The signum can also be written using the [[Floor and ceiling functions|floor]] and the absolute value functions: <math display="block">\sgn x = \Biggl\lfloor \frac{x}{|x|+1} \Biggr\rfloor - \Biggl\lfloor \frac{-x}{|x|+1} \Biggr\rfloor \,.</math> If <math>0^0</math> is accepted to be equal to 1, the signum can also be written for all real numbers as <math display="block">\sgn x = 0^ \left ( - x + \left\vert x \right\vert \right ) - 0^ \left ( x + \left\vert x \right\vert \right ) \,.</math> == Properties in mathematical analysis == === Discontinuity at zero === [[File:Discontinuity of the sign function at 0.svg|thumb|300px|The sign function is not [[continuous function | continuous]] at <math>x=0</math>.]] Although the sign function takes the value {{math|−1}} when <math>x</math> is negative, the ringed point {{math|(0, −1)}} in the plot of <math>\sgn x</math> indicates that this is not the case when <math>x=0</math>. Instead, the value jumps abruptly to the solid point at {{math|(0, 0)}} where <math>\sgn(0)=0</math>. There is then a similar jump to <math>\sgn(x)=+1</math> when <math>x</math> is positive. Either jump demonstrates visually that the sign function <math>\sgn x</math> is discontinuous at zero, even though it is continuous at any point where <math>x</math> is either positive or negative. These observations are confirmed by any of the various equivalent formal definitions of [[Continuous function|continuity]] in [[mathematical analysis]]. A function <math>f(x)</math>, such as <math>\sgn(x),</math> is continuous at a point <math>x=a</math> if the value <math>f(a)</math> can be approximated arbitrarily closely by the [[sequence]] of values <math>f(a_1),f(a_2),f(a_3),\dots,</math> where the <math>a_n</math> make up any infinite sequence which becomes arbitrarily close to <math>a</math> as <math>n</math> becomes sufficiently large. In the notation of mathematical [[Limit of a sequence|limit]]s, continuity of <math>f</math> at <math>a</math> requires that <math>f(a_n) \to f(a)</math> as <math>n \to \infty</math> for any sequence <math>\left(a_n\right)_{n=1}^\infty</math> for which <math>a_n \to a.</math> The arrow symbol can be read to mean ''approaches'', or ''tends to'', and it applies to the sequence as a whole. This criterion fails for the sign function at <math>a=0</math>. For example, we can choose <math>a_n</math> to be the sequence <math>1,\tfrac{1}{2},\tfrac{1}{3},\tfrac{1}{4},\dots,</math> which tends towards zero as <math>n</math> increases towards infinity. In this case, <math>a_n \to a</math> as required, but <math>\sgn(a)=0</math> and <math>\sgn(a_n)=+1</math> for each <math>n,</math> so that <math>\sgn(a_n) \to 1 \neq \sgn(a)</math>. This counterexample confirms more formally the discontinuity of <math>\sgn x</math> at zero that is visible in the plot. Despite the sign function having a very simple form, the step change at zero causes difficulties for traditional [[calculus]] techniques, which are quite stringent in their requirements. Continuity is a frequent constraint. One solution can be to approximate the sign function by a smooth continuous function; others might involve less stringent approaches that build on classical methods to accommodate larger classes of function. === Smooth approximations and limits === The signum function can be given as a number of different (pointwise) limits: <math display="block">\begin{align} \sgn x &= \lim_{n\to\infty}\frac{1-2^{-nx}}{1+2^{-nx}}\\ &= \lim_{n\to\infty}\frac{2}{\pi}\operatorname{arctan}(nx)\\ &= \lim_{n\to\infty}\tanh(nx)\\ &= \lim_{\varepsilon\to 0} \frac{x}{\sqrt{x^2 + \varepsilon^2}}. \end{align}</math> Here, <math>\tanh</math> is the [[hyperbolic tangent]], and <math>\operatorname{arctan}</math> is the [[arctan|inverse tangent]]. The last of these is the derivative of <math>\sqrt{x^2+\varepsilon ^2}</math>. This is inspired from the fact that the above is exactly equal for all nonzero <math>x</math> if <math>\varepsilon=0</math>, and has the advantage of simple generalization to higher-dimensional analogues of the sign function (for example, the partial derivatives of <math>\sqrt{x^2+y^2}</math>). See ''{{section link|Heaviside step function#Analytic approximations}}''. === Differentiation === The signum function <math>\sgn x</math> is [[Differentiable function|differentiable]] everywhere except when <math>x=0.</math> Its [[derivative]] is zero when <math>x</math> is non-zero: <math display="block"> \frac{\text{d}\, (\sgn x)}{\text{d}x} = 0 \qquad \text{for } x \ne 0\,.</math> This follows from the differentiability of any [[constant function]], for which the derivative is always zero on its domain of definition. The signum <math>\sgn x</math> acts as a constant function when it is restricted to the negative [[Interval (mathematics)#Definitions and terminology|open region]] <math>x<0,</math> where it equals {{math|β1}}. It can similarly be regarded as a constant function within the positive open region <math>x>0,</math> where the corresponding constant is {{math|+1}}. Although these are two different constant functions, their derivative is equal to zero in each case. It is not possible to define a classical derivative at <math>x=0</math>, because there is a discontinuity there. Although it is not differentiable at <math>x=0</math> in the ordinary sense, under the generalized notion of differentiation in [[distribution (mathematics)|distribution theory]], the derivative of the signum function is two times the [[Dirac delta function]]. This can be demonstrated using the identity <ref>{{MathWorld |title=Sign |id=Sign}}</ref> <math display="block"> \sgn x = 2 H(x) - 1 \,,</math> where <math>H(x)</math> is the [[Heaviside step function]] using the standard <math>H(0)=\frac{1}{2}</math> formalism. Using this identity, it is easy to derive the distributional derivative:<ref>{{MathWorld |title=Heaviside Step Function |id=HeavisideStepFunction}}</ref> <math display="block"> \frac{\text{d}\sgn x}{\text{d}x} = 2 \frac{\text{d} H(x)}{\text{d}x} = 2\delta(x) \,.</math> === Integration === The signum function has a [[definite integral]] between any pair of finite values {{mvar|a}} and {{mvar|b}}, even when the interval of integration includes zero. The resulting integral for {{mvar|a}} and {{mvar|b}} is then equal to the difference between their absolute values: <math display="block"> \int_a^b (\sgn x) \, \text{d}x = |b| - |a| \,.</math> In fact, the signum function is the derivative of the absolute value function, except where there is an abrupt change in [[slope|gradient]] at zero: <math display="block"> \frac{\text{d} |x|}{\text{d}x} = \sgn x \qquad \text{for } x \ne 0\,.</math> We can understand this as before by considering the definition of the absolute value <math>|x|</math> on the separate regions <math>x>0</math> and <math>x<0.</math> For example, the absolute value function is identical to <math>x</math> in the region <math>x>0,</math> whose derivative is the constant value {{math|+1}}, which equals the value of <math>\sgn x</math> there. Because the absolute value is a [[convex function]], there is at least one [[subderivative]] at every point, including at the origin. Everywhere except zero, the resulting [[subdifferential]] consists of a single value, equal to the value of the sign function. In contrast, there are many subderivatives at zero, with just one of them taking the value <math>\sgn(0) = 0</math>. A subderivative value {{math|0}} occurs here because the absolute value function is at a minimum. The full family of valid subderivatives at zero constitutes the subdifferential interval <math>[-1,1]</math>, which might be thought of informally as "filling in" the graph of the sign function with a vertical line through the origin, making it continuous as a two dimensional curve. In integration theory, the signum function is a [[weak derivative]] of the absolute value function. Weak derivatives are equivalent if they are equal [[almost everywhere]], making them impervious to isolated anomalies at a single point. This includes the change in gradient of the absolute value function at zero, which prohibits there being a classical derivative. === Fourier transform === The [[Fourier transform]] of the signum function is<ref>{{cite journal|last1=Burrows|first1=B. L.|last2=Colwell|first2=D. J.|title=The Fourier transform of the unit step function|journal=International Journal of Mathematical Education in Science and Technology|date=1990|volume=21|issue=4|pages=629β635|doi=10.1080/0020739900210418}}</ref> <math display="block">PV\int_{-\infty}^\infty (\sgn x) e^{-ikx}\text{d}x = \frac{2}{ik} \qquad \text{for } k \ne 0,</math> where <math>PV</math> means taking the [[Cauchy principal value]]. == Generalizations == === Complex signum === <!-- [[Complex sign function]] and [[Complex signum function]] redirect here --> The signum function can be generalized to [[complex numbers]] as: <math display="block">\sgn z = \frac{z}{|z|} </math> for any complex number <math>z</math> except <math>z=0</math>. The signum of a given complex number <math>z</math> is the [[point (geometry)|point]] on the [[unit circle]] of the [[complex plane]] that is nearest to <math>z</math>. Then, for <math>z\ne 0</math>, <math display="block">\sgn z = e^{i\arg z}\,,</math> where <math>\arg</math> is the [[Argument (complex analysis)|complex argument function]]. 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 defines, for <math>z=0</math>: <math display="block">\sgn(0+0i)=0</math> Another generalization of the sign function for real and complex expressions is <math>\text{csgn}</math>,<ref>Maple V documentation. May 21, 1998</ref> which is defined as: <math display="block"> \operatorname{csgn} z= \begin{cases} 1 & \text{if } \mathrm{Re}(z) > 0, \\ -1 & \text{if } \mathrm{Re}(z) < 0, \\ \sgn \mathrm{Im}(z) & \text{if } \mathrm{Re}(z) = 0 \end{cases} </math> where <math>\text{Re}(z)</math> is the real part of <math>z</math> and <math>\text{Im}(z)</math> is the imaginary part of <math>z</math>. We then have (for <math>z\ne 0</math>): <math display="block">\operatorname{csgn} z = \frac{z}{\sqrt{z^2}} = \frac{\sqrt{z^2}}{z}. </math> === Polar decomposition of matrices === <!-- Was "Generalization to matrices" --> Thanks to the [[Polar decomposition]] theorem, a matrix <math>\boldsymbol A\in\mathbb K^{n\times n}</math> (<math>n\in\mathbb N</math> and <math>\mathbb K\in\{\mathbb R,\mathbb C\}</math>) can be decomposed as a product <math>\boldsymbol Q\boldsymbol P</math> where <math>\boldsymbol Q</math> is a unitary matrix and <math>\boldsymbol P</math> is a self-adjoint, or Hermitian, positive definite matrix, both in <math>\mathbb K^{n\times n}</math>. If <math>\boldsymbol A</math> is invertible then such a decomposition is unique and <math>\boldsymbol Q</math> plays the role of <math>\boldsymbol A</math>'s signum. A dual construction is given by the decomposition <math>\boldsymbol A=\boldsymbol S\boldsymbol R</math> where <math>\boldsymbol R</math> is unitary, but generally different than <math>\boldsymbol Q</math>. This leads to each invertible matrix having a unique left-signum <math>\boldsymbol Q</math> and right-signum <math>\boldsymbol R</math>. In the special case where <math>\mathbb K=\mathbb R,\ n=2,</math> and the (invertible) matrix <math>\boldsymbol A = \left[\begin{array}{rr}a&-b\\b&a\end{array}\right]</math>, which identifies with the (nonzero) complex number <math>a+\mathrm i b=c</math>, then the signum matrices satisfy <math>\boldsymbol Q=\boldsymbol P=\left[\begin{array}{rr}a&-b\\b&a\end{array}\right]/|c|</math> and identify with the complex signum of <math>c</math>, <math>\sgn c = c/|c|</math>. In this sense, polar decomposition generalizes to matrices the signum-modulus decomposition of complex numbers. === Signum as a generalized function === <!-- Was "Generalized signum function" --> At real values of <math>x</math>, it is possible to define a [[generalized function]]–version of the signum function, <math>\varepsilon (x)</math> such that <math>\varepsilon (x)^2=1</math> everywhere, including at the point <math>x=0</math>, unlike <math>\sgn</math>, for which <math>(\sgn 0)^2=0</math>. This generalized signum allows construction of the [[algebra of generalized functions]], but the price of such generalization is the loss of [[commutativity]]. In particular, the generalized signum anticommutes with the Dirac delta function<ref name="Algebra"> {{cite journal |author = Yu.M.Shirokov |title = Algebra of one-dimensional generalized functions |journal = [[Theoretical and Mathematical Physics]] |year = 1979 |volume = 39 |issue = 3 |pages = 471β477 |url = http://springerlink.metapress.com/content/w3010821x8267824/?p=5bb23f98d846495c808e0a2e642b983a&pi=3 |archive-url = https://archive.today/20121208232109/http://springerlink.metapress.com/content/w3010821x8267824/?p=5bb23f98d846495c808e0a2e642b983a&pi=3 |url-status = dead |archive-date = 2012-12-08 |doi = 10.1007/BF01017992 |bibcode = 1979TMP....39..471S }}</ref> <math display="block">\varepsilon (x) \delta(x)+\delta(x) \varepsilon(x) = 0 \, ;</math> in addition, <math>\varepsilon (x)</math> cannot be evaluated at <math>x=0</math>; and the special name, <math>\varepsilon</math> is necessary to distinguish it from the function <math>\sgn</math>. (<math>\varepsilon (0)</math> is not defined, but <math>\sgn 0=0</math>.) ==See also== * [[Absolute value]] * [[Heaviside step function]] * [[Negative number]] * [[Rectangular function]] * [[Sigmoid function]] ([[Hard sigmoid]]) * [[Step function]] ([[Piecewise constant function]]) * [[Three-way comparison]] * [[Zero crossing]] * [[Polar decomposition]] ==Notes== <references/> {{DEFAULTSORT:Sign Function}} [[Category:Special functions]] [[Category:Unary operations]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Distinguish
(
edit
)
Template:Math
(
edit
)
Template:MathWorld
(
edit
)
Template:Mvar
(
edit
)
Template:Redirect
(
edit
)
Template:Section link
(
edit
)
Template:SfnRef
(
edit
)
Template:Short description
(
edit
)