TITLE: Finding the values of $x$ such that $[x^2]=[x]^2$ ($[\cdot]$ denotes the floor function)
QUESTION [6 upvotes]: I was trying to find the values of $x$ that makes the equation $[x^2]=[x]^2$ true where $[\cdot]$ denotes the floor function. I tried doing the following:
Let $x=n+r$ where $n=[x]$ and $0\leq\ r<1$. Then $x^2=n^2+2nr+r^2$ which implies that $[x^2]=[n^2+2nr+r^2]=n^2+[2nr+r^2]=[x]^2=n^2$. Subtracting both sides of the equation by $n^2$ I obtained $[2nr+r^2]=0$ if and only if $0\leq\ 2nr+r^2<1$. I got stucked in here. Any suggestions or hints that can you give me?

REPLY [8 votes]: Write $x=n+r$, where $n\in\mathbb{Z}$ and $0\le r\lt1$. Then we want
$$
\left\lfloor n^2+2nr+r^2\right\rfloor=\left\lfloor(n+r)^2\right\rfloor=\lfloor n+r\rfloor^2=n^2\tag1
$$
If $r=0$, then $(1)$ is true. Thus, we have any $x\in\mathbb{Z}$ is a solution.
Now, assume $0\lt r\lt1$. $(1)$ requires
$$
0\le2nr+r^2\lt1\tag2
$$
To satisfy the left-hand inequality of $(2)$, we need
$$
2n+r\ge0\tag3
$$
So we need $n\ge0$. To satisfy the right-hand inequality of $(2)$, we need
$$
0\lt r\lt-n+\sqrt{n^2+1}\tag4
$$
which is equivalent to
$$
n\lt x\lt\sqrt{n^2+1}\tag5
$$
Therefore, we get the complete solution set to be
$$
x\in\mathbb{Z}\cup\bigcup_{n=0}^\infty\left(n,\sqrt{n^2+1}\right)\tag6
$$