taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.4-2

Exercise 1.2.4-2

proved in Lean solution written

Rating01
Markersrecommended
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory

The task

Simplify ⌈⌊x⌋⌉\lceil \lfloor x \rfloor \rceil for a real xx.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

The number ⌊x⌋\lfloor x \rfloor is already an integer. What is the ceiling of an integer?

Solution

Show the solution

Let n=⌊x⌋n = \lfloor x \rfloor. This is an integer. The least integer that is at least nn is nn itself, since n≥nn \ge n and every smaller integer is below nn. So ⌈⌊x⌋⌉=⌊x⌋\lceil \lfloor x \rfloor \rceil = \lfloor x \rfloor.

The same argument shows ⌊⌈x⌉⌋=⌈x⌉\lfloor \lceil x \rceil \rfloor = \lceil x \rceil and ⌊⌊x⌋⌋=⌊x⌋\lfloor \lfloor x \rfloor \rfloor = \lfloor x \rfloor.

Check

Take x=2.7x = 2.7: ⌊x⌋=2\lfloor x \rfloor = 2 and ⌈2⌉=2\lceil 2 \rceil = 2. Take x=−2.7x = -2.7: ⌊x⌋=−3\lfloor x \rfloor = -3 and ⌈−3⌉=−3\lceil -3 \rceil = -3.

Remarks

The result says that the floor and the ceiling are idempotent: applying either of them twice changes nothing.

This solution is checked, and a person has not reviewed it yet. The source.

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.