<s>[INST] Find the formula for the convolution of the sequences (generating functions) 
Find the formula for the convolution of the sequences:
$a_n=\begin {cases} 1 & 0\leq n \leq 4 \\  0 &  n \geq 5  \end{cases} $
$b_n = 1$ $\forall n \in \mathbb{N}$

What I've been doing:
In other words:
$a_n = 1,1,1,1,1,0,0,...$ and $b_n=1,1,1,1,...$
So that means that their generating functions are:
$a(x)=1+x+x^2+x^3+x^4=\sum _{i=0} ^{4} x^i$
$b(x)=1+x+x^2+x^3+...=\sum _{j=0} ^{\infty} x^i$
So using the convolution formula i.e: $b(x)a(x)=\sum _{j=0} ^{\infty}(\sum _{i=0} ^{4}a_ib_{j-i})x^4=\sum _{j=0} ^{\infty}(\sum _{i=0} ^{4}x^i(x^{i-j}))x^4=\sum _{j=0} ^{\infty}(\sum _{i=0} ^{4}x^{2i-j})x^4$
And I can't get past that nor do I know if what I did was correct... Can someone guide me?
 [/INST] One approach is to simplify the generating functions $a(x)$ and $b(x)$, multiply them, and manipulate the resulting generating function for the convolution, as follows:
$$\begin{align}
a(x) &= \sum_{i=0}^4 x^i = 1+x+x^2+x^3+x^4 \\
b(x) &= \sum_{j=0}^\infty x^j = \frac{1}{1-x} \\
\sum_{k=0}^\infty \left(\sum_{i=0}^k a_i b_{k-i}\right) x^k &= a(x) b(x) \\
&= \frac{1+x+x^2+x^3+x^4}{1-x} \\
&= -4 - 3 x- 2 x^2 -x^3 + \frac{5}{1 - x} \\
&= -4 - 3 x- 2 x^2 -x^3 + 5\sum_{k=0}^\infty x^k \\
&= 1 +2 x+3 x^2 +4x^3 + 5\sum_{k=4}^\infty x^k \\
&= \sum_{k=0}^\infty \min(k+1,5) x^k.
\end{align}$$
So $$\sum_{i=0}^k a_i b_{k-i}= \min(k+1,5).$$
More generally, convolution of an arbitrary sequence $(a_i)_{i=0}^\infty$ with the constant 1 sequence yields the sequence of cumulative sums $(\sum_{i=0}^k a_i)_{k=0}^\infty$.  You can use the same generating function approach as above or just compute directly:
$$
\sum_{i=0}^k a_i b_{k-i} = \sum_{i=0}^k a_i \cdot 1 = \sum_{i=0}^k a_i.
$$
</s>