TITLE: On solutions of an equation in $\mathbb{Z}_3$
QUESTION [9 upvotes]: For integer numbers $x_1, x_2, y_1, y_2, y_3$ suppose that
$$
 x_1 + x_2 \equiv y_1 + y_2 + y_3 \pmod 3.
$$
For $k=0, 1, 2$ define
$$
 s_k = \Big|  \{ y_i \,|\, y_i \equiv k \pmod 3 \} \Big| -  \Big|  \{ x_i \,|\, x_i \equiv k \pmod 3 \}  \Big|,
$$
Show that 
$$
 (s_2 - s_1 )/3 + (1 - (-1)^{s_0}) / 2 \leq 1 .
$$
Is there any idea for proving this inequality other than case by case checking of first equation's solutions?
Edit: 
In fact similar problem stated for many other equations in $\mathbb{Z_3}$. For example,
$$ x_1 + x_2 + x_3 + x_4\equiv y_1 \pmod 3 $$
and
$$ x_1 + 1 \equiv y_1 +y_2 + y_3 \pmod 3.$$
I'm looking for a solution that can be extended for other equations!

REPLY [2 votes]: We can assume that $x_1,x_2,y_1,y_2,y_3\in\{0,1,-1\}$. Then we can use the indicator functions
\begin{align*}
f_0(t) &= 1-t^2 = \begin{cases} 1 & t=0 \\ 0 & t\in\{-1,+1\} \end{cases}\\
f_1(t) &= \frac{t(t+1)}2 = \begin{cases} 1 & t=1 \\ 0 & t\in\{-1,0\} \end{cases}\quad\text{and}\\
f_2(t) &= \frac{t(t-1)}2 = \begin{cases} 1 & t=-1 \\ 0 & t\in\{0,1\} \end{cases}
\end{align*}
to count the numbers in the remainder classes:
$$
s_k = \sum_{i=1}^3 f_k(y_i) - \sum_{i=1}^2 f_k(x_i).
$$
Plugging the definition of $f_k$, we obtain
$$
s_0 = 1 +x_1^2+x_2^2 -y_1^2-y_2^2-y_3^2,
$$
and
$$
s_2-s_1 = x_1+x_2-y_1-y_2-y_3.
$$
Obviously, $|s_2-s_1|\le 5$. By the assumption, $3|s_2-s_1$.
Moreover, due to $x_i^2\equiv x_i\pmod2$ and $y_i^2\equiv y_i\pmod2$, 
 $s_2-s_1\equiv s_0-1\pmod2$. 
If $s_0$ is odd then $s_2-s_1$ is even, so $6|s_2-s_1$. Therefore, $s_2-s_1=0$.
If $s_1$ is even then $s_2-s_1$ is odd, so $s_2-s_1\equiv3\pmod6$, and
$|s_2-s_1|=3$.