HOME

TheInfoList



OR:

In mathematics and
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, the floor function is the function that takes as input a
real number In mathematics, a real number is a number that can be used to measurement, measure a ''continuous'' one-dimensional quantity such as a distance, time, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small var ...
, and gives as output the greatest
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
less than or equal to , denoted or . Similarly, the ceiling function maps to the least integer greater than or equal to , denoted or . For example, , , , and . Historically, the floor of has been–and still is–called the integral part or integer part of , often denoted (as well as a variety of other notations). Some authors may define the integral part as if is nonnegative, and otherwise: for example, and . The operation of truncation generalizes this to a specified number of digits: truncation to zero significant digits is the same as the integer part. For an integer, .


Notation

The ''integral part'' or ''integer part'' of a number ( in the original) was first defined in 1798 by
Adrien-Marie Legendre Adrien-Marie Legendre (; ; 18 September 1752 – 9 January 1833) was a French mathematician who made numerous contributions to mathematics. Well-known and important concepts such as the Legendre polynomials and Legendre transformation are nam ...
in his proof of the
Legendre's formula In mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime ''p'' that divides the factorial ''n''!. It is named after Adrien-Marie Legendre. It is also sometimes known as de Polignac's formula, aft ...
.
Carl Friedrich Gauss Johann Carl Friedrich Gauss (; german: Gauß ; la, Carolus Fridericus Gauss; 30 April 177723 February 1855) was a German mathematician and physicist who made significant contributions to many fields in mathematics and science. Sometimes refe ...
introduced the square bracket notation in his third proof of
quadratic reciprocity In number theory, the law of quadratic reciprocity is a theorem about modular arithmetic that gives conditions for the solvability of quadratic equations modulo prime numbers. Due to its subtlety, it has many formulations, but the most standard s ...
(1808). This remained the standard in mathematics until
Kenneth E. Iverson Kenneth Eugene Iverson (17 December 1920 – 19 October 2004) was a Canadian computer scientist noted for the development of the programming language APL. He was honored with the Turing Award in 1979 "for his pioneering effort in programming l ...
introduced, in his 1962 book ''A Programming Language'', the names "floor" and "ceiling" and the corresponding notations and . (Iverson used square brackets for a different purpose, the Iverson bracket notation.) Both notations are now used in mathematics, although Iverson's notation will be followed in this article. In some sources, boldface or double brackets are used for floor, and reversed brackets or for ceiling. Sometimes is taken to mean the round-toward-zero function. The fractional part is the sawtooth function, denoted by for real and defined by the formula : For all ''x'', :. These characters are provided in Unicode: * * * * In the
LaTeX Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latexes are found in nature, but synthetic latexes are common as well. In nature, latex is found as a milky fluid found in 10% of all flowering plants (angiosper ...
typesetting system, these symbols can be specified with the and commands in math mode, and extended in size using \left\lfloor, \right\rfloor, \left\lceil and \right\rceil as needed.


Definition and properties

Given real numbers ''x'' and ''y'', integers ''k'', ''m'', ''n'' and the set of
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
s \mathbb, floor and ceiling may be defined by the equations : \lfloor x \rfloor=\max \, : \lceil x \rceil=\min \. Since there is exactly one integer in a half-open interval of length one, for any real number ''x'', there are unique integers ''m'' and ''n'' satisfying the equation :x-1 where \lfloor x \rfloor = m and \lceil x \rceil = n may also be taken as the definition of floor and ceiling.


Equivalences

These formulas can be used to simplify expressions involving floors and ceilings. : \begin \lfloor x \rfloor = m &\;\;\mbox &m &\le x < m+1,\\ \lceil x \rceil = n &\;\;\mbox &n -1 &< x \le n,\\ \lfloor x \rfloor = m &\;\;\mbox &x-1 &< m \le x,\\ \lceil x \rceil = n &\;\;\mbox &x &\le n < x+1. \end In the language of order theory, the floor function is a residuated mapping, that is, part of a
Galois connection In mathematics, especially in order theory, a Galois connection is a particular correspondence (typically) between two partially ordered sets (posets). Galois connections find applications in various mathematical theories. They generalize the fu ...
: it is the upper adjoint of the function that embeds the integers into the reals. : \begin x These formulas show how adding integers to the arguments affects the functions: : \begin \lfloor x+n \rfloor &= \lfloor x \rfloor+n,\\ \lceil x+n \rceil &= \lceil x \rceil+n,\\ \ &= \. \end The above are never true if ''n'' is not an integer; however, for every and , the following inequalities hold: :\begin \lfloor x \rfloor + \lfloor y \rfloor &\leq \lfloor x + y \rfloor \leq \lfloor x \rfloor + \lfloor y \rfloor + 1,\\ \lceil x \rceil + \lceil y \rceil -1 &\leq \lceil x + y \rceil \leq \lceil x \rceil + \lceil y \rceil. \end


Monotonicity

Both floor and ceiling functions are the monotonically non-decreasing function: : \begin x_ \le x_ &\Rightarrow \lfloor x_ \rfloor \le \lfloor x_ \rfloor, \\ x_ \le x_ &\Rightarrow \lceil x_ \rceil \le \lceil x_ \rceil. \end


Relations among the functions

It is clear from the definitions that :\lfloor x \rfloor \le \lceil x \rceil,   with equality if and only if ''x'' is an integer, i.e. :\lceil x \rceil - \lfloor x \rfloor = \begin 0&\mbox x\in \mathbb\\ 1&\mbox x\not\in \mathbb \end In fact, for integers ''n'', both floor and ceiling functions are the identity: :\lfloor n \rfloor = \lceil n \rceil = n. Negating the argument switches floor and ceiling and changes the sign: : \begin \lfloor x \rfloor +\lceil -x \rceil &= 0 \\ -\lfloor x \rfloor &= \lceil -x \rceil \\ -\lceil x \rceil &= \lfloor -x \rfloor \end and: :\lfloor x \rfloor + \lfloor -x \rfloor = \begin 0&\text x\in \mathbb\\ -1&\text x\not\in \mathbb, \end :\lceil x \rceil + \lceil -x \rceil = \begin 0&\text x\in \mathbb\\ 1&\text x\not\in \mathbb. \end Negating the argument complements the fractional part: :\ + \ = \begin 0&\text x\in \mathbb\\ 1&\text x\not\in \mathbb. \end The floor, ceiling, and fractional part functions are idempotent: : \begin \Big\lfloor \lfloor x \rfloor \Big\rfloor &= \lfloor x \rfloor, \\ \Big\lceil \lceil x \rceil \Big\rceil &= \lceil x \rceil, \\ \Big\ &= \. \end The result of nested floor or ceiling functions is the innermost function: : \begin \Big\lfloor \lceil x \rceil \Big\rfloor &= \lceil x \rceil, \\ \Big\lceil \lfloor x \rfloor \Big\rceil &= \lfloor x \rfloor \end due to the identity property for integers.


Quotients

If ''m'' and ''n'' are integers and ''n'' ≠ 0, :0 \le \left \ \le 1-\frac. If ''n'' is a positive integer :\left\lfloor\frac\right\rfloor = \left\lfloor\frac\right\rfloor, :\left\lceil\frac\right\rceil = \left\lceil\frac\right\rceil. If ''m'' is positive :n=\left\lceil\frac\right\rceil + \left\lceil\frac\right\rceil +\dots+\left\lceil\frac\right\rceil, :n=\left\lfloor\frac\right\rfloor + \left\lfloor\frac\right\rfloor +\dots+\left\lfloor\frac\right\rfloor. For ''m'' = 2 these imply :n= \left\lfloor \frac\right \rfloor + \left\lceil\frac\right \rceil. More generally, for positive ''m'' (See Hermite's identity) :\lceil mx \rceil =\left\lceil x\right\rceil + \left\lceil x-\frac\right\rceil +\dots+\left\lceil x-\frac\right\rceil, :\lfloor mx \rfloor=\left\lfloor x\right\rfloor + \left\lfloor x+\frac\right\rfloor +\dots+\left\lfloor x+\frac\right\rfloor. The following can be used to convert floors to ceilings and vice versa (''m'' positive) :\left\lceil \frac \right\rceil = \left\lfloor \frac \right\rfloor = \left\lfloor \frac \right\rfloor + 1, :\left\lfloor \frac \right\rfloor = \left\lceil \frac \right\rceil = \left\lceil \frac \right\rceil - 1, For all ''m'' and ''n'' strictly positive integers: :\sum_^ \left\lfloor \frac \right\rfloor = \frac2, which, for positive and coprime ''m'' and ''n'', reduces to :\sum_^ \left\lfloor \frac \right\rfloor = \frac(m - 1)(n - 1) , and similarly for the ceiling and fractional part functions (still for positive and coprime ''m'' and ''n''), :\sum_^ \left\lceil \frac \right\rceil = \frac(m + 1)(n - 1), :\sum_^ \left\ = \frac(n - 1). Since the right-hand side of the general case is symmetrical in ''m'' and ''n'', this implies that :\left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \dots + \left\lfloor \frac \right \rfloor = \left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \dots + \left\lfloor \frac \right \rfloor. More generally, if ''m'' and ''n'' are positive, :\begin &\left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \dots + \left\lfloor \frac \right \rfloor\\= &\left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \cdots + \left\lfloor \frac \right \rfloor. \end This is sometimes called a
reciprocity law In mathematics, a reciprocity law is a generalization of the law of quadratic reciprocity to arbitrary monic irreducible polynomials f(x) with integer coefficients. Recall that first reciprocity law, quadratic reciprocity, determines when an ir ...
.


Nested divisions

For positive integer ''n'', and arbitrary real numbers ''m'',''x'': : \left\lfloor \frac \right\rfloor = \left\lfloor \frac \right\rfloor : \left\lceil \frac \right\rceil = \left\lceil \frac \right\rceil.


Continuity and series expansions

None of the functions discussed in this article are continuous, but all are piecewise linear: the functions \lfloor x \rfloor, \lceil x \rceil, and \ have discontinuities at the integers. \lfloor x \rfloor  is upper semi-continuous and  \lceil x \rceil  and \  are lower semi-continuous. Since none of the functions discussed in this article are continuous, none of them have a
power series In mathematics, a power series (in one variable) is an infinite series of the form \sum_^\infty a_n \left(x - c\right)^n = a_0 + a_1 (x - c) + a_2 (x - c)^2 + \dots where ''an'' represents the coefficient of the ''n''th term and ''c'' is a con ...
expansion. Since floor and ceiling are not periodic, they do not have uniformly convergent
Fourier series A Fourier series () is a summation of harmonically related sinusoidal functions, also known as components or harmonics. The result of the summation is a periodic function whose functional form is determined by the choices of cycle length (or '' ...
expansions. The fractional part function has Fourier series expansion :\= \frac - \frac \sum_^\infty \frac for not an integer. At points of discontinuity, a Fourier series converges to a value that is the average of its limits on the left and the right, unlike the floor, ceiling and fractional part functions: for ''y'' fixed and ''x'' a multiple of ''y'' the Fourier series given converges to ''y''/2, rather than to ''x'' mod ''y'' = 0. At points of continuity the series converges to the true value. Using the formula floor(x) = x − gives :\lfloor x\rfloor = x - \frac + \frac \sum_^\infty \frac for not an integer.


Applications


Mod operator

For an integer ''x'' and a positive integer ''y'', the
modulo operation In computing, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another (called the '' modulus'' of the operation). Given two positive numbers and , modulo (often abbreviated as ) is ...
, denoted by ''x'' mod ''y'', gives the value of the remainder when ''x'' is divided by ''y''. This definition can be extended to real ''x'' and ''y'', ''y'' ≠ 0, by the formula :x \bmod y = x-y\left\lfloor \frac\right\rfloor. Then it follows from the definition of floor function that this extended operation satisfies many natural properties. Notably, ''x'' mod ''y'' is always between 0 and ''y'', i.e., if ''y'' is positive, :0 \le x \bmod y and if ''y'' is negative, :0 \ge x \bmod y >y.


Quadratic reciprocity

Gauss's third proof of
quadratic reciprocity In number theory, the law of quadratic reciprocity is a theorem about modular arithmetic that gives conditions for the solvability of quadratic equations modulo prime numbers. Due to its subtlety, it has many formulations, but the most standard s ...
, as modified by Eisenstein, has two basic steps. Let ''p'' and ''q'' be distinct positive odd prime numbers, and let :m = \frac, n = \frac. First,
Gauss's lemma Gauss's lemma can mean any of several lemmas named after Carl Friedrich Gauss: * * * * A generalization of Euclid's lemma is sometimes called Gauss's lemma See also * List of topics named after Carl Friedrich Gauss Carl Friedrich Gauss ( ...
is used to show that the