integrals involving minimum function {a,1-a,b,1-b} I could not compute this integral. please help out! $0\le a,b \le 1$
$$f(a) = \int_0^1 \min{(a,1-a,b,1-b)}db$$
 A: Think of the integrand as
$$\frac12 \min{\left[\min{(a,1-a)},\min{(b,1-b)} \right]}$$
which is the same as
$$\frac12 \min{\left[1-2\left|a-\frac12\right|, 1-2\left|b-\frac12\right|\right]}$$
You get the insight you need by drawing a picture.  When $a \in [0,1/2)$, we have
$$\min{\left[1-2\left|a-\frac12\right|, 1-2\left|b-\frac12\right|\right]} = \begin{cases} \\1-2\left|b-\frac12\right| & b \in [0,a)\\1-2\left|a-\frac12\right| & b \in [a,1-a) \\ 1-2\left|b-\frac12\right| & b \in [1-a,1] \end{cases}$$
so that the integral for $a \in (0,1/2)$ is
$$\frac12 \int_0^a db \, \left [ 1-2\left|b-\frac12\right|\right] + \frac12 \int_a^{1-a} db \,\left [ 1-2\left|a-\frac12\right|\right] + \frac12 \int_{1-a}^1 db \, \left [ 1-2\left|b-\frac12\right|\right] $$
To get the integral for $a \in (1/2,1)$, just substitute $a \leftarrow 1-a$ in the above integrals.
ADDENDUM
To see how this gets evaluated, let's look at the case $a \lt 1/2$ again.  The integrals become
$$\begin{align}\frac12 \int_0^a db \, 2 b +  \frac12 \int_a^{1-a} db \, 2 a + \frac12 \int_{1-a}^1 db \, (2-2 b)  &= \frac12 a^2 + a (1-2 a) + a - \frac12 [1-(1-a)^2] \\ &= a - a^2\end{align}$$
A: The minimum of linear functions is piecewise linear.
If $b\le \min\{a,1-a\}$ (i.e. $b\le a$ and $b\le 1-a$), then of course $b\le \frac12$ (because $2b=b+b\le a+(1-a)=1$) and hence $b\le 1-b$, so we find 
$$ \min\{a,1-a,b,1-b\}=b\qquad\text{if }b\le\min\{a,1-a\}.$$
Similarly, we find
$$ \min\{a,1-a,b,1-b\}=1-b\qquad\text{if }b\ge\max\{a,1-a\}.$$
On the other hand, if $\min\{a,1-a\}\le b\le \max\{a,1-a\}$, then also  $\min\{a,1-a\}\le 1-b\le \max\{a,1-a\}$, hence 
$$ \min\{a,1-a,b,1-b\}=\min\{a,1-a\}\qquad\text{if }\min\{a,1-a\}\le b\le\max\{a,1-a\}.$$
Thus the graph of the function $b\mapsto \min\{a,1-a,b,1-b\}$ looks like a trapezoid with height $h=\min\{a,1-a\}$, lower base $w_1=1$, and upper base length $w_2=\max\{a,1-a\}-\min\{a,1-a\}$. 
That is, if $a\le 1-a$, then the height is $a$ and the upper base length is $(1-a)-a=1-2a$; and if $a\ge1-a$, the height is $1-a$ and the upper base length is $a-(1-a)=2a-1$. As the area is $A=\frac{h(w_1+w_2)}{2}$, we obtain
$$A=\frac{a\cdot((1-2a)+1)}{2}=a(1-a)\qquad\text{and}\qquad A=\frac{(1-a)\cdot((2a-1)+1)}{2}=a(1-a),$$
respectively. This area is also the integral in question.
