−1

← −2 −1 0 →
−1 0 1 2 3 4 5 6 7 8 9 →
Cardinal−1, minus one, negative one
Ordinal−1st (negative first)
Divisors1
Arabic−١
Chinese numeral负一,负弌,负壹
Bengali−১
Binary (byte)
S&M: 1000000012
2sC: 111111112
Hex (byte)
S&M: 0x10116
2sC: 0xFF16

In mathematics, −1 (negative one or minus one) is the additive inverse of 1, that is, the number that when added to 1 gives the additive identity element, 0. It is the negative integer greater than negative two (−2) and less than 0.

In mathematics

Algebraic properties

Multiplying a number by −1 is equivalent to changing the sign of the number – that is, for any x we have (−1) ⋅ x = −x. This can be proved using the distributive law and the axiom that 1 is the multiplicative identity:

x + (−1) ⋅ x = 1 ⋅ x + (−1) ⋅ x = (1 + (−1)) ⋅ x = 0 ⋅ x = 0.

Here we have used the fact that any number x times 0 equals 0, which follows by cancellation from the equation

0 ⋅ x = (0 + 0) ⋅ x = 0 ⋅ x + 0 ⋅ x.

In other words,

x + (−1) ⋅ x = 0,

so (−1) ⋅ x is the additive inverse of x, i.e. (−1) ⋅ x = −x, as was to be shown.

The square of −1 (that is −1 multiplied by −1) equals 1. As a consequence, a product of two negative numbers is positive. For an algebraic proof of this result, start with the equation

0 = −1 ⋅ 0 = −1 ⋅ [1 + (−1)].

The first equality follows from the above result, and the second follows from the definition of −1 as additive inverse of 1: it is precisely that number which when added to 1 gives 0. Now, using the distributive law, it can be seen that

0 = −1 ⋅ [1 + (−1)] = −1 ⋅ 1 + (−1) ⋅ (−1) = −1 + (−1) ⋅ (−1).

The third equality follows from the fact that 1 is a multiplicative identity. But now adding 1 to both sides of this last equation implies

(−1) ⋅ (−1) = 1.

The above arguments hold in any ring, a concept of abstract algebra generalizing integers and real numbers.: p.48 

0, 1, −1, i, and −i in the complex or Cartesian plane

Although there are no real number square roots of −1, the complex number i satisfies i2 = −1, and as such can be considered as a square root of −1. The only other complex number whose square is −1 is −i because there are exactly two square roots of any non‐zero complex number, which follows from the fundamental theorem of algebra. In the algebra of quaternions – where the fundamental theorem does not apply – which contains the complex numbers, the equation x2 = −1 has infinitely many solutions.

Inverse and invertible elements

The reciprocal function f(x) = x−1 where for every x except 0, f(x) represents its multiplicative inverse

Exponentiation of a non‐zero real number can be extended to negative integers, where raising a number to the power −1 has the same effect as taking its multiplicative inverse:

x−1 = ⁠1/x⁠.

This definition is then applied to negative integers, preserving the exponential law xaxb = x(a + b) for real numbers a and b.

A −1 superscript in f −1(x) takes the inverse function of f(x), where (f(x))−1 specifically denotes a pointwise reciprocal. Where f is bijective specifying an output codomain of every y ∈ Y from every input domain x ∈ X, there will be

f−1(f(x)) = x, and f−1(f(y)) = y.

When a subset of the codomain is specified inside the function f, its inverse will yield an inverse image, or preimage, of that subset under the function.

Exponentiation to negative integers can be further extended to invertible elements of a ring by defining x−1 as the multiplicative inverse of x; in this context, these elements are considered units.: p.49 

In a polynomial domain F [x] over any field F, the polynomial x has no inverse. If it did have an inverse q(x), then there would be

x q(x) = 1 ⇒ deg(x) + deg(q(x)) = deg(1)
                 ⇒ 1 + deg(q(x)) = 0
                 ⇒ deg(q(x)) = −1

which is not possible, and therefore, F [x] is not a field. More specifically, because the polynomial is not constant, it is not a unit in F.

Computer science and programming

In computer science and programming, the integer −1 is frequently used as a special value to represent conditions that are distinct from ordinary non-negative integer values. Depending on the programming language or application programming interface, it may serve as a sentinel value, indicate an error or unsuccessful operation, or represent the absence of a valid result. It is also used in integer arithmetic, particularly when converting between signed and unsigned integer types, as illustrated by the C++ string library's npos constant.

Sentinel values

The integer −1 is frequently used as a sentinel value to indicate the absence of a valid result. For example, the indexOf() method in Java and JavaScript returns −1 when a specified element or substring cannot be found. Similarly, Python's str.find() method returns −1 when a substring is absent.

Error signalling

In the C programming language and Unix-like operating systems, −1 is commonly used as a return value to indicate that a system call or library function has failed. For example, the open(), read() and write() system calls return −1 when an error occurs. Additional information about the error is generally provided through the errno variable, which identifies the particular error condition.

End-of-input signalling

In C++, the special constant EOF (end-of-file) is used to indicate that an input stream has reached its end or that an input operation has encountered an error. It is a negative integer constant, typically defined as −1, allowing it to be distinguished from valid character values, which are non-negative when represented as an unsigned char.

Unsigned integer arithmetic

In programming languages such as C and C++, converting the integer −1 to an unsigned integer type produces the maximum representable value of that type. This follows from the rules governing conversion to unsigned integer types, whereby the resulting value is obtained modulo one greater than the maximum representable value.

For an unsigned integer type capable of representing values from to , the conversion therefore produces:

For example, converting −1 to a 32-bit unsigned integer produces 4,294,967,295, while conversion to a 64-bit unsigned integer produces 18,446,744,073,709,551,615.

See also

References

Notes

  1. ↑ For example, sin−1(x) is a notation for the arcsine function.

Sources

  1. 1 2 Nathanson, Melvyn B. (2000). "Chapter 2: Congruences". Elementary Methods in Number Theory. Graduate Texts in Mathematics. Vol. 195. New York: Springer. pp. xviii, 1−514. doi:10.1007/978-0-387-22738-2_2. ISBN 978-0-387-98912-9. MR 1732941. OCLC 42061097.
  2. ↑ Bauer, Cameron (2007). "Chapter 13: Complex Numbers". Algebra for Athletes (2nd ed.). Hauppauge: Nova Science Publishers. p. 273. ISBN 978-1-60021-925-2. OCLC 957126114.
  3. ↑ Perlis, Sam (1971). "Capsule 77: Quaternions". Historical Topics in Algebra. Historical Topics for the Mathematical Classroom. Vol. 31. Reston, VA: National Council of Teachers of Mathematics. p. 39. ISBN 9780873530583. OCLC 195566.
  4. ↑ Porteous, Ian R. (1995). "Chapter 8: Quaternions". Clifford Algebras and the Classical Groups (PDF). Cambridge Studies in Advanced Mathematics. Vol. 50. Cambridge: Cambridge University Press. p. 60. doi:10.1017/CBO9780511470912.009. ISBN 9780521551779. MR 1369094. OCLC 32348823.
  5. ↑ Czapor, Stephen R.; Geddes, Keith O.; Labahn, George (1992). "Chapter 2: Algebra of Polynomials, Rational Functions, and Power Series". Algorithms for Computer Algebra (1st ed.). Boston: Kluwer Academic Publishers. pp. 41, 42. doi:10.1007/b102438. ISBN 978-0-7923-9259-0. OCLC 26212117. S2CID 964280. Zbl 0805.68072 – via Springer.
  6. ↑ The Open Group, open().
  7. 1 2 Linux man-pages, EOF(3const).
  8. ↑ cppreference.com, std::basic_string::npos.
  9. ↑ Oracle, String (Java SE API Documentation).
  10. ↑ MDN Web Docs, Array.prototype.indexOf().
  11. ↑ Python Software Foundation, Built-in Types – str.find().
  12. ↑ The Linux man-pages project, open(2).
  13. ↑ The Linux man-pages project, read(2).
  14. ↑ The Linux man-pages project, write(2).
  15. ↑ ISO/IEC 9899:2023, section 6.3.1.3, "Signed and unsigned integers".