Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Floor and ceiling functions
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Quotients=== If ''m'' and ''n'' are integers and ''n'' β 0, :<math>0 \le \left\{ \frac{m}{n} \right\} \le 1-\frac{1}{|n|}.</math> If ''n'' is positive<ref>Graham, Knuth, & Patashnik, p. 73</ref> :<math>\left\lfloor\frac{x+m}{n}\right\rfloor = \left\lfloor\frac{\lfloor x\rfloor +m}{n}\right\rfloor, </math> :<math>\left\lceil\frac{x+m}{n}\right\rceil = \left\lceil\frac{\lceil x\rceil +m}{n}\right\rceil. </math> If ''m'' is positive<ref>Graham, Knuth, & Patashnik, p. 85</ref> :<math>n=\left\lceil\frac{n\vphantom1}{m}\right\rceil + \left\lceil\frac{n-1}{m}\right\rceil +\dots+\left\lceil\frac{n-m+1}{m}\right\rceil, </math> :<math>n=\left\lfloor\frac{n\vphantom1}{m}\right\rfloor + \left\lfloor\frac{n+1}{m}\right\rfloor +\dots+\left\lfloor\frac{n+m-1}{m}\right\rfloor. </math> For ''m'' = 2 these imply :<math>n= \left\lfloor \frac{n\vphantom1}{2}\right \rfloor + \left\lceil\frac{n\vphantom1}{2}\right \rceil.</math> More generally,<ref>Graham, Knuth, & Patashnik, p. 85 and Ex. 3.15</ref> for positive ''m'' (See [[Hermite's identity]]) :<math>\lceil mx \rceil =\left\lceil x\right\rceil + \left\lceil x-\frac{1}{m}\right\rceil +\dots+\left\lceil x-\frac{m-1}{m}\right\rceil, </math> :<math>\lfloor mx \rfloor=\left\lfloor x\right\rfloor + \left\lfloor x+\frac{1}{m}\right\rfloor +\dots+\left\lfloor x+\frac{m-1}{m}\right\rfloor. </math> The following can be used to convert floors to ceilings and vice versa (with ''m'' being positive)<ref>Graham, Knuth, & Patashnik, Ex. 3.12</ref> :<math>\left\lceil \frac{n\vphantom1}{m} \right\rceil = \left\lfloor \frac{n+m-1}{m} \right\rfloor = \left\lfloor \frac{n - 1}{m} \right\rfloor + 1, </math> :<math>\left\lfloor \frac{n\vphantom1}{m} \right\rfloor = \left\lceil \frac{n-m+1}{m} \right\rceil = \left\lceil \frac{n + 1}{m} \right\rceil - 1, </math> For all ''m'' and ''n'' strictly positive integers:<ref>Graham, Knuth, & Patashnik, p. 94.</ref> :<math>\sum_{k = 1}^{n - 1} \left\lfloor \frac{k m}{n} \right\rfloor = \frac{(m - 1)(n - 1)+\gcd(m,n)-1}2,</math> which, for positive and [[coprime]] ''m'' and ''n'', reduces to :<math>\sum_{k=1}^{n-1} \left\lfloor \frac{km}{n} \right\rfloor = \tfrac{1}{2}(m - 1)(n - 1) ,</math> and similarly for the ceiling and fractional part functions (still for positive and [[coprime]] ''m'' and ''n''), :<math>\sum_{k=1}^{n-1} \left\lceil \frac{km}{n} \right\rceil = \tfrac{1}{2}(m + 1)(n - 1),</math> :<math>\sum_{k=1}^{n-1} \left\{ \frac{km}{n} \right\} = \tfrac{1}{2}(n - 1).</math> Since the right-hand side of the general case is symmetrical in ''m'' and ''n'', this implies that :<math>\left\lfloor \frac{m\vphantom1}{n} \right \rfloor + \left\lfloor \frac{2m}{n} \right \rfloor + \dots + \left\lfloor \frac{(n-1)m}{n} \right \rfloor = \left\lfloor \frac{n\vphantom1}{m} \right \rfloor + \left\lfloor \frac{2n}{m} \right \rfloor + \dots + \left\lfloor \frac{(m-1)n}{m} \right \rfloor. </math> More generally, if ''m'' and ''n'' are positive, :<math>\begin{align} &\left\lfloor \frac{x\vphantom1}{n} \right \rfloor + \left\lfloor \frac{m+x}{n} \right \rfloor + \left\lfloor \frac{2m+x}{n} \right \rfloor + \dots + \left\lfloor \frac{(n-1)m+x}{n} \right \rfloor\\[5mu] = &\left\lfloor \frac{x\vphantom1}{m} \right \rfloor + \left\lfloor \frac{n+x}{m} \right \rfloor + \left\lfloor \frac{2n+x}{m} \right \rfloor + \cdots + \left\lfloor \frac{(m-1)n+x}{m} \right \rfloor. \end{align} </math> This is sometimes called a [[#Quadratic reciprocity|reciprocity law]].<ref>Graham, Knuth, & Patashnik, p. 94</ref> Division by positive integers gives rise to an interesting and sometimes useful property. Assuming <math>m,n >0</math>, :<math> m \leq \left\lfloor \frac{x}{n} \right \rfloor \iff n \leq \left\lfloor \frac{x}{m} \right \rfloor \iff n \leq \frac{ \lfloor x \rfloor }{m}. </math> Similarly, :<math> m \geq \left\lceil \frac{x}{n} \right \rceil \iff n \geq \left\lceil \frac{x}{m} \right \rceil \iff n \geq \frac{ \lceil x \rceil }{m}. </math> Indeed, :<math> m \leq \left\lfloor \frac{x}{n} \right \rfloor \implies m \leq \frac{x}{n} \implies n \leq \frac{x}{m} \implies n \leq \left \lfloor \frac{x}{m}\right \rfloor \implies \ldots \implies m \leq \left\lfloor \frac{x}{n} \right \rfloor,</math> keeping in mind that <math display=inline> \left\lfloor \frac{x}{n} \right\rfloor = \left\lfloor \frac{\lfloor x \rfloor}{n} \right\rfloor.</math> The second equivalence involving the ceiling function can be proved similarly.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)