<s>[INST] $\left\lfloor \frac{a-b}{2} \right\rfloor + \left\lceil \frac{a+b}{2} \right\rceil = a$ when $a,b$ are integers? Let $a$ and $b$ be positive integers.
If $b$ is even, then we have $$\left\lfloor \frac{a-b}{2} \right\rfloor + \left\lceil \frac{a+b}{2} \right\rceil = a$$
I think the equality also hold when $b$ is odd. What could be a proof for it?
 [/INST] If $a$ and $b$ are both odd then we have $a=2m+1$ and $b=2n+1$ where $m$ and $n$ are positive integers.
Then, we have \begin{align}\left\lfloor\frac{a-b}2\right\rfloor+\left\lceil\frac{a+b}2\right\rceil &= \left\lfloor\frac{(2m+1)-(2n+1)}2\right\rfloor+ \left\lceil\frac{(2m+1)+(2n+1)}2\right\rceil\\
&=\left\lfloor\frac{2m-2n}2\right\rfloor+ \left\lceil\frac{2m+2n+2}2\right\rceil\\
&=\lfloor m-n\rfloor + \lceil m+n+1\rceil\\
&= m-n + m+n+1\tag{$*$}\\
&= 2m+1\\
&=a\end{align}
We can get to $(*)$ because $m$ and $n$ are integers and so their floor (or ceiling) is just the number inside (two integers added or subtracted will always give an integer answer).
If $a$ is even and $b$ is odd, then we have $a=2m$ and $b=2n+1$, again for $m$ and $n$ integers.
So we have \begin{align}\left\lfloor\frac{a-b}2\right\rfloor+\left\lceil\frac{a+b}2\right\rceil &= \left\lfloor\frac{(2m)-(2n+1)}2\right\rfloor+ \left\lceil\frac{(2m)+(2n+1)}2\right\rceil\\
&=\left\lfloor\frac{2m-2n-1}2\right\rfloor+ \left\lceil\frac{2m+2n+1}2\right\rceil\\
&=\left\lfloor m-n-\frac 12\right\rfloor + \left\lceil m+n+\frac12\right\rceil\\
&= m-n -1+ m+n+1\tag{$\dagger$}\\
&= 2m\\
&=a\end{align}
Here we get to $(\dagger)$ because we round the first half down and the second half up to their respective nearest integers
</s>