Prove $\lceil z \rceil=z+\frac12-\frac{\tan^{-1}(\tan(\pi(z+0.5)))}{\pi}$ when $z$ is not an integer How can I prove that $\lceil z \rceil=z+\dfrac12-\dfrac{\tan^{-1}(\tan(\pi(z+0.5)))}{\pi}$  for all non-integer real numbers $z$?
Z cannot be an integer because then tan(pi*z + pi/2) would be undefined. I got this equation by messing around with arcsin(sin(x)), arccos(cos(x)), and arctan(tan(x)) and noticed that arctan(tan(x))-x looked liked a weird negative ceiling function, so I made it x-arctan(tan(x)), and saw a disproportional ceiling function: 
Then I changed the equation so that it was the arctan(tan(x)) became $\dfrac{\tan^{-1}(\tan(\pi(z+0.5)))}{\pi}$ and I added 0.5 to make it the ceiling function. I am looking for a mathematical proof that is relatively simple and only uses trig, low level calc, and algebra.
 A: $\tan (x)$ has a period of $\pi$, so $\tan x = \tan (\pi(\frac{x}{\pi}-\lceil \frac{x}{\pi} \rceil + \epsilon))$, where $\epsilon \in \mathbb{Z}$. Consider $x = \pi(z+\frac{1}{2})$, then 
$$z + \frac{1}{2} - \frac{\tan^{-1} \tan (\pi(z+\frac{1}{2}))}{\pi} = z + \frac{1}{2} - \frac{\tan^{-1} \tan (\pi(z+\frac{1}{2} - \lceil z+\frac{1}{2}\rceil+\epsilon)))}{\pi}$$
Because we want to invert the tangent/arctangent with its principal value , we want $z+\frac{1}{2}-\lceil z+\frac{1}{2} \rceil + \epsilon \in (-\frac{1}{2},\frac{1}{2})$. This fixes $\epsilon$. So:
$$z + \frac{1}{2} - \frac{\tan^{-1} \tan (\pi(z+\frac{1}{2} - \lceil z+\frac{1}{2}\rceil+\epsilon)))}{\pi} = z + \frac{1}{2} - \frac{\pi(z+\frac{1}{2} - \lceil z+\frac{1}{2}\rceil+\epsilon))}{\pi} = \\ = \lceil z+\frac{1}{2}\rceil-\epsilon$$
Remember when I said "this fixes $\epsilon$"? This trick is such that $$\lceil z+\frac{1}{2}\rceil-\epsilon = \lceil z \rceil$$
Indeed, if $\lceil z+\frac{1}{2}\rceil = \lceil z \rceil +1$, then $\epsilon = 1$: $$z+\frac{1}{2}-\lceil z+\frac{1}{2} \rceil + \epsilon  = z - \lceil z \rceil - \frac{1}{2} + \epsilon\in (-\frac{1}{2},\frac{1}{2}) \Rightarrow \epsilon = 1$$ 
In the same way, if $\lceil z+\frac{1}{2}\rceil = \lceil z \rceil$, then $\epsilon = 0$.
A: For the new expression note that $\tan(x)=\tan(x+n\pi)$ for all integers $n$. So the principal branch of $\arctan$ (which is the inverse of $\tan|_{]-\frac\pi2, \frac\pi2[}$) satisfies for all real numbers $x$: $\arctan(\tan(x))=x+n(x)\pi$, where $n(x)$ is an integer that is uniquely given by the condition $x+n(x)\pi\in]-\frac\pi2,\frac\pi2[$.
Hence, for all real $x$ that are not integer multiples of $\frac\pi2$, $\dfrac{\arctan(\tan(x))}{\pi}=\dfrac x\pi+n(x)$, where $n(x)$ is an integer that is uniquely given by the condition $x + n(x)\pi\in]-\frac\pi2,\frac\pi2[$.
We can rewrite this condition as $x\in]\pi(n(x)-\frac12),\pi(n(x)+\frac12)[$ for all $x$ that are not in $\frac\pi2 \cdot \mathbb Z$. It is not too hard to see that $n(x)=-\left\lfloor \frac x\pi+\frac12\right\rfloor$ satisfies this condition.
So for all $x$ that are not integers, we have
$${\arctan(\tan(\pi(x+\frac12)))}=\pi\left(x+\frac12\right)-\pi \left\lfloor \frac {\pi(x+\frac12)}\pi+\frac12\right\rfloor=\pi\left(x+\frac12-\lfloor x+1\rfloor\right).$$
Hence, for non-integer $x$, we have
$$x+\dfrac12-\dfrac{\arctan(\tan(\pi(x+0.5)))}{\pi}=\lfloor x+1\rfloor = \lceil x\rceil.$$
A: For a non-integer real number $z$, we can express $z = m + \frac{1}{2} + \alpha$ where $m$ is an integer, and $-\frac{1}{2} < \alpha < \frac{1}{2}$.
We have $\lceil z \rceil = m + 1$ and
$\arctan(\tan (\pi (z + 0.5))) = \arctan(\tan (\pi\alpha))$
since the period of $\tan x$ is $\pi$.
Denote $y = \arctan(\tan (\pi\alpha))$.
From definition of $\arctan x$, we have $y \in (-\frac{\pi}{2}, \frac{\pi}{2})$
and $\tan y = \tan (\pi\alpha)$.
Also, $\pi \alpha \in (-\frac{\pi}{2}, \frac{\pi}{2})$.
Thus, we have $y = \pi \alpha$ since $x\mapsto \tan x$ is strictly increasing on $(-\frac{\pi}{2}, \frac{\pi}{2})$. As a result, we have $\arctan(\tan (\pi\alpha)) = \pi\alpha$.
Thus, we have
$z + \frac{1}{2} - \frac{\arctan(\tan (\pi (z + 0.5)))}{\pi}
= m + \frac{1}{2} + \alpha + \frac{1}{2} - \alpha = m + 1$.
We are done.
