<s>[INST] Solve the equation $\lfloor x^2\rfloor-3\lfloor x \rfloor +2=0$ 
Solve the equation
$$
\lfloor x^2\rfloor-3\lfloor x \rfloor +2=0
$$
where $\lfloor x\rfloor $ denotes floor function.

My Attempt:
Let $x = n+f$, where $n= \lfloor x \rfloor \in \mathbb{Z} $, $f=x-\lfloor x \rfloor = \{x\} $, and $0\leq f<1$. Then using $\lfloor n+f \rfloor = n$ gives us
$$
\begin{align}
\lfloor (n+f)^2 \rfloor -3 \lfloor n+f \rfloor +2 &= 0\\
n^2+\lfloor f^2+2nf \rfloor -3n+2 &= 0
\end{align}
$$
How can I solve the equation from here?
 [/INST] First note that $\lfloor x^2 \rfloor \ge \lfloor x \rfloor ^2$. Now, if we let $y = \lfloor x \rfloor$, then $y^2 -3y+2 \le 0$ and $y $ is an integer, so $y=1$, or $2$.
Then, let $x = y+f$, with $f \in (0,1)$. If $y=1$, then
$$\lfloor2f+f^2\rfloor = 0 \iff 2f+f^2 <1 \iff f < \sqrt{2}-1$$
If $y=2$, then
$$\lfloor4f+f^2\rfloor = 0 \iff 4f+f^2 <1 \iff f < \sqrt{5}-2$$
So the solutions for $x$ comprise exactly the set $[1,\sqrt2) \cup [2,\sqrt 5)$.
</s>