# Can we deduce from the equality that $\max \{n-q,q-1\} \in \left[ \frac{n}{2},n \right)$?

Suppose that we have a uniform distributed random variable in $[0,n]$.

We have the following:

$$\max \{n-q,q-1\}=\left\{\begin{matrix} q-1, q > \lfloor \frac{n}{2}\rfloor & \to q-1> \lceil\frac{n}{2} \rceil \\ n-q, q \leq \lceil \frac{n}{2} \rceil& \to n-q \geq n- \lceil \frac{n}{2}\rceil=\lfloor \frac{n}{2}\rfloor \end{matrix}\right.$$

Can we deduce from the above that $\max \{n-q,q-1\} \in \left[ \frac{n}{2},n \right)$ ? Or how else do we get this result?

Consider if $q=\frac {n+1}2$. Then,
$$\max\{n-q,q-1\}=\max\left\{\frac {n-1}2, \frac {n-1}2\right\}=\frac {n-1}2\not\in \left[\frac n2, n\right)$$
Also consider if $q=0$. Then $\max\{n-q,q-1\}=n\not\in[\frac n2,n)$.
Here is how you can find the correct interval. $n-q$ decreases and $q-1$ increases as $q$ increases. If there is a $q$ such that they are equal, that will be the $q$ for which $\max\{n-q,q-1\}$ achieves its minimum. So, let's see when that occurs.
\begin{align}&n-q= q-1\\ \implies&n+1= 2q\\ \implies&q=\frac{n+1}2 \end{align}
The minimum is achieved at $q=\frac {n+1}2$. Then $\max\{n-q,q-1\}=\frac{n-1}2$ and we get that $\max\{n-q,q-1\}\in[\frac {n-1}2,n]$.