[Math] The floor and ceiling functions are equal for integer numbers

ceiling-and-floor-functionsreal-analysis

The exercise

Proof the following directly: Let $x \in \mathbb{R}$. If $x \in \mathbb{Z}$, then $\lfloor x \rfloor = \lceil x \rceil$.

My problem

I mostly fail completely on the formal part of any kind of proof (here a direct proof). This means I've mostly the right idea but I'm also mostly not able to bring it to paper in the right form.

What I know currently

The direct proof for a implication like $p \implies q$ could be $p \implies s_1, s_1 \implies s_2, s_2 \implies q$. So you typically start with the (rearranged) hypothesis $q$ assuming it's true and repeatedly apply the modus ponsens on your established implications until you reach $q$.

What I've done

When I take a look at the definition of $\lfloor x \rfloor = \max\{k \in \mathbb{Z}|k\leq x\}$ and $\lceil x \rceil = \min\{k \in \mathbb{Z}|k\geq x\}$ it seems to be "pretty clear". Since $x,k \in \mathbb{Z}$ is $x \in \{k \leq x\}$ and $x = \max\{k \leq x\}$ which in turn implies $\lfloor x \rfloor = x$. The same is true for $\lceil x \rceil$, which means that $x \in \{k \geq x\}$ and $x = \min\{k \geq x\}$ which in turn implies $\lfloor x \rfloor = x$. And since $\lfloor x \rfloor = x$ and $\lfloor x \rfloor = x$ is $\lfloor x \rfloor = \lceil x \rceil$.

My question(s)

How can I get this in a formally correct form? And how can I proof that $x \in \{k \leq x\}$, $x = \max\{k \leq x\}$, $x \in \{k \geq x\}$ and $x = \min\{k \geq x\}$ is true?

Best Answer

That $x \in \{ k \leq x\}$ follows since $x \leq x$. Similarly for $x \in \{ k \geq x\}$. To show that $x = max\{ k \leq x\}$, suppose not. Then there is some $y \in \{ k \leq x\}$ such that $y > x$. But this is impossible, by the definition of the set $\{ k \leq x\}$. So $x$ must be the supremum. But $x$ is also in the set, so it's the maximum. You should be able to do the minimum case now.

I guess at the beginning, the more (without exaggerating!) details you put the better. For example, your proof is fine, but I'd put sentences of the form "x = max{...} since x is the supremum and it's in the set...", just to show that you understand why what you claim is true.