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?
 A: The way I would approach it is to first observe that the zeroes of $y^2-3 y+2$ are at $y=1$ and $y=2$.  Because these zeroes are integers, then $x=1$ and $x=2$ are part of the solution set.
To get the rest of the solution set, we must find all other $x$ near these zeroes that do not change the values of either $\lfloor x \rfloor$ or $\lfloor x^2 \rfloor$.  Near $x=1$, this is when $x \in \left (1,\sqrt{2}\right)$; near $x=2$, we have $x \in \left (2,\sqrt{5} \right )$.
A: 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)$.
A: If $x$ is positive, then it must be at most $4,$ so $\lfloor x \rfloor$ is at most $3.$ If $\lfloor x \rfloor = 0,$ then your equation is $x^2 - 3 x +2 = 0,$ so $(x-1)(x-2) = 0,$ so no solutions. If $\lfloor x \rfloor = 1,$ then if $y$ is the fractional part of $x,$ we have:
$\lfloor (y+1)^2 \rfloor - 1 = 0,$ so $\lfloor (y+1)^2 \rfloor = 1$, so any $y < \sqrt{2} - 1$ works. If $\lfloor x \rfloor = 2,$ then $\lfloor (y+2)^2\rfloor = 4,$ so any $y < \sqrt{5} - 1$ works. You get the picture.
A: Note that if $x\lt0$, then $\lfloor x^2\rfloor-3\lfloor x\rfloor+2\ge5$, so any solution $x=n+f$ with $0\le f\lt1$ must have $n\ge0$.  Picking up at the OP's equation $n^2+\lfloor f^2+2nf\rfloor-3n+2=0$ and letting $r$ denote the non-negative integer $\lfloor f^2+2nf\rfloor$, we find
$$(2n-3)^2=1-4r$$
Thus $r$ must be $0$, which implies $(2n-3)^2=1$, so that $n=1$ or $2$.
If $n=1$, then $r=0$ means $f^2+2f\lt1$, or $(f+1)^2\lt2$, and thus $0\le f\lt\sqrt2-1$, so that $1\le x\lt\sqrt2$.
If $n=2$, then $r=0$ means $f^2+4f\lt1$, or $(f+2)^2\lt5$, and thus $0\le f\lt\sqrt5-2$, so that $2\le x\lt\sqrt5$.
