# Why is the convolution of two box kernels a triangle kernel? [duplicate]

Can anyone show the mathematical steps proving

$$K_{box}*K_{box} = K_{triangle}$$

Consider the simple case where $$K_\text{box}(x) = \mathbb{I}(0 \leqslant x \leqslant 1)$$. Then you have:
\begin{aligned} (K_\text{box}*K_\text{box})(r) &= \int \limits_\mathbb{R} K_\text{box}(x) K_\text{box}(r-x) dx \\[6pt] &= \int \limits_\mathbb{R} \mathbb{I}(0 \leqslant x \leqslant 1) \cdot \mathbb{I}(0 \leqslant r-x \leqslant 1) \ dx \\[6pt] &= \int \limits_\mathbb{R} \mathbb{I}(0 \leqslant x \leqslant 1) \cdot \mathbb{I}(r-1 \leqslant x \leqslant r) \ dx \\[6pt] &= \begin{cases} \int_0^1 \mathbb{I}(0 \leqslant x \leqslant r) \ dx & & & \text{for } 0 \leqslant r \leqslant 1, \\[10pt] \int_0^1 \mathbb{I}(r-1 \leqslant x \leqslant 1) \ dx & & & \text{for } 1 < r \leqslant 2, \\[10pt] 0 & & & \text{otherwise}. \\[10pt] \end{cases} \\[10pt] &= \begin{cases} r & & & \text{for } 0 \leqslant r \leqslant 1, \\[10pt] 2 - r & & & \text{for } 1 < r \leqslant 2, \\[10pt] 0 & & & \text{otherwise}. \\[10pt] \end{cases} \\[10pt] &= K_\text{triangle}(r). \\[6pt] \end{aligned}
I think a 1D solution would suffice to give you an idea. Let $$x(t)=1$$ when $$0. Convolution with itself can be formulated as
$$y(t)=x(t)*x(t)=\int_{-\infty}^{\infty}x(\tau )x(t-\tau )d\tau =\int_{0}^{1}x(t-\tau )d\tau$$
There are four major cases here. When $$t<0$$ or $$t>2$$, $$y(t)=0$$ since there is no $$\tau$$ in $$[0,1]$$ that makes inside of the integral non-zero. For $$0, we have $$y(t)=\int_{0}^{t}d\tau=t$$. For $$1, we have $$y(t)=\int_{t-1}^{1}d\tau=2-t$$. When you sketch it, you’ll see the triangle.