how to solve double integral of a min function

Solution 1:

Consider $\min(s,t)$ as a function of $t$: its value is $t$ when $t\le s$, and $s$ when $t\ge s$. Thus, it can be described as $$\min(s,t)=\begin{cases}t,&0\le t\le s\\ s,&s\le t\le T\;. \end{cases}$$

Integrating this with respect to $t$ over the interval $[0,T]$ gives you

$$\int_0^s t\, dt + \int_s^T s \,dt\;,$$

which is therefore the same as $$\int_0^T \min(t,s)\, dt\;.$$

Solution 2:

By breaking up the range of integration we get $$ \int_0^T \min(t,s)\, dt\ = \int_0^s \min(t,s)\, dt + \int_s^T \min(t,s) \,dt$$ and noting that when $0\leq t\leq s$ we have $\min(t,s)=t$ and when $s\leq t\leq T$ we have $\min(t,s)=s$ we get that $$\int_0^s \min(t,s)\, dt + \int_s^T \min(t,s) \,dt=\int_0^s t\, dt + \int_s^T s \,dt$$ thus integrating from $0$ to $T$ with respect to $s$ gives $$\int_0^T \int_0^T \min(t,s)\, dt\, ds = \int_0^T \left(\int_0^s t\, dt + \int_s^T s \,dt\right) ds .$$