# How to solve $\left \lfloor x^2 - x - 2 \right \rfloor = \left \lfloor x \right \rfloor$

I need some help to solve the next equation: $$\left \lfloor x^2 - x - 2 \right \rfloor = \left \lfloor x \right \rfloor$$

Where $\left \lfloor \cdot \right \rfloor$ is the floor function.

What I've tried: $$x^2 - x - 2 - x < 1$$ $$x^2 - x - 2 \leq x < x^2 - x - 1$$

When I try to solve this system, I don't get the right solution. Is it right what I'm doing? How can I do to solve this?

• Hints: $x^2-x-2=(x-1/2)^2-\dots$. Draw the graphs of these functions. Jan 4, 2015 at 23:24
• I wanted to know the exact solution, not just a guess from the graph... Jan 4, 2015 at 23:30
• It's math.SE policy to require that you give more context and/or show some of your work when asking questions. What have you tried? Did any of the help you got on your last question give you ideas for this one?
– aes
Jan 4, 2015 at 23:32
• A "guess from the graph" will tell you what region the floors are in, permitting you to solve the equation algebraically and get the exact answer. Jan 4, 2015 at 23:37
• See useful techniques. Jan 5, 2015 at 0:15

Your system of equations isn't quite right (for example, $x$ may be the smaller of the two).

To solve $\lfloor f(x) \rfloor = \lfloor x \rfloor$ write $x = n + \epsilon$ where $0\leq \epsilon <1$ and $n$ is an integer so that $\lfloor x\rfloor = n$.

Then the condition $\lfloor f(x)\rfloor = n$ is $n \leq f(n+\epsilon) < n+1$ (and the above conditions on $n$ and $\epsilon$).

$$\left \lfloor x^2 - x - 2 \right \rfloor = \left \lfloor x \right \rfloor \tag{1.}$$

$$\left \lfloor y \right \rfloor = \left \lfloor x \right \rfloor \iff 0 \le y-x < 1$$ or $$-1 \lt y-x \le 0$$

The proof follows from the observation that, for any integer n, $$n \le x \le y < n+1 \iff n-x \le 0 \le y-x < 1$$

Lets let $$y = x^2-x-2$$. One case where $$(1.)$$ must be true is when

\begin{align} y &= x \\ x^2-x-2 &= x \\ x^2-2x-2 &= 0 \\ x &= 1 \pm \sqrt 3 \end{align}

In this case, $$\left \lfloor y \right \rfloor=\left \lfloor x \right \rfloor = -1$$ or $$\left \lfloor y \right \rfloor =\left \lfloor x \right \rfloor = 2$$.

Note that $$y-x = x^2-2x-2$$ is a decreasing function for $$x \in (-\infty, -1]$$ and an increasing function for $$x \in [-1,-\infty)$$. Note also that $$y-x = (x-1)^2 - 3$$ and $$x-y = 3-(x-1)^2$$

We consider four cases.

1. If $$x \lt -1$$, then $$y-x \gt 1$$.
2. If $$0\le x \le 1$$, then $$-2 \ge y-x \ge -3$$.
3. If $$1\le x \le 2$$, then $$-3 \le y-x \le -2$$.
4. If $$x \gt 3$$, then $$y-x \gt 1$$.

In all four cases, $$\left \lfloor x^2 - x - 2 \right \rfloor \ne \left \lfloor x \right \rfloor$$ That leaves us with two possibilities.

If $$\left \lfloor x \right \rfloor=\left \lfloor y \right \rfloor = -1$$, then the possible values for $$x$$ are $$x=-1 + h$$ where $$0 \le h < 1$$.

Then we need to solve

$$\begin{array}{c} && \left \lfloor x^2 - x - 2 \right \rfloor &= &\left \lfloor x \right \rfloor \\ && \left \lfloor h^2-3h \right \rfloor &=& -1 \\ && \left \lfloor-1+(h^2-3h+1) \right \rfloor &=& -1 \\ 0 &\le &h^2-3h+1 &<& 1 \\ -1 &\le &h^2-3h &<& 0 \\ \dfrac 54 &\le &h^2-3h+\dfrac 94 &<& \dfrac{9}{4} \\ \dfrac 54 &\le &\left(h-\dfrac 32\right)^2 &<& \dfrac{9}{4} \\ \dfrac{\sqrt 5}{2} &\le &\dfrac 32 - h &<& \dfrac 32 \\ \dfrac{\sqrt 5-3}{2} &\le& -h &<& 0 \\ 0 &<& h &\le& \dfrac{3 - \sqrt 5}{2} \\ -1 &<& x &\le& -1 + \dfrac{3 - \sqrt 5}{2}\\ -1 &<& x &\le& \dfrac{1 - \sqrt 5}{2}\\ \end{array}$$

If $$\left \lfloor x \right \rfloor=\left \lfloor y \right \rfloor = 2$$, then the possible values for $$x$$ are $$x=2 + h$$ where $$0 \le h < 1$$.

$$\begin{array}{c} && \left \lfloor x^2 - x - 2 \right \rfloor &= &\left \lfloor x \right \rfloor \\ && \left \lfloor h^2+3h \right \rfloor &=& 2 \\ && \left \lfloor 2+(h^2+3h-2) \right \rfloor &=& 2 \\ 0 &\le &h^2+3h-2 &<& 1 \\ 2 &\le &h^2+3h &<& 3 \\ \dfrac{17}{4} &\le &h^2+3h+\dfrac 94 &<& \dfrac{21}{4} \\ \dfrac{17}{4} &\le &\left(h+\dfrac 32\right)^2 &<& \dfrac{21}{4} \\ \dfrac{\sqrt{17}}{2} &\le& h+\dfrac 32 &<& \dfrac{\sqrt{21}}{2} \\ \dfrac{\sqrt{17}-3}{2} &\le& h &<& \dfrac{\sqrt{21}-3}{2}\\ 2 + \dfrac{\sqrt{17}-3}{2} &\le& x &<& 2+\dfrac{\sqrt{21}-3}{2} \\ \dfrac{1+\sqrt{17}}{2} &\le& x &<& \dfrac{1+\sqrt{21}}{2} \end{array}$$

So the solution set is

$$x \in \left(-1, -\dfrac{\sqrt 5 - 1}{2} \right] \cup \left[\dfrac{1+\sqrt{17}}{2}, \dfrac{1+\sqrt{21}}{2} \right)$$