Motivation confusion in floor and ceiling function algebra

algebra-precalculusceiling-and-floor-functions

From HMMT https://hmmt-archive.s3.amazonaws.com/tournaments/2019/nov/team/solutions.pdf:

Compute the sum of all positive real numbers $x \le 5$ satisfying $$x=\frac{\left\lceil{x^2}\right\rceil+\left\lceil x\right\rceil\cdot\left\lfloor x\right\rfloor}{\left\lceil x\right\rceil+\left\lfloor x\right\rfloor}.$$

The given solution says the following.

Note that all integer $x$ work. If $x$ is not an integer then suppose $n < x < n+ 1$. Then $x = n+\frac{k}{2n+1}$, where $n$ is an integer and $1 \le k \le 2n$ is also an integer, since the denominator of the fraction on the right hand side is $2n + 1$. We now show that all x of this form work.

Note that $$x^2=n^2+\frac{2nk}{2n+1}+\left (\frac{k}{2n+1}\right)^2=n^2+k-\frac{k}{2n+1}+\left (\frac{k}{2n+1}\right )^2.$$ For $\frac{k}{2n+1}$ between $0$ and $1$, $-\frac{k}{2n+1}+(\frac{k}{2n+1})^2$ is between $-\frac{1}{4}$ and $0$, so we have $n^2+k-1<x^2\le n^2+k$, and $\lceil x^2\rceil=n^2+k$.

Then, $$\frac{\left\lceil{x^2}\right\rceil+\left\lceil x\right\rceil\cdot\left\lfloor x\right\rfloor}{\left\lceil x\right\rceil+\left\lfloor x\right\rfloor}=\frac{n^2+k+n\cdot (n+1)}{2n+1}=n+\frac{k}{2n+1}=x,$$ so all $x$ of this form work…

To complete the solution there is more, but those parts I believe would be irrelevant to my question, although please comment to correct me if there is more context required, or click on the link, as there's only a paragraph more.

I don't understand, in the first paragraph, why $x=n+\frac{k}{2n+1}$ follows from $n < x < n+1$. More specifically, what is the motivation behind writing this? It seems that the paragraph after this claim is a proof that all $x$ of this form work, but in that proof, this fact is used. So then why do we have to "show that all $x$ of this form work", if it is used in the proof (and thus claimed without proof)?

Best Answer

Since all floors and ceilings are integral, it is clear that the right hand side is a rational number. Because $n < x < n+1$, we have $\left\lfloor{x}\right\rfloor = n$ and $\left\lceil{x}\right\rceil = n+1$. Therefore the denominator of the right hand side is $(n+1) + n = 2n+1$. By hypothesis, this equals the left hand side which is $x$. Therefore, $x$ is a rational number whose denominator is $2n+1$ (which is not necessarily in reduced form). Since $n < x < n+1$, it follows that $x = n + \frac{k}{2n+1}$ where $1 \le k \le 2n$.