# Sign (mathematics)

In mathematics, the concept of **sign** originates from the property of every real number being either positive or negative or zero. Depending on local conventions, zero is either considered as being neither a positive, nor a negative number (having no sign, or a specific sign of its own), or as belonging to both, negative and positive numbers (having both signs). If not specifically mentioned this article adheres to the first convention. In some contexts it makes sense to consider a signed zero, e.g., in floating point representations of real numbers within computers. The phrase "change of sign" is associated throughout mathematics and physics to generate the additive inverse (negation, or multiplication by −1) of any object that allows for this construction, and is not restricted to real numbers. It applies among other objects to vectors, matrices, and complex numbers, which are not prescribed to be only either positive, negative, or zero. The word "sign" is also often used to indicate other binary aspects of mathematical objects that resemble positivity and negativity, such as odd and even (sign of a permutation), sense of orientation or rotation (cw/ccw), one sided limits, and others, below.

## Sign of a number

Numbers from various number systems, like integers, rationals, complex numbers, quaternions, ... may have multiple attributes, that fix certain properties of a number. If a number system bears the structure of an ordered ring, like, for example, the integers, it must contain a number that does not change any number when it is added to it (an additive identity element). This number is generally denoted as 0. Because of the total order in this ring, there are numbers greater than zero, called the *positive* numbers. For other properties, required within a ring, for each such positive number there exists a number less than 0, which, when added to the positive number, yields the result 0. These numbers less than 0 are called the *negative* numbers. The numbers in each such pair are their respective additive inverses. This attribute of a number, being exclusively either *zero* (0), or *positive* (+), or *negative* (−), is called its **sign**, and is often encoded to the real numbers 0, 1, and −1, respectively. Since rational and real numbers are also ordered rings (even fields), these number systems share the *sign* attribute.

While in arithmetic a minus sign is usually thought of as representing the binary operation of subtraction, in algebra it is usually thought of as representing the unary operation yielding the additive inverse (sometimes called *negation*) of the operand. While 0 is its own additive inverse (−0 = 0), the additive inverse of a positive number is negative and the additive inverse of a negative number is positive. A double application of this operation is written as −(−3) = 3. The plus sign is predominantly used in algebra to denote the binary operation of addition, and only rarely to emphasize the positivity of an expression.

In common numeral notation (which is used in arithmetic and elsewhere), the sign of a number is often made explicit by placing a plus or a minus sign before the number. For example, +3 denotes "positive three", and −3 denotes "negative three" (algebraically: the additive inverse of 3). Without specific context, or when no explicit sign is given, a number is interpreted per default as positive. This notation establishes a strong association of the minus sign "−" with negative numbers, and, likewise, the plus sign "+" is associated with positivity.

### Sign of zero

Within the convention of zero being neither positive nor negative, a specific sign-value 0 may be assigned to the number value 0. This is exploited in the -function, as defined for real numbers. In arithmetic, +0 and −0 both denote the same number 0. There is generally no danger of confusing the value with its sign.

The convention of assigning both signs to 0 does not immediately allow for this discrimination.

In some contexts, especially in computing, it is useful to consider signed versions of zero, with signed zeros referring to different, discrete number representations (see also signed number representations.)

The symbols +0 and −0 rarely appear as substitutes for 0^{+} and 0^{−}, used in calculus and mathematical analysis for one-sided limits. This notation refers to the behaviour of a function as its real input variable approaches 0 along positive or negative values, respectively; the two limits need not exist or agree.

### Terminology for signs

When 0 is said to be neither positive nor negative, the following phrases may be used to refer to the sign of a number:

- A number is
**positive**if it is greater than zero. - A number is
**negative**if it is less than zero. - A number is
**non-negative**if it is greater than or equal to zero. - A number is
**non-positive**if it is less than or equal to zero.

When 0 is said to be both positive and negative, modified phrases are used to refer to the sign of a number:

- A number is
**strictly positive**if it is greater than zero. - A number is
**strictly negative**if it is less than zero. - A number is
**positive**if it is greater than or equal to zero. - A number is
**negative**if it is less than or equal to zero.

For example, the absolute value of a real number is always "non-negative", but is not necessarily "positive" in the first interpretation, whereas in the second interpretation it is called "positive" and is not necessarily "strictly positive".

The same terminology is sometimes used for functions that yield real, or other signed values. For example, a function would be called a *positive function* if its values are positive for all arguments of its domain, or a *non-negative function*, if all of its values are non-negative.

### Complex numbers

Complex numbers are impossible to order, so they cannot carry the structure of an ordered ring, and, accordingly, cannot be partitioned into positive and negative complex numbers. They do, however, share an attribute with the reals, which is called *absolute value*, or *magnitude*. Magnitudes are always non-negative real numbers, and to any non-zero number there belongs a positive real number, its absolute value. For example, the absolute value of −3 and the absolute value of 3 are both equal to 3. This is written in symbols as |−3| = 3 and |3| = 3. So any arbitrary real value can be specified by its magnitude and its sign. Using the standard encoding, any real value is given by the product of the magnitude and the sign in standard encoding. This relation can be generalized to define a *sign* for complex numbers.

Since the real and complex numbers both form a field and contain the positive reals, they also contain the reciprocals of the magnitudes of all non-zero numbers. So any non-zero number may be multiplied with the reciprocal of its magnitude, that is, divided by its magnitude. It is immediate that the quotient of any non-zero real number by its magnitude yields exactly its sign. By analogy, the **sign of a complex number** z can be defined as the quotient of z and its magnitude |*z*|. Since the magnitude of the complex number is *divided out*, the resulting sign of the complex number represents in some sense its complex argument. Comparing this with the sign of real numbers, recalls See below for the definition of a complex sign-function.

### Sign functions

When dealing with numbers it is often convenient to have their sign available as a number. This is accomplished by functions that extract the sign of any number and maps it to a predefined value, then available for further calculations. For example, it might be advantageous to formulate an intricate algorithm for positive values only, and take care of the sign only afterwards.

#### Real sign function

The **sign function** or **signum function** extracts the sign of a real number by mapping the set of real numbers to the set of the three reals It can be defined as follows:

Thus sgn(*x*) is 1 when x is positive, and sgn(*x*) is −1 when x is negative. For nonzero values of x, this function can also be defined by the formula

where |*x*| is the absolute value of x.

#### Complex sign function

While a real number has a 1 dimensional direction, a complex number has a 2 dimensional direction. The complex sign function requires the magnitude of its argument z = *x* + *iy*, which can be calculated as

Analogous to above, the **complex sign function** extracts the complex sign of a complex number by mapping the set of non-zero complex numbers to the set of unimodular complex numbers, and 0 to 0: It may be defined as follows:

Let *z* be also expressed by its magnitude and one of its arguments φ as *z* = |*z*|⋅*e ^{iφ}*, then

This definition may also be recognized as a normalized vector, that is the vector’s direction remains unchanged, and it’s length is fixed to unity. If the original value was R,θ in polar form then sign(R, θ) is 1 θ. Extension of sign() or signum() to any number of dimensions is obvious, but this has already been defined as normalizing a vector.

## Signs per convention

In situations where there are exactly two possibilities on equal footing for an attribute, these are often labeled by convention as *plus* and *minus*, respectively. In some contexts the choice of this assignment (which range of values is considered positive and which negative) is natural, whereas in others the choice is arbitrary, making an explicit sign convention necessary, the only requirement being consistent use of the convention.

### Sign of an angle

In many contexts, it is common to associate a sign with the measure of an angle, particularly an oriented angle or an angle of rotation. In such a situation, the sign indicates whether the angle is in the clockwise or counterclockwise direction. Though different conventions can be used, it is common in mathematics to have counterclockwise angles count as positive, and clockwise angles count as negative.

It is also possible to associate a sign to an angle of rotation in three dimensions, assuming the axis of rotation has been oriented. Specifically, a right-handed rotation around an oriented axis typically counts as positive, while a left-handed rotation counts as negative.

### Sign of a change

When a quantity *x* changes over time, the change in the value of *x* is typically defined by the equation

Using this convention, an increase in *x* counts as positive change, while a decrease of *x* counts as negative change. In calculus, this same convention is used in the definition of the derivative. As a result, any increasing function has positive derivative, while a decreasing function has negative derivative.

### Sign of a direction

In analytic geometry and physics, it is common to label certain directions as positive or negative. For a basic example, the number line is usually drawn with positive numbers to the right, and negative numbers to the left:

As a result, when discussing linear motion, displacement or velocity to the right is usually thought of as being positive, while similar motion to the left is thought of as being negative.

On the Cartesian plane, the rightward and upward directions are usually thought of as positive, with rightward being the positive *x*-direction, and upward being the positive *y*-direction. If a displacement or velocity vector is separated into its vector components, then the horizontal part will be positive for motion to the right and negative for motion to the left, while the vertical part will be positive for motion upward and negative for motion downward.

### Signedness in computing

most-significant bit | |||||||||

0 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
= | 127 |

0 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
= | 126 |

0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
= | 2 |

0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
= | 1 |

0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
= | 0 |

1 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
= | −1 |

1 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
= | −2 |

1 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
= | −127 |

1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
= | −128 |

Most computers use two's complement to represent the sign of an integer. |

In computing, an integer value may be either signed or unsigned, depending on whether the computer is keeping track of a sign for the number. By restricting an integer variable to non-negative values only, one more bit can be used for storing the value of a number. Because of the way integer arithmetic is done within computers, signed number representations usually do not store the sign as a single independent bit, instead using e.g. two's complement.

In contrast, real numbers are stored and manipulated as Floating point values. The floating point values are represented using three separate values, mantissa, exponent, and sign. Given this separate sign bit, it is possible to represent both positive and negative zero. Most programming languages normally treat positive zero and negative zero as equivalent values, albeit, they provide means by which the distinction can be detected.

### Other meanings

In addition to the sign of a real number, the word sign is also used in various related ways throughout mathematics and the sciences:

- Words
*up to sign*mean that for a quantity q is known that either*q*=*Q*or*q*= −*Q*for certain Q. It is often expressed as*q*= ±*Q*. For real numbers, it means that only the absolute value |*q*| of the quantity is known. For complex numbers and vectors, a quantity known up to sign is a stronger condition than a quantity with known magnitude: aside Q and −*Q*, there are many other possible values of q such that |*q*| = |*Q*|. - The sign of a permutation is defined to be positive if the permutation is even, and negative if the permutation is odd.
- In graph theory, a signed graph is a graph in which each edge has been marked with a positive or negative sign.
- In mathematical analysis, a signed measure is a generalization of the concept of measure in which the measure of a set may have positive or negative values.
- In a signed-digit representation, each digit of a number may have a positive or negative sign.
- The ideas of signed area and signed volume are sometimes used when it is convenient for certain areas or volumes to count as negative. This is particularly true in the theory of determinants. In an (abstract) oriented vector space, each ordered basis for the vector space can be classified as either positively or negatively oriented.
- In physics, any electric charge comes with a sign, either positive or negative. By convention, a positive charge is a charge with the same sign as that of a proton, and a negative charge is a charge with the same sign as that of an electron.