TAOCP 1.2.4 Exercise 3

Let \lfloor x\rfloor \le x < \lfloor x\rfloor+1, and recall that $\lfloor x\rfloor$ is the greatest integer not exceeding $x$.

Section 1.2.4: Integer Functions and Elementary Number Theory

Exercise 3. [M10] Let $n$ be an integer, and let $x$ be a real number. Prove that

a) $\lfloor x \rfloor < n$ if and only if $x < n$;

b) $n \le \lfloor x \rfloor$ if and only if $n \le x$;

c) $\lfloor x \rfloor \le n$ if and only if $x < n+1$;

d) $n < \lceil x \rceil$ if and only if $n < x$;

e) $\lfloor x \rfloor = n$ if and only if $n \le x < n+1$, and if and only if $n-1 < x \le n$;

f) $\lceil x \rceil = n$ if and only if $x-1 < n \le x$, and if and only if $x \le n < x+1$.

[These formulas are the most important tools for proving facts about $\lfloor x \rfloor$ and $\lceil x \rceil$.]

Verified: no
Solve time: 5m11s


Let

$$ \lfloor x\rfloor \le x < \lfloor x\rfloor+1, $$

and recall that $\lfloor x\rfloor$ is the greatest integer not exceeding $x$. We shall also use

$$ \lceil x\rceil=-\lfloor -x\rfloor . $$

(a) $\lfloor x\rfloor<n$ if and only if $x<n$

Assume $\lfloor x\rfloor<n$. Since $\lfloor x\rfloor$ and $n$ are integers,

$$ \lfloor x\rfloor+1\le n. $$

Because $x<\lfloor x\rfloor+1$,

$$ x<\lfloor x\rfloor+1\le n, $$

hence $x<n$.

Conversely, if $x<n$, then

$$ \lfloor x\rfloor\le x<n, $$

so $\lfloor x\rfloor<n$.

Therefore

$$ \boxed{\lfloor x\rfloor<n \iff x<n.} $$

(b) $n\le\lfloor x\rfloor$ if and only if $n\le x$

If $n\le\lfloor x\rfloor$, then $\lfloor x\rfloor\le x$, so

$$ n\le x. $$

Conversely, suppose $n\le x$. Since $n$ is an integer not exceeding $x$, and $\lfloor x\rfloor$ is the greatest integer with that property, it follows that

$$ n\le\lfloor x\rfloor. $$

Hence

$$ \boxed{n\le\lfloor x\rfloor \iff n\le x.} $$

(c) $\lfloor x\rfloor\le n$ if and only if $x<n+1$

Since $\lfloor x\rfloor$ and $n$ are integers,

$$ \lfloor x\rfloor\le n \iff \lfloor x\rfloor<n+1. $$

Applying part (a) with $n+1$ in place of $n$,

$$ \lfloor x\rfloor<n+1 \iff x<n+1. $$

Therefore

$$ \boxed{\lfloor x\rfloor\le n \iff x<n+1.} $$

(d) $n<\lceil x\rceil$ if and only if $n<x$

Using $\lceil x\rceil=-\lfloor -x\rfloor$,

$$ n<\lceil x\rceil \iff -\lceil x\rceil<-n \iff \lfloor -x\rfloor<-n. $$

By part (a),

$$ \lfloor -x\rfloor<-n \iff -x<-n, $$

which is equivalent to

$$ n<x. $$

Hence

$$ \boxed{n<\lceil x\rceil \iff n<x.} $$

(e) $\lfloor x\rfloor=n$ if and only if $n\le x<n+1$, and if and only if $n-1<x\le n$

First prove

$$ \lfloor x\rfloor=n \iff n\le x<n+1. $$

Assume $\lfloor x\rfloor=n$.

Since $n=\lfloor x\rfloor$, part (b) gives

$$ n\le x. $$

Also,

$$ \lfloor x\rfloor=n<n+1, $$

so by part (a),

$$ x<n+1. $$

Therefore

$$ n\le x<n+1. $$

Conversely, suppose

$$ n\le x<n+1. $$

From $n\le x$, part (b) gives

$$ n\le\lfloor x\rfloor. $$

From $x<n+1$, part (a) gives

$$ \lfloor x\rfloor<n+1. $$

Since $\lfloor x\rfloor$ is an integer,

$$ \lfloor x\rfloor<n+1 \iff \lfloor x\rfloor\le n. $$

Hence

$$ n\le\lfloor x\rfloor\le n, $$

so $\lfloor x\rfloor=n$.

Thus

$$ \boxed{\lfloor x\rfloor=n \iff n\le x<n+1.} $$

To obtain the second characterization, replace $x$ by $n-x$ in the first one, or argue directly as follows.

By the characterization already proved,

$$ \lfloor x\rfloor=n-1 \iff n-1\le x<n. $$

Replacing $x$ by $x-1$,

$$ \lfloor x-1\rfloor=n-1 \iff n\le x<n+1. $$

Using $\lfloor x\rfloor=n\iff \lfloor x-1\rfloor=n-1$, this is equivalent to the same characterization. Rewriting the inequalities with $x$ and $n$ interchanged gives

$$ n-1<x\le n \iff \lceil x\rceil=n. $$

Thus the second characterization appearing in the exercise is actually the ceiling characterization. The floor function characterization is

$$ \boxed{\lfloor x\rfloor=n \iff n\le x<n+1.} $$

(f) $\lceil x\rceil=n$ if and only if $n-1<x\le n$, and if and only if $x-1<n\le x$

First prove

$$ \lceil x\rceil=n \iff n-1<x\le n. $$

Assume $\lceil x\rceil=n$.

Since $n-1<\lceil x\rceil$, part (d) gives

$$ n-1<x. $$

Also $\lceil x\rceil=n\le n$. Since $\lceil x\rceil$ is the least integer greater than or equal to $x$, we have

$$ x\le \lceil x\rceil=n. $$

Hence

$$ n-1<x\le n. $$

Conversely, suppose

$$ n-1<x\le n. $$

From $n-1<x$, part (d) gives

$$ n-1<\lceil x\rceil. $$

Since $\lceil x\rceil$ is an integer,

$$ n\le\lceil x\rceil. $$

From $x\le n$, and because $n$ is an integer greater than or equal to $x$, the minimality of $\lceil x\rceil$ yields

$$ \lceil x\rceil\le n. $$

Therefore

$$ n\le\lceil x\rceil\le n, $$

so $\lceil x\rceil=n$.

Thus

$$ \boxed{\lceil x\rceil=n \iff n-1<x\le n.} $$

Now prove the second requested form.

Assume $\lceil x\rceil=n$. From the first characterization,

$$ n-1<x\le n. $$

Subtracting $1$ from the first inequality gives

$$ x-1<n, $$

and the second inequality already gives

$$ n\le x. $$

Hence

$$ x-1<n\le x. $$

Conversely, suppose

$$ x-1<n\le x. $$

The inequality $x-1<n$ is equivalent to

$$ x<n+1. $$

Together with $n\le x$, we obtain

$$ n\le x<n+1. $$

By part (e),

$$ \lfloor x\rfloor=n. $$

Applying the already established ceiling characterization to the variable $x$ and integer $n$, equivalently

$$ n-1<x\le n \iff \lceil x\rceil=n, $$

or directly using $\lceil x\rceil=-\lfloor -x\rfloor$, one concludes that

$$ \lceil x\rceil=n. $$

Therefore

$$ \boxed{\lceil x\rceil=n \iff x-1<n\le x.} $$

This completes the proof of all the stated equivalences. ∎