# Solving a tough equation with the floor function

Solve the equation $$\left\lfloor\frac{x-2}{x+1}\right\rfloor=\bigg|\frac{2-x}{3}\bigg|.$$

My attempt

Let us consider the case where $$x$$ is an integer, such that $$x=n$$, then we have:

$$\frac{n-2}{n+1}=\bigg|\frac{2-n}{3}\bigg|$$.

$$3\frac{n-2}{n+1}=\bigg|2-n\bigg|$$

we get:

$$(n + 1) |n - 2| + 6 = 3 n \ \ \ \ ( n\ne-1)$$

This gives the solutions $$n=2$$ and $$n=-4$$

Now, assume that $$x$$ is not an integer, then we need to solve for $$x=n+\delta$$, where $$\delta\in\langle0,1\rangle$$:

$$\left\lfloor\frac{(n+\delta)-2}{(n+\delta)+1}\right\rfloor=\bigg|\frac{2-(n+\delta)}{3}\bigg|$$

$$3\left\lfloor\frac{(n+\delta)-2}{(n+\delta)+1}\right\rfloor=\bigg|{2-(n+\delta)}\bigg|$$

$$3\bigg(1 - \left\lfloor\frac{3}{1+n+\delta}\right\rfloor\bigg)=\bigg|{2-n-\delta}\bigg|$$

Now put $$\alpha=n+\delta$$ and $$\beta=-n-\delta$$

$$3\bigg(1 - \left\lfloor\frac{3}{1+\alpha}\right\rfloor\bigg)=\bigg|{2+\beta}\bigg|$$

$$3=\bigg|2+\beta\bigg|+3\left\lfloor\frac{3}{1+\alpha}\right\rfloor$$

$$\beta=1-3\left\lfloor\frac{3}{1+\alpha}\right\rfloor$$

When we insert for $$\alpha=n+\delta$$, we obtain

$$\beta=1-3\left\lfloor\frac{3}{1+n+\delta}\right\rfloor.$$

With $$0<\delta<1$$ then we get $$\beta= \langle -2, -5\rangle$$. Since $$\beta=-n-\delta$$, then this gives that the solutions to the non-integer form of $$x$$ are all real numbers in the interval of $$n=x=\langle 1,2\rangle$$.

Since $$\beta=-\alpha$$ one could have tried to solve the problem with only the alpha variable. However, I wasn't able to extract $$\alpha$$ from the floor fraction. So calling them beta and alpha gave the opportunity to study each case separately. But here I wonder if it should have been solved also for the case of isolating $$\alpha$$?

• Personally, my first line of attack on all such problems is to assume that $~x = P + r ~: ~P \in \Bbb{Z}, ~0 \leq r < 1.~$ Then, I simply solve for all satisfying ordered pairs $~(P,r).~$ Aug 7, 2023 at 12:21

## 2 Answers

Let us consider the case where x is an integer, such that x=n, then we have: $$\frac{n-2}{n+1}=\bigg|\frac{2-n}{3}\bigg|$$

Here you actually assumed that $$\frac{x-2}{x+1}$$ is an integer as well, which simplifies situation. But with this assumption the rest seems OK, although I don't know why you write $$n > 0$$.

The part about $$x$$ not being an integer is unnecessasry, since $$x$$ must be an integer: \begin{align} \mathbb Z &\ni \left\lfloor\frac{x-2}{x+1}\right\rfloor=\bigg|\frac{2-x}{3}\bigg| \\ &\implies \qquad|2 - x| \in 3\mathbb Z \\&\implies \qquad x \in \mathbb Z \quad \land \quad x \operatorname{mod} 3 = 2. \end{align}

Here is another approach: We can substitute $$x =3k + 2$$ for unknown $$k \in \mathbb Z$$ to get $$\left\lfloor\frac{3k}{3k+3}\right\rfloor=1+\left\lfloor-\frac{1}{k+1}\right\rfloor=|k|$$ On the left-hand side we have number which can only be $$0$$, $$1$$ or $$2$$, since $$\left\lfloor-\frac{1}{k+1}\right\rfloor \in \{-1, 0, 1\}$$ for any $$k \in \ \mathbb Z\setminus \{-1\}$$ (assumption $$k \neq -1$$ corresponds to $$x \neq -1$$). This gives finitely many possibilities $$k \in \{-2, 0, 1, 2\}$$ from which arise possible solutions $$x \in \{-4, 2, 5, 8\}$$. You can check one-by one which are actual solutions.

• Esgeriath only asserts that the solutions of the equation must lie in $\{3k+2: k \in \{-2,0,1,2\}\}$ not that all four are solutions. In fact for $k\geq 0$ the equation $\lfloor 3k/(3k+3)\rfloor = |k|$ becomes $0=|k|$, hence $k=0$ or $x=2$ is the only solution with $k\geq 0$. Similarly if $k=-m<-1$ (as $k=-1$ if and only if $x=-1$) then the equation becomes $\lfloor m/(m-1)\rfloor=m$, and since $\lfloor m/(m-1)\rfloor \leq m/(m-1)\leq m$ with equality if and only if $m-1=1$, $k=-2$, or $x=-4$ is the only solution with $k<0$. Aug 7, 2023 at 12:13

$$\lfloor\frac{{x}−\mathrm{2}}{{x}+\mathrm{1}}\rfloor=\mid\frac{\mathrm{2}−{x}}{\mathrm{3}}\mid \\$$ $$\mathrm{3}{n}={x}−\mathrm{2} \\$$ $$\lfloor\frac{\mathrm{3}{n}}{\mathrm{3}{n}+\mathrm{3}}\rfloor=\pm{n} \\$$ $$\lfloor\frac{-\mathrm{1}}{{n}+\mathrm{1}}\rfloor=\pm{n}−\mathrm{1}=\pm\mathrm{1} \\$$ $${n}=\frac{\mathrm{1}\pm\mathrm{1}}{\pm\mathrm{1}}=\left\{-\mathrm{2},\mathrm{0},\mathrm{2}\right\} \\$$ $${x}=\mathrm{2}+\mathrm{3}{n}=\left\{-\mathrm{4},\mathrm{2},\mathrm{8}\right\} \\$$