TITLE: When does the following congruence identity hold?
QUESTION [5 upvotes]: Let $m$,$l$ be coprime integers where $m,l\geq 2$.  For any integer $a$ and positive base $b \ (b\geq 2)$, let 
$
[a]_b
$ denote the element of $\{0,\ldots, b-1\}$ that satisfies the equivalence
$[a]_b \equiv a \bmod b$.
For any integer $n$, one can write
$$
nl[l^{-1}]_m - nm[(-m)^{-1}]_l = n,
$$ as Bézout's Identity yields
$$
l[l^{-1}]_m - m[(-m)^{-1}]_l = 1
$$ (the existence of inverses is assured by the coprimality of $m$ and $l$).
Question:  Under what conditions on $n$ does the equality
$$
l[nl^{-1}]_m - m[n(-m)^{-1}]_l = n
$$ hold?

REPLY [3 votes]: Each integer number $n$ can be uniquely expressed in the form $n=lx+my$, where $0\le x\le m-1$ and $y\in \mathbb{Z}.$ This artificial numeral system is more suitable for the riven problem because for $n=lx+my$
$$l[nl^{-1}]_m - m[n(-m)^{-1}]_l = lx -m[-y]_l. $$
The last expression is equal to $n$ iff $-l<y\le 0.$ So the final answer is the set of numbers
$$\{n=lx+my:0\le x\le m-1, -l<y\le 0\}.$$