09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Home of the<br />

Toledo Mudhens.<br />

(Or, by pessimists,<br />

half-closed.)<br />

3.2 FLOOR/CEILING APPLICATIONS 73<br />

Level 5. Given an explicit set X, find an interesting property P(x) of its<br />

elements. Now we’re in the scary domain of pure research, where students<br />

might think that total chaos reigns. This is real <strong>mathematics</strong>. Authors of<br />

textbooks rarely dare to ask level 5 questions.<br />

End of digression. But let’s convert our last question from level 3 to<br />

level 4: What is a necessary and sufficient condition that [JLT;Jl = [fil?<br />

We have observed that equality holds when x = 3.142 but not when x = 1.618;<br />

further experimentation shows that it fails also when x is between 9 and 10.<br />

Oho. Yes. We see that bad cases occur whenever m2 < x < m2 + 1, since this<br />

gives m on the left and m + 1 on the right. In all other cases where J;; is<br />

defined, namely when x = 0 or m2 + 1 6 x 6 (m + 1 )2, we get equality. The<br />

following statement is there<strong>for</strong>e necessary and sufficient <strong>for</strong> equality: Either<br />

x is an integer or m isn’t.<br />

For our next problem let’s consider a handy new notation, suggested<br />

by C. A. R. Hoare and Lyle Ramshaw, <strong>for</strong> intervals of the real line: [01. 61<br />

denotes the set of real numbers x such that OL < x 6 (3. This set is called<br />

a closed interval because it contains both endpoints o( and (3. The interval<br />

containing neither endpoint, denoted by (01. , (3), consists of all x such that<br />

(x < x < (3; this is called an open interval. And the intervals [a.. (3) and<br />

(a. . (31, which contain just one endpoint, are defined similarly and called<br />

half- open.<br />

How many integers are contained in such intervals? The half-open intervals<br />

are easier, so we start with them. In fact half-open intervals are almost<br />

always nicer than open or closed intervals. For example, they’re additive-we<br />

can combine the half-open intervals [K. . (3) and [(3 . . y) to <strong>for</strong>m the half-open<br />

interval [a. . y). This wouldn’t work with open intervals because the point (3<br />

would be excluded, and it could cause problems with closed intervals because<br />

(3 would be included twice.<br />

Back to our problem. The answer is easy if 01 and (3 are integers: Then<br />

[(x..(3) containsthe (?-olintegers 01, o~+l, . . . . S-1, assuming that 016 6.<br />

Similarly ( 0~. . (31 contains (3 - 01 integers in such a case. But our problem is<br />

harder, because 01 and (3 are arbitrary reals. We can convert it to the easier<br />

problem, though, since<br />

when n is an integer, according to (3.7). The intervals on the right have<br />

integer endpoints and contain the same number of integers as those on the left,<br />

which have real endpoints. So the interval [oL.. b) contains exactly [rjl - 1~1<br />

integers, and (0~. . (31 contains [(3] - La]. This is a case where we actually<br />

want to introduce floor or ceiling brackets, instead of getting rid of them.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!