sgn x equals 1 if −2 is greater than 0, −1 if −2 is less than 0, 0 otherwise, −2 is less than 0, so the second row, equals −1
Working2 steps
sgn x
=
1,−2>0−1,−2<00,otherwise
−2<0, so the second row
=
−1
Practice questions
You are given
x=7
What the definition says
sgn x = 1 if x > 0, −1 if x < 0, and 0 otherwise
Three rows. The first two take every positive and every negative number, so the last row, “otherwise”,
is read for x = 0 alone. Many books write that row as “0 if x = 0”, which is the same function. The name
signum is also used, from the Latin for sign.
Worked examples
x = 7.5. 7.5 > 0, so the first row: sgn 7.5 = 1.
x = −0.2. −0.2 < 0, so the second row: sgn(−0.2) = −1. The size of x does not matter, only the
side of zero it lies on.
x = 0. Neither 0 > 0 nor 0 < 0 holds, so the last row: sgn 0 = 0.
With the absolute value
For every real x, x = sgn x · |x|: the sign times the size gives the number back. For x ≠ 0 it follows
that sgn x = x/|x|, which is how the graph on this page is drawn. At x = 0 that quotient has no value,
and the definition gives 0 there.
The graph
Two horizontal half-lines, at −1 to the left of zero and at 1 to the right, and the single point (0, 0)
between them. The function is defined at 0 and jumps there, so it is not continuous at 0.
Common mistakes
Giving sgn 0 the value 1. Zero is neither positive nor negative, and sgn 0 = 0.
Expecting the size. sgn(−40) is −1, not −40. The size is |x|.
Writing x/|x| for every x. It has no value at 0, where sgn x does.
Copy the code into your page where the formula card should appear. It loads from lovetocalc.com, so it stays current on its own — all we ask is that the credit line comes with it.