Need help to understand the integral rules used solving the convolution of two functions

Hint. Note that $f(x-t)=2$ when $0\leq x-t\leq 1$, i.e. $x-1\leq t\leq x$, otherwise it is zero. Hence $$\int_{-\infty}^{\infty} g(t)f(x-t)dt=\int_{x-1}^x g(t)2 dt.$$ Now if $x\in[0,1)$ then what is $g(t)$ for $t\in [x-1,0]$? And for $t\in [0,x]$?


I'm assuming

$$ f(x)=\begin{cases} 2 & x\in [0,1] \\ 0 & else \end{cases} $$

And

$$ g(x)=\begin{cases} x & x\in [0,1] \\ 2-x & x\in [1,2)\\ 1 & x\in [2,3] \\0 & else \end{cases} $$

Adding this together, we see $$ \int_{-\infty}^{\infty} g(t)f(x-t)\textrm{d}t=2\int_{1-x}^x g(t)\textrm{d}t, $$ since for these values of $t,$ $f(x-t)=2$ and for all other values of $t$, $f(x-t)$ is $0$.

Now, $g(t)=0$ for $t\leq 0$ so $$ 2\int_{1-x}^x g(t)\textrm{d}t=2\int_0^x g(t)\textrm{d}t=2\int_0^x t\textrm{d}t, $$ simply by plugging into the definition of $g$.


Observe that integrand $g(t)f(x-t)$ (where $x$ is fixed and $t$ is ranging over $\mathbb R$) takes value $0$ for every $t\notin[0,x]$.

This justifies to replace $\int_{-\infty}^{\infty}\cdots$ by $\int_0^x\cdots$.

Further for any fixed $x\in[0,1)$ it is true that $g(t)f(x-t)=t2$ on interval $[0,x]$.