y=sgnxy = \operatorname{sgn} x

Graph of the Sign Function y=sgnxy = \operatorname{sgn} x

y=sgnxy = \operatorname{sgn} x is the sign (signum) function, which extracts only the sign of a real number xx and returns one of three values.

sgnx={1(x>0)0(x=0)1(x<0)\operatorname{sgn} x = \begin{cases} 1 & (x > 0) \\ 0 & (x = 0) \\ -1 & (x < 0) \end{cases}

It returns 11 when xx is positive, 1-1 when negative, and 00 only when xx is exactly 00.

  • sgn(3.5)=1\operatorname{sgn}(3.5) = 1
  • sgn(2)=1\operatorname{sgn}(-2) = -1
  • sgn(0)=0\operatorname{sgn}(0) = 0

Domain and range. The domain is all real numbers, but the range consists of just the three values {1, 0, 1}\{-1,\ 0,\ 1\}. The graph is two horizontal rays — height 1-1 for x<0x < 0 and height 11 for x>0x > 0 — with a single isolated point of height 00 at the origin.

Symmetry. Since flipping the sign of xx flips the value, sgn(x)=sgnx\operatorname{sgn}(-x) = -\operatorname{sgn} x, the function is odd (symmetric about the origin). The value sgn(0)=0\operatorname{sgn}(0) = 0 is consistent with this.

Discontinuities and jumps. The only discontinuity is at the origin x=0x = 0. The left-hand limit is 1-1 and the right-hand limit is +1+1, so they disagree and the jump has size 22; the value itself is the midpoint 00. Everywhere else the function is constant and therefore continuous.

Relation to other functions. The sign function is closely tied to the absolute value:

x=xsgnx,sgnx=xx (x0)|x| = x \cdot \operatorname{sgn} x, \qquad \operatorname{sgn} x = \frac{x}{|x|}\ (x \neq 0)

The right-hand formula only works for x0x \neq 0. Differentiating x|x| gives sgnx\operatorname{sgn} x (for x0x \neq 0), and the function relates to the Heaviside step H(x)H(x) by sgnx=2H(x)1\operatorname{sgn} x = 2H(x) - 1.

Applications. The sign function is handy for expressing 'direction' or a positive/negative test in a formula. It appears in absolute-value calculations, in on-off (bang-bang) control, and in sign-based classification in machine learning — anywhere the direction of a value matters more than its magnitude.