# Convolution of 2 discrete time signals

My background: until very recently in my studies I was dealing with analog systems and signals and now we are being taught discrete signals.

I am stuck at this question:

Suppose the impulse response of a discrete linear and time invariant system is $$h(n) = u(n)$$ Find the output signal if the input signal is $$x(n) = u(n-1)-u(n-5)$$ When $$n<1$$ the input signal doesn't overlap with the impulse response so the convolution is 0.

When $$1 part of the input signal overlaps with the impulse response (from $$0$$ to $$n-1$$) so the result of the convolution is $$n$$?

But what if $$n>5$$?. Isn't it correct that the signal overlap from $$n-1$$ until $$n-5$$ so the convolution must be equal to $$4$$?

Almost!

When n<1 the input signal doesn't overlap with the impulse response so the convolution is 0.

That's correct.
Note: strictly speaking, that's correct if by "overlap" you mean "overlap when both signals have a value of $$1$$". The unit step function is defined everywhere, so the signals overlap everywhere. For example, at $$n=0$$, the impulse response has value $$1$$ and the input has value $$0$$. That doesn't mean they don't "overlap".

You need to be careful with your limits. You have an error with your expression for $$x[n-k$$]. Change $$\leq$$ to $$<$$ to get:

$$x[n-k] = \begin{cases} 1 &n-5 < k\leq n-1\\ 0 &\text{otherwise} \end{cases}$$

When 1<n<5 part of the input signal overlaps with the impulse response (from 0 to n−1) so the result of the convolution is n?

is then correct with $$1\leq n < 5$$, and the caveat on overlap mentioned earlier.

But what if $$n>5$$? Isn't it correct that the signal overlap from $$n−1$$ until $$n−5$$ so the convolution must be equal to $$4$$?

Again, assuming you mean "overlap only at values where both signals are $$1$$", this should read: but what if $$n\geq5$$? Isn't it correct that the signals overlap from $$n−4$$ to $$n−1$$ so the convolution must be equal to $$4$$?

To summarize: $$y[n] = h[n]*x[n] = \begin{cases} 0 & n < 1\\ n &1 \leq n < 5\\ 4 &\text{otherwise} \end{cases}$$