Convolution of square function with itself I have the square function
$$f(x) = \begin{cases} 1, & 0 \leq x \leq 1 \\ 0, & \text{otherwise}\end{cases}$$
and I am trying to calculate the convolution $(f * f)(t)$ using the definition of convolution
$$(f*g)(t) = \int_{-\infty}^{\infty} f(\tau)g(t - \tau)d\tau$$
What I have so far is
$$(f*f)(t) = \int_{-\infty}^{\infty} f(\tau)f(t - \tau)d\tau$$
$$= \int_{-\infty}^{0} \underbrace{f(\tau)}_{\equiv 0}f(t - \tau)d\tau + \int_{0}^{1} f(\tau)f(t - \tau)d\tau + \int_{1}^{\infty} \underbrace{f(\tau)}_{\equiv 0}f(t - \tau)d\tau$$
$$= \int_{0}^{1} \underbrace{f(\tau)}_{\equiv 1}f(t - \tau)d\tau = \int_{0}^{1} f(t - \tau)d\tau$$
But now I don't understand how to go further, because the integrand is not continous. If you visualize the integral for diffent cases of $t$ one can see that the result must be
$$(f*f) (t) = \begin{cases} 0, &  t \lt 0 \\t,  & 0\leq t \le 1\\ 2- t, & 1\lt t \leq 2\\ 0 , & t \gt 2\end{cases}$$
but I don't see how to get there analytically. Could anyone help?

Here's a "trick" for convolving piecewise constant functions. 
Define $g:= f * f$. Note that $\dot g = f * \dot f$. Hence,
$$\dot g (t) = f (t) * (\delta (t) - \delta (t-1)) = f (t) - f (t-1)$$
where $\delta$ denotes the Dirac delta. Integrating,
$$g (t) = r (t) - 2 r (t-1) + r (t-2) = \begin{cases} t & \text{if } 0 \leq t \leq 1\\ 2 - t & \text{if } 1 \leq t \leq 2\\ 0 & \text{otherwise}\end{cases}$$
where
$$r (t) = \begin{cases} t & \text{if } t \geq 0 \\ 0 & \text{otherwise}\end{cases}$$
is the ramp function.
