Doubt on the Convolution of two piecewise functions I have some doubts about this convolution exercise. Take two functions defined as:
$$f(t) = \begin{cases} 2 ~~~~~ 0< t< 3 \\ 0 ~~~~~ \text{elsewhere} \end{cases}$$
$$g(t) = \begin{cases} 2 ~~~~~ 0< t< 1 \\ 0 ~~~~~ \text{elsewhere} \end{cases}$$
And calculate their convolution $f * g $
So by the definition
$$f * g = g * f = \int_{-\infty}^{+\infty} f(\tau) g(t-\tau) \ d\tau$$
That is
$$f * g = \int_{0}^3 2 g (t - \tau)\ d\tau$$
How should I proceed? 
Mathematica gives the CORRECT result:
$$\begin{array}{cc}
 & 
\begin{array}{cc}
 4 & 1<\tau \leq 3 \\
 -4 (\tau -4) & 3<\tau <4 \\
 4 \tau  & 0<\tau \leq 1 \\
\end{array}
 \\
\end{array}$$
And of course $0$ elsewhere.
 A: Note
$$
\int_\mathbb{R} f(t-\tau)g(\tau)\mathrm d\tau=2\int_0^1f(t-\tau)\mathrm d\tau
$$
for obvious reasons. Performing the change of variable $s=t-\tau$ converts our integral to 
$$
\int_{t-1}^tf(s)\mathrm ds
$$
Now, if $t>4$ or $t<0$ this integral is zero, since $f$ is identically zero. 
For this part, I found drawing a picture immensely helpful. 
If we straddle zero with $t-1$ and $t$, $t<1$ and $t<3$ we have  the the integral is 
$$
\int_{t-1}^tf(s)\mathrm ds=2t
$$
Similarly, if we straddle $3$, we have 
$$
\int_{t-1}^tf(s)\mathrm ds=2(3-(t-1))=2(4-t)
$$
Leaving us with $(t-1,t)$ being contained entirely in the the interval $(0,3)$ in which case we just have 
$$
\int_{t-1}^tf(s)\mathrm ds=2
$$
this leaves us with
$$
f*g(t)=\begin{cases}0&t<0\\
4t&0\leq t<1\\
4&1\leq t<3\\
16-4t&3\leq t<4\\
0&t\geq 4\end{cases}
$$
This sort of matches my (hopefully correct) intuition. Firstly, we notice that we got out a continuous function, so convolution is smoothing things. Secondly, we took in two piecewise constant functions (with the same height) with overlapping pieces and "smoothly averaged" them over time. I would expect this to look linear with positive slope as we start to pick up the piecewise function $g$, then $2$ as we pick up both ($\frac{1}{2}(2+2)=2$). Finally, one of the functions in the convolution is zero again, and we have a negative slope as $g$ is getting lost.
A: we have:
$f(t) = \begin{cases} 2 & 0< t< 3 \\ 0 &\text{elsewhere} \end{cases}$
$g(t) = \begin{cases} 2 & 0< t< 1 \\ 0 & \text{elsewhere} \end{cases}$
so let's take a look over the intervals $\Bbb R,(0,3),(0,1)$:
Using those interval we can see $4$ cases: $(-\infty,0],(0,1),[1,3),[3,\infty)$, I want to point out that there are 4 cases but we will use $[1,3),[3,\infty)$ as one: 
if $\tau\in(-\infty,0]$ then $g(\tau)=0$
if $\tau\in[1,3)\cup[3,\infty)=[1,\infty)$ then $g(\tau)=0$
so  we can reduce the integral:  $\int_{-\infty}^{+\infty} f(t - \tau) g(\tau) \ d\tau\to \int_{0}^{1} f(t - \tau) g(\tau) \ d\tau$
now in the interval $(0,1),\ g(\tau)$ is a constant, so we can take it out:$\int_{0}^{1} f(t - \tau) g(\tau) \ d\tau\to2\int_{0}^{1} f(t - \tau)d\tau$
now we have $g*f(t)=2\int_{0}^{1} f(t - \tau)d\tau$, set $\omega=t-\tau\implies d\omega=-d\tau,\omega(0)=t,\omega(1)=t-1$ so we get: $2\int_{0}^{1} f(t - \tau)d\tau\to-2\int_{t}^{t-1} f(\omega)d\omega\to2\int_{t-1}^{t} f(\omega)d\omega$
Can you solve this kind of intervals?
I learnt that playing with functions can help a lot for intuition.
for example: try: $t=-5,t=0.5,t=1,t=2,t=3.5,t=5$ and see what happens. after that try to find intervals for which the function gives the same value, see how it connects to the original $4$ cases i presented, what is the same and what is different.
A: Those guys only make confusion. I will answer you with a very easy method you can use with piecewise functions.
First of all you have two steps functions, which you can easily figure in your mind to be like 2 dimensional boxes of height $2$.
Think about them as two boxes, one of which has to move towards the other. Those are two signals, and the convolution is nonzero only when they do intersect. Figure it out as the following picture:

Before some obnoxious arsehole points it out: this figure does not represent your problem but it's a great help to figure it out.
The first box goes from $0$ to $1$, whilst the second one goes from $\tau -3$ to $\tau$.
In your case, you maintain the smallest step function you have, that is the $g$ and you make $f$, the larger step, to move towards the first box.
Hence you will follow several steps.
Step 1
The signals are like the above figure: separated. In this case, their convolution is simply zero which happens in the range 
$$\tau - 3 > 1$$
That is
$$\tau > 4$$
Step 2
The larger box start to insinuate itself onto the smallest, hence you will have
$$\int_{\tau -3}^1 4\ d\tau = 16 - 4\tau$$
And this happens in the range
$$\begin{cases} 0 < \tau -3 \\ 1 > \tau -3 \end{cases}$$
Which means
$$3 < \tau < 4$$
Step 3
The big box is all passing through the small box, id est the smaller is totally contained into the larger. Hence
$$\int_0^1 4\ d\tau = 4$$
In the range 
$$\begin{cases} 0 > \tau -3 \\ 1 > \tau  \end{cases}$$
Which means
$$1 < \tau < 1$$
Step 4
Now the larger box fades away, but with a bit to it still inside the smaller box.
$$\int_0^{\tau} 4\ d\tau = 4\tau$$
Which happens in the range
$$0< \tau < 1$$
Step 5
Finally the big box goes away, and the convolution is zero again for 
$$\tau < 0$$
At the end you have your result:
$$f*g = \begin{cases} 0 & \tau > 4 \\  16 - 4\tau & 3<\tau < 4 \\ 4 & 1<\tau < 3 \\ 4\tau &  0 < \tau < 1 \\ 0 & \tau < 0  \end{cases}$$
This is a trapezoid, and if you plot it you will get

As it has to be.
