Finding roots with mod and greatest integer I have to find the roots to this equation 
$$|x^2-[x]| =1$$
Where [x] is the greatest integer function and |a| is the modulus of a.
I don’t know how to go about it, hit and trial gave me nothing, help me out.
 A: $|x^2-[x]|=x^2-[x]=1\because x^2\ge[x]\forall x\in\Bbb R$
$[x]=x-\{x\}$, where $\{\cdot\}$ denotes the fractional part of $x$
$\implies x^2-x+\{x\}-1=0$
$\implies\displaystyle x=\frac{1\pm\sqrt{5-4\{x\}}}{2}$
Now, $0\le\{x\}<1\implies1<5-4\{x\}\le5\implies x\in\big(1,\frac{1+\sqrt5}2\big]\cup\big[\frac{1-\sqrt5}2,0\big)$
In $\big[\frac{1-\sqrt5}2,0\big)$, $[x]=-1\implies x^2=[x]+1=0\implies x=0\notin\big[\frac{1-\sqrt5}2,0\big)$
In $\big(1,\frac{1+\sqrt5}2\big],[x]=1\implies x^2=2\implies x=\sqrt2$
The final answer is $x=\sqrt2$.
A: Here is how I solved it:

Consider x in (k, k+1]
x = k+r
|x²-ceil(x)| = |(k+r)²-(k+1)| = 1
Case1: (k+r)²-(k+1) >= 0
|(k+r)²-(k+1)| = (k+r)²-k-1 = 1
(k²+2kr+r²)-k = 2
1r² +2kr +k²-k-2 = 0
r in (-2k +/- sqrt(4k²-4(k²-k-2))) / 2
    = -k +/- sqrt(k²-(k²-k-2))
    = -k +/- sqrt(k²-k²+k+2)
    = -k +/- sqrt(k+2)
    = {-k + sqrt(k+2), -k - sqrt(k+2)} = {r1, r2}
For real roots, k must be in {-2, -1, ...}
r must be within (0, 1]
    0 < r1:
        -k + sqrt(k+2) > 0
        sqrt(k+2) > k
        true for k <= 0, consider k > 0
        k+2 > k²
        1k² - 1k - 2 < 0
        (1 +/- sqrt(1 - 4*(-2))) / 2 = (1 +/- 3) / 2 = {-1, 2}
        k > 0 and 1k² - 1k - 2 < 0 is false for k → inf
        0 < k < 2
        k = 1
        k in {-2, -1, 0, 1}
    r1 <= 1:
        -k + sqrt(k+2) <= 1
        sqrt(k+2) <= 1+k
        false for k < -1
        k+2 <= (1+k)² = k²+2k+1
        0 <= k² + k - 1
        0 <= (-1)² + (-1) - 1 = -1, false
        0 <= (0)² + (0) - 1 = -1, false
        0 <= (1)² + (1) - 1 = 1, true
        k = 1
    r1 = -k + sqrt(k+2) = -1 + sqrt(1+2) = sqrt(3) - 1
    root candidate: 1 + r1 = 1 + sqrt(3) - 1 = sqrt(3)
    0 < r2:
        -k - sqrt(k+2) > 0
        k < -sqrt(k+2), false for k >= 0
        -1 < -sqrt(-1+2), 1 > sqrt(1), false
        -2 < -sqrt(-2+2), 2 > sqrt(0), true
        k = -2
    r2 <= 1:
        r2 = -k - sqrt(k+2) = 2 - sqrt(-2+2) = 2, false
Case2: (k+r)²-(k+1) < 0
|(k+r)²-(k+1)| = -(k+r)²+k+1 = 1
-(k²+2kr+r²)+k = 0
k²+2kr+r²-k = 0
1r² + 2kr + k²-k = 0
r in (-2k +/- sqrt(4k² - 4(k²-k))) / 2
    = -k +/- sqrt(k² - (k²-k))
    = -k +/- sqrt(k)
    = {-k - sqrt(k), -k + sqrt(k)}
For real roots, k must be in {0, 1, ...}
r must be within (0, 1]
    0 < r1 = -k - sqrt(k) is false for those k
    0 < r2:
        0 < -k + sqrt(k), k < sqrt(k), k² < k, k < 0, false
    No root candidates for Case2
The only root found is sqrt(3) when Case1 pertains, a simple test shows that
this is indeed the root:
|sqrt(3)²-ceil(sqrt(3))| = 1
|3-2| = 1
1 = 1

