Discrete convolution (between infinite sequences $f$ an $g$) is defined as $$(f*g)(k) = \sum_{j=-\infty}^{\infty}f(j)g(k-j)$$.
It is well known that convolution is associative, that is $(f*g)*h=f*(g*h)$. But I am a little confused with the following situation:
Let be $f=H$ (discrete Heaviside), that is $H(k)=0$ for $k<0$ and $H(k)=1$ for $k\ge 0$. Let be $g$ defined as $g(0)=1$, $g(1)=-1$ and $g(k)=0$ otherwise. And finally (maybe the problem !) let be $h(k)=1$ for any $k\in\mathbb{Z}$. In this situation we easily obtain:
$(f*g)*h = h$ and $f*(g*h) = 0$
Can someone have an explanation for this point and how it could be avoided?
Associativity of convolution is essentially changing the order of summation:
$$(f \star (g \star h))(k) = \sum_i f(i) (g*h)(k-i) = \sum_i \sum_j f(i) g(j) h(k-i-j)$$
$$ \eqalign{((f\star g)\star h)(k) &= \sum_j (f \star g)(j) h(k-j) = \sum_j \sum_i f(i) g(j-i) h(k-j) \cr &= \sum_{j'} \sum_i f(i) g(j') h(k-i-j')}$$ where we relabel $j = j'+i$.
These are the same (Fubini's theorem for sums) if the double sum converges absolutely. If it doesn't, they may be different.