When does the following congruence identity hold? 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?
 A: 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\}.$$
A: Let $K=l[nl^{-1}]_m - m[-nm^{-1}]_l$.
Notice that
$$
K \equiv n \pmod{lm}
$$
and
$$
-m(l-1) \leq K \leq l(m-1).
$$
Let's first assume $n\ge 0$.
To guarantee that $K=n$, one needs to have
$n\leq l(m-1)$ and $n-lm<-m(l-1)$, i.e. $n<m$.
Similarly, if $n<0$, then $n>-m(l-1)$ and $n+lm>l(m-1)$, i.e. $n>-l$.
Overall, the equality $K=n$ is guaranteed if $-l<n<m$.
UPDATE (generalization of Arnaud's answer) If we additionally assume that $\gcd(n,l)=g_l<l$ and $\gcd(n,m)=g_m<m$. Then the bounds become
$$
lg_m-m(l-1) \leq K \leq l(m-1) - mg_l.
$$
Correspondingly, the guaranteed range for $n$ extends to
$$-l-mg_l < n < m + lg_m.$$
A: I'll use Max's notations for the sake of clarity. Notice that if $ lm $ divides $ n $ then $ K =0 $ and the condition you want to achieve always fails (unless $ n=0 $...). Hence by coprimality you may assume that $ n $  is either not a multiple of $ m $ or not a multiple of $ l $. In the first case $[l^{-1} n]_m$ cannot be $0 $ so at the end of the day the condition on $ n $ becomes $$-l <n <l+m $$
and similarly in the latter case $$-l-m<n <m $$
This is still only a sufficient condition though.
A: Note that $0,l,-m$ are solutions and $-l,m$ are not.  Further, if $n \leq 0$ is a solution, then $n+ml$ is not, and similarly for $n \geq 0$ and $n-ml$.  Also, for $0 \lt k \lt m$ we have $kl$ is a solution, and similarly for $-m$. Finally, if $n$ is a solution and $n+1$ is not precluded from being a solution, then $n+1$ is a solution.
This is not a proof of Greg Martin's comment, but I believe it leads to a functional and laborious proof of it, or something like it. It is my way of being unsuccinct.
Gerhard "Still Has Shades Of Sylvester" Paseman, 2018.01.10.
