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-4

Exercise 1.2.4-4

proved in Lean solution written

RatingM10
MarkersM (mathematical), recommended
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory

The task

Prove ⌊−x⌋=−⌈x⌉\lfloor -x \rfloor = -\lceil x \rceil for every real xx, with the equivalences of Exercise 1.2.4-3.

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

Compare the two integers by the set of integers that are at most each of them.

Hint 2

Use 1.2.4-3(b) for ⌊−x⌋\lfloor -x \rfloor. For ⌈x⌉\lceil x \rceil use the negation of 1.2.4-3(d).

Solution

Show the solution

Let nn be any integer. Then

n≤⌊−x⌋  ⟺  n≤−x  ⟺  x≤−n  ⟺  ⌈x⌉≤−n  ⟺  n≤−⌈x⌉.n \le \lfloor -x \rfloor \iff n \le -x \iff x \le -n \iff \lceil x \rceil \le -n \iff n \le -\lceil x \rceil.

The first step is 1.2.4-3(b) for −x-x. The second step multiplies by −1-1. The third step is the negation of 1.2.4-3(d): ⌈x⌉≤m\lceil x \rceil \le m if and only if x≤mx \le m, here with m=−nm = -n. The last step multiplies by −1-1.

So exactly the same integers nn lie at or below ⌊−x⌋\lfloor -x \rfloor and at or below −⌈x⌉-\lceil x \rceil. Put n=⌊−x⌋n = \lfloor -x \rfloor to get ⌊−x⌋≤−⌈x⌉\lfloor -x \rfloor \le -\lceil x \rceil. Put n=−⌈x⌉n = -\lceil x \rceil to get −⌈x⌉≤⌊−x⌋-\lceil x \rceil \le \lfloor -x \rfloor. Hence they are equal. □\square

Check

For x=2.3x = 2.3: ⌊−2.3⌋=−3\lfloor -2.3 \rfloor = -3 and −⌈2.3⌉=−3-\lceil 2.3 \rceil = -3. For x=−2.3x = -2.3: ⌊2.3⌋=2\lfloor 2.3 \rfloor = 2 and −⌈−2.3⌉=2-\lceil -2.3 \rceil = 2. For x=4x = 4: both sides are −4-4.

Remarks

The identity also gives ⌈−x⌉=−⌊x⌋\lceil -x \rceil = -\lfloor x \rfloor (replace xx by −x-x and negate). It turns each statement about ceilings into one about floors, as in Exercise 1.2.4-7.

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.