Sign[x]
gives -1, 0, or 1 depending on whether x is negative, zero, or positive.
Sign
Sign[x]
gives -1, 0, or 1 depending on whether x is negative, zero, or positive.
Details
- Mathematical function, suitable for both symbolic and numerical manipulation.
- For nonzero complex numbers z, Sign[z] is defined as z/Abs[z].
- Sign tries various transformations in trying to determine the sign of symbolic expressions.
- For exact numeric quantities, Sign internally uses numerical approximations to establish its result. This process can be affected by the setting of the global variable $MaxExtraPrecision.
- Sign automatically threads over lists. »
- Sign can be used with Interval and CenteredInterval objects. »
Examples
open all close allBasic Examples (4)
Sign[-2.5]Sign[3.14]Sign[1.4 + 2.3I]Plot over a subset of the reals:
Plot[Sign[x], {x, -3, 3}]Plot over a subset of the complexes:
ComplexPlot3D[Sign[z], {z, -3 - 3I, 3 + 3I}, PlotLegends -> Automatic]Scope (32)
Numerical Evaluation (6)
Sign[0.7]Sign[1 + I]N[Sign[E + Pi I], 20]For real inputs, the result is exact:
Sign[123`20]For complex inputs, the precision of the output tracks the precision of the input:
Sign[123`20 - 456`20I]Evaluate efficiently at high precision:
Sign[-7230`100 + I]//TimingSign[-745453`100000 + 123456I];//TimingCompute the elementwise values of an array using automatic threading:
Sign[{{1 / 2, -1}, {-5 / 3, 1 / 2}}]Or compute the matrix Sign function using MatrixFunction:
MatrixFunction[Sign, {{1 / 2, -1}, {-5 / 3, 1 / 2}}]//FullSimplifySign can be used with Interval and CenteredInterval objects:
Sign[Interval[{1, 3}]]Sign[CenteredInterval[-3, 1]]Or compute average-case statistical intervals using Around:
Sign[ Around[-1.1, 0.01]]Specific Values (5)
Values of Sign at fixed points:
Table[Sign[n ], {n, {-2, -1 / 3, 7 / 2, 3}}]Sign[0]Sign[Infinity]Sign[I Infinity]Sign[ComplexInfinity]PiecewiseExpand[Sign[x], -2 < x < 2]Find a value of
for which the
:
xval = x /. First@Solve[Sign[x] == 0, x]//QuietPlot[Sign[x], {x, -5, 5}, Epilog -> Style[Point[{xval, Sign[xval]}], Red, PointSize[Large]], ExclusionsStyle -> Dotted]Visualization (4)
Plot[Sign[1 + x], {x, -3, 3}, ExclusionsStyle -> Dashed]Plot the real and imaginary parts of the
function:
ReImPlot[Sign[x + I], {x, -3, 3}, PlotTheme -> "Detailed"]Visualize Sign in three dimensions:
ComplexPlot3D[Sign[z], {z, -2 - 2I, 2 + 2I}, RegionFunction -> Function[{z}, Abs[z] ≤ 2]]Plot the real part of the
function:
ComplexContourPlot[Re[Sign[z]], {z, -3 - 3 I, 3 + 3I}, Contours -> 20]Plot the imaginary part of the
function:
ComplexContourPlot[Im[Sign[z]], {z, -3 - 3 I, 3 + 3I}, Contours -> 20]Function Properties (12)
Sign is defined for all real and complex inputs:
FunctionDomain[Sign[x], x]FunctionDomain[Sign[x], x, Complexes]Function range of Sign for real inputs:
FunctionRange[Sign[x], x, y]The range over the complex plane is the unit circle plus the origin:
FunctionRange[Sign[x], x, y, Complexes]//SimplifySign is an odd function:
Sign[-z]Sign has mirror symmetry
:
Sign[Conjugate[1 + 2I]] == Conjugate[Sign[1 + 2I]]Sign is not a differentiable function:
D[Sign[x], x]The difference quotient does not have a limit in the complex plane:
Underscript[, hUnderscript[ -> , ℂ]0](Sign[1 + h] - Sign[1]/h)There is only a limit in certain directions, for example, the real direction:
Underscript[, hUnderscript[ -> , ℝ]0](Sign[1 + h] - Arg[1]/h)Use RealSign to obtain this real-differentiable result:
RealSign'[x]Sign is not an analytic function:
FunctionAnalytic[Sign[x], x]It has both singularities and discontinuities:
FunctionSingularities[Sign[x], x]FunctionDiscontinuities[Sign[x], x]Over the complex plane, it is singular everywhere but still discontinuous only at the origin:
FunctionSingularities[Sign[x], x, Complexes]FunctionDiscontinuities[Sign[x], x, Complexes]Sign is nonincreasing:
FunctionMonotonicity[Sign[x], x]Sign is not injective:
FunctionInjective[Sign[x], x]Plot[{Sign[x], 1}, {x, -4, 4}]Sign is not surjective:
FunctionSurjective[Sign[x], x]Plot[{Sign[x], -2.5}, {x, -4, 4}]Sign is neither non-negative nor non-positive:
FunctionSign[Sign[x], x]Sign is neither convex nor concave:
FunctionConvexity[Sign[x], x]TraditionalForm formatting:
Sign[x]//TraditionalFormFunction Identities and Simplifications (5)
Expand assuming real variables x and y:
ComplexExpand[Sign[x + I y], TargetFunctions -> {Re, Im}]Simplify Sign using appropriate assumptions:
Simplify[Sign[x], x < 0]Express a complex number as a product of Sign and Abs:
FullSimplify[Sign[z]Abs[z]]Table[Simplify[Sign[z^(1/(n))] == Sign[z]^(1/(n))], {n, 5}]Simplify[Abs[Sign[z]], z ≠ 0]Applications (2)
Plot the real and imaginary parts of Sign over the complex plane:
{Plot3D[Re[Sign[x + I y]], {x, -1, 1}, {y, -1, 1}], Plot3D[Im[Sign[x + I y]], {x, -1, 1}, {y, -1, 1}]}r[n_, x_] := Sign[Sin[2 ^ n Pi x]]Plot (vertically shifted) Rademacher functions:
Plot[Evaluate[Table[r[n, x] + n / 5, {n, 5}]], {x, -Pi, Pi}, Exclusions -> Sin[2 ^ 5 Pi x] == 0]Check orthogonality over the unit interval:
Table[Integrate[r[n1, x]r[n2, x], {x, 0, 1}], {n1, 3}, {n2, 3}]//FullSimplifyProperties & Relations (10)
Sign with simple arguments automatically evaluates to simpler form:
Sign[1 / z]Sign[z ^ 2]Sign[Exp[z]]Sign is idempotent:
Sign[Sign[z]]Use FullSimplify to simplify expressions involving Sign:
FullSimplify[Sign[a b] - Sign[a] Sign[b] + Sign[a] - Abs[a] / a]Simplify under additional assumptions:
Simplify[Sign[z] + z / Abs[z], z > 0]ComplexExpand[Sign[z^a], {z}]Use Sign as a target function for ComplexExpand:
ComplexExpand[Re[ArcSin[x + I y]], TargetFunctions -> Sign]Use Sign in definite integration:
Integrate[Sign[Sin[x]], {x, 0, 2}]Integrate along a line in the complex plane, symbolically and numerically:
Integrate[Sign[x ^ 2], {x, -2 + I, Pi + I}]N[%]NIntegrate[Sign[x ^ 2], {x, -2 + I, Pi + I}]For complex values, the indefinite integral is path dependent:
Integrate[Sign[x], x]The indefinite integral for real values:
Integrate[Sign[x], x, Assumptions -> x∈Reals]FourierTransform[Sign[y], y, x]LaplaceTransform[Sign[y], y, x]Obtain Sign from integrals and limits:
Integrate[Sin[a x] / x, {x, -Infinity, Infinity}, Assumptions -> a∈Reals]Limit[2ArcTan[a x], a -> Infinity, Assumptions -> x∈Reals]FullSimplify[%, Assumptions -> x∈Reals]Convert to Piecewise:
PiecewiseExpand[Sign[x]Sign[1 - x], x∈Reals]PiecewiseExpand[Sign[2 - x + Sign[2 - x ^ 3] ^ 3], x∈Reals]Possible Issues (5)
Sign is a function of a complex variable and is therefore not differentiable:
D[Sign[z], z]As a complex function, it is not possible to write Sign[z] without involving Conjugate[z]:
FullSimplify[Sign[z] == (z/Sqrt[Conjugate[z] z])]In particular, the limit that defines the derivative is direction dependent and therefore does not exist:
Limit[DifferenceQuotient[Sign[z], {z, h}], h -> 0, Direction -> 1]Limit[DifferenceQuotient[Sign[z], {z, h}], h -> 0, Direction -> I]Use RealSign, which assumes its argument is real, to obtain a differentiable version of Sign:
D[RealSign[x], x]For purely real or imaginary approximate arguments, Sign returns exact answers:
Sign[1.3]Sign[1.3 I]For general complex arguments, Sign tracks the precision of the input:
Sign[1.5 + I]Sign can stay unevaluated for numeric arguments:
Sign[(-1 - 2 E - E ^ 2 + (1 + E) ^ 2)]Simplify[%]Machine‐precision numerical evaluation of Sign can give wrong results:
Sign[(-1 - 2 E - E ^ 2 + (1 + E) ^ 2) + 10 ^ -100]N[%]Arbitrary‐precision evaluation gives the correct result:
N[%%, 250]A larger setting for $MaxExtraPrecision can be needed:
Block[{$MaxExtraPrecision = 10000}, N[Sign[(-1 - 2 E - E ^ 2 + (1 + E) ^ 2) + 10 ^ -100], 20]]Sign applied to a matrix does not give the matrix sign function:
Sign[{{1, 2}, {-2, 1}}]Neat Examples (3)
Form repeated convolution integrals starting with a symmetric product of three sign functions:
Convolution[f_, g_, x_] := Module[{y}, Simplify[Integrate[(f /. x -> x - y)(g /. x -> y), {y, -1, 1}, Assumptions -> x∈Reals], x∈Reals]]NestList[Convolution[#, Sign[x]Sign[x + 1]Sign[1 - x], x]&, Sign[x]Sign[x + 1]Sign[1 - x], 3]Plot[Evaluate[%], {x, -3, 3}]Approximate Sign through a generalized Fourier series:
sign[n_, x_] := Sum[(-1) ^ k HermiteH[2k + 1, x] / (2 ^ (2k)(2k + 1)k!), {k, 0, n}] / PiPlot[Evaluate[Table[sign[n, x], {n, 20}]], {x, -2, 2}]Calculate rational approximations of Sign:
Table[Tanh[2 n ArcTanh[1 / x]], {n, 4}]//FunctionExpand//Together//FactorPlot[Evaluate[%], {x, -10, 10}]Tech Notes
Related Links
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0) ▪ 2021 (13.0)
Text
Wolfram Research (1988), Sign, Wolfram Language function, https://reference.wolfram.com/language/ref/Sign.html (updated 2021).
CMS
Wolfram Language. 1988. "Sign." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Sign.html.
APA
Wolfram Language. (1988). Sign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Sign.html
BibTeX
@misc{reference.wolfram_2026_sign, author="Wolfram Research", title="{Sign}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/Sign.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_sign, organization={Wolfram Research}, title={Sign}, year={2021}, url={https://reference.wolfram.com/language/ref/Sign.html}, note=[Accessed: 13-June-2026]}