I'm trying to solve $$\lfloor \sqrt x \rfloor = \left\lfloor \frac{x}{2} \right\rfloor$$ for real $x$. Obviously this can't be true for any negative reals, since the root isn't defined for such.

My approach is the following: Let $x=:n+r$, $n \in \mathbb{N}_0, 0\leq r < 1$.

For the left hand side $\lfloor \sqrt {n+r} \rfloor = \lfloor \sqrt {\lfloor n+r\rfloor} \rfloor = \lfloor \sqrt n \rfloor$ holds (without further proof).

$$\left\lfloor \frac{x}{2} \right\rfloor = \left\lfloor \frac{n+r}{2} \right\rfloor = \left\{ \begin{array}{l l} \frac{n}{2} & \quad \text{for n even} \\ \frac{n-1}{2} & \quad \text{for n odd} \end{array}\right.$$

Now I don't really know if that'd lead me in the right direction, but I'll write my thoughts down anyways.

Let $\sqrt n =: n'+r'$, $n \in \mathbb{N}_0, 0\leq r < 1$.

Therefore $\lfloor n'+r' \rfloor = n'$. And $n = (n'+r')^2 = n'^2 +2n'r' +r'^2$

For which $n',r'$ holds $$ n' < n'^2 + 2n'r' + r'^2.$$

Well and now I'm stuck and don't know how to proceed.

I'd appreciate any help.

  • $\begingroup$ Let $k = \lfloor\sqrt{x}\rfloor$. Then $k^2 \leqslant x < (k+1)^2$. That gives you a restriction on the possible values of $k$. $\endgroup$ Nov 25, 2014 at 17:09

7 Answers 7


It is completely obvious that $x$ must be a non-negative real number. We decompose it as the following format:


in which $k^2$ is the largest integer less than or equal to $x$ in which is a squre of an integer number. So it is completely apparent that

$$n<(k+1)^2-k^2\rightarrow n<2k+1$$ $r$ is a real number such that $0\leq r<1$

We can say that $k\leq\sqrt{x}<k+1$, hence $\lfloor \sqrt{x}\rfloor=k$.

So the problem reduces to $k=\lfloor \frac{k^2+n+r}{2}\rfloor$.

So from the above eqaulity we can deduce

$\lfloor\frac{k^2}{2}\rfloor\leq k$, but for $k\geq 3$, the left hand side of the inequlity grows much faster than the right hand side, hence it is true only for three values for $k$. In other words $k=0,1,2$.


In this case $n<2k+1=1$, hence we can say that $n=0$, so we have $$k=\lfloor \frac{k^2+n+r}{2}\rfloor\rightarrow 0=\lfloor\frac{r}{2}\rfloor\rightarrow 0\leq r<2$$ which is a true inequlity for all values of $r$(note that at the first we assumed $0\leq r<1$).

So in this case $x$ reduces to $k^2+n+r=0+0+r=r$ for all values of $r$, so $x\in[0,1)$


In this case we have

$$k=\lfloor \frac{k^2+n+r}{2}\rfloor\rightarrow 1=\lfloor\frac{1+n+r}{2}\rfloor$$ In addition we have $$n<2k+1=3\rightarrow n=0,1,2$$ We can say $$1=\lfloor\frac{1+n+r}{2}\rfloor\rightarrow 1\leq n+r<3$$ in which for $n=0$, this condition is not satisfied, but is satisfied for $n=1,2$. Hence in this case we have:

$$x=k^2+n+r=1+1+r=2+r$$ or $$x=k^2+n+r=1+2+r=3+r$$ So $x\in[2,4)$


In this case we have $$2=\lfloor\frac{4+n+r}{2}\rfloor\rightarrow 0\leq n+r<2$$ but in this case $n<2k+1=5\rightarrow n=0,1,2,3,4$. But for $n=2,3,4$, the condition of $0\leq n+r<2$ is not satisfied and hence we can say in this case $$x=k^2+n+r=4+n+r=4+0+r\space\space\space\space or\space\space\space x=4+1+r$$ So in this case $x\in[4,6)$

So the solution for the intended equality is the union of these intevals:

$$x\in[0,1)\cup [2,4)\cup [4,6)\rightarrow x\in[0,1)\cup [2,6)$$

  • $\begingroup$ Thank you very much for this detailed answer. $\endgroup$
    – xeni
    Nov 25, 2014 at 18:00

Note that $\lfloor{\sqrt{x}}\rfloor$ changes value (increases by one) only when $x$ is a perfect square, while $\lfloor{x/2}\rfloor$ changes value only when $x$ is an even integer. Both sides of the equation are initially $0$ (at $x=0$). The first few changes are at $x=1$ (a perfect square, breaking the equality), $x=2$ (an even integer, restoring the equality), $x=4$ (both a perfect square and an even integer, preserving the equality), and $x=6$ (an even integer, breaking the equality). Thus far the intervals $[0,1)$ and $[2,6)$ satisfy the equality, and at this point the left-hand side is smaller than the right. It's not hard to see that even integers are more numerous than perfect squares from here on out, so the complete solution set is $[0,1) \cup [2,6)$.

  • $\begingroup$ Yes, I saw that too, but i didn't really know how to put it in words. Thank you. $\endgroup$
    – xeni
    Nov 25, 2014 at 18:02

From the expression it's immediately obvious that $x \geq 0$ because $\lfloor\sqrt{-1}\rfloor = i$. The equation has no real solutions for $x<0$.

Also, it's obvious that $x=0$ works. But that is a special case. Try putting $x=1$ in the equation. $1=0$. We need to have $\lfloor\frac{x}{2}\rfloor=1$ to get the minimum. Therefore $x_{min}=2$

Now, we need to determine the upper bounds. We know that $\mid\sqrt{x}-\frac{x}{2}\mid < 1$ is a condition necessary for the given equation to be true. This condition is true for $x<2(2+\sqrt{3})$. Now we are sure that $x\in[0,2(2+\sqrt{3})\rangle$.

Note that we didn't prove that this works for numbers up to $2(2+\sqrt{3})$. We only proved that there are no numbers outside of this range.

Let's check how much we overshot the max solution by trying out the $x_{max}$ on the equation:

$$\lfloor\sqrt{2*(2+\sqrt{3})}\rfloor = \lfloor\frac{x}{2}\rfloor \Rightarrow 2=3$$

From the above we can conclude that $\lfloor\frac{x}{2}\rfloor = 2$ to make the equation true. That means that $x<6$. That means that $x\in[0,1\rangle\cup[2,6\rangle$


Let $f(x)=\lfloor\sqrt x\rfloor$, $g(x)=\lfloor x/2\rfloor$.

For $0\le x<1$, $f(x)=g(x)=0$.

For $1\le x<2$, $f(x)=1$ but $g(x)=0$.

For $2\le x<4$, $f(x)=g(x)=1$.

For $4\le x<6$, $f(x)=g(x)=2$.

For $6\le x<9$, $f(x)=2$ and $g(x)\ge 3$.

And for $x\ge 9$, $$\frac x2-\sqrt x=\frac12(\sqrt x-1)^2-\frac12\ge2-\frac12>1$$ so $g(x)>f(x)$.


Clearly $x$ can’t be negative, and $\sqrt{x}$ and $\frac{x}2$ can’t be too far apart. They’re equal for $x=4$, and after that $\frac{x}2$ exceeds $\sqrt{x}$ by more and more as $x$ increases. Thus, we should focus initially on relatively small non-negative values of $x$. Points where one or the other floor increases are perfect squares and even integers, so we look at intervals that have such integers as endpoints.

For $x\in[0,1)$, we clearly have


For $x\in[1,2)$ we have $\lfloor\sqrt{x}\rfloor=1$, but $\left\lfloor\frac{x}2\right\rfloor=0$. So far, then, we have solutions $[0,1)\cup\{2\}$.

For $x\in[2,4)$ we have $$\lfloor\sqrt{x}\rfloor=1=\left\lfloor\frac{x}2\right\rfloor\;,$$

and for $x\in[4,6)$ we have


so the solution set has expanded to $[0,1)\cup[2,6)$. I claim that for $x\ge 6$, however, the separation between $\sqrt{x}$ and $\frac{x}2$ is too large, and we always have


First, for $x\in[6,9)$ we have $\lfloor\sqrt{x}\rfloor=2$, but $\left\lfloor\frac{x}2\right\rfloor\ge 3$. Now suppose that $n\in\Bbb Z^+$, $n\ge 3$, and $n^2\le x<(n+1)^2$. Then $\lfloor\sqrt{x}\rfloor=n$, and


We’re done if we can show that $\left\lfloor\frac{n^2}2\right\rfloor\ge n+1$ for $n\ge 3$. And this is an easy proof by induction. The inequality certainly holds when $n=3$. Suppose that it holds for some $n\ge 3$. Then

$$\left\lfloor\frac{(n+1)^2}2\right\rfloor=\left\lfloor\frac{n^2+2n+1}2\right\rfloor=\left\lfloor\frac{n^2+1}2\right\rfloor+n\ge\left\lfloor\frac{n^2}2\right\rfloor+n\ge 2n+1>n+2\;,$$

and the induction step is complete.


If $x \geq 2$, $\lfloor \sqrt{x} \rfloor = \lfloor x/2 \rfloor$ implies that $(x/2 - 1)^2 \leq \lfloor x/2 \rfloor^2 = \lfloor \sqrt{x} \rfloor^2 \leq x$. Therefore, $x^2 - 8x + 4 \leq 0$, which implies that $x \leq 4 + 2 \sqrt{3} < 8$.

Then a simple inspection shows that the solution is $x = [0,1) \cup [2,6)$


$$\lfloor \sqrt x \rfloor = \left \lfloor \dfrac x2 \right \rfloor$$

Let $0 \le n = \lfloor \sqrt x \rfloor = \left \lfloor \dfrac x2 \right \rfloor \in \mathbb Z$.

Then $n \le \sqrt x \lt n+1$ and $n \le \dfrac x2 \lt n+1 $.

Hence $n^2 \le x \lt (n+1)^2$ and $2n \le x \lt 2n+2$.

We can express this as $x \in [n^2, n^2+2n+1) \cap [2n, 2n+2)$.

For $n=0$, we get $x \in [0,1)$.

For $n=1$, we get $x \in [2, 4)$

For $n=2$, we get $x \in [4, 6)$

For $n \ge 3$, we can show that $2n+2 < n^2$ and, hence $x \in \varnothing$.

So the solution set is $[0,1) \cup [2,6)$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .