Double Integral of Minimum Function I was trying to solve the following integral:
$$
\begin{equation}
\int _0^{\alpha }\int _0^{\beta }\min (x,y)dydx \tag{1} \label{eq:1}
\end{equation}
$$
with $\alpha,\beta > 0$, (generally, $\alpha \ne \beta$).
I've found a question from MSE (how to solve double integral of a min function) where an user suggested the following equivalence:
$$
\begin{equation}
\int_0^{\beta } \min (x,y) \, dy =\int_0^x \min (x,y) \, dy+\int_x^{\beta } \min(x,y) \, dy \\ =\int_0^x y \, dy+\int_x^{\beta } x \, dy \tag{2} \label{eq:2}
\end{equation}
$$
The explanation is in link above and I also found it by myself. The issue is that the $(1)$ and the $(2)$ inserted in $(1)$:
$$
\int _0^{\alpha }\int _0^{\beta }\min (x,y)dydx \tag{1}
$$
$$
\int _0^{\alpha } \bigg( \int_0^x y \, dy+\int_x^{\beta } x \, dy \bigg) dx \tag{3}
$$
are giving me different results. In fact, generally, through different cases of $\alpha$ and $\beta$ I set, it seems that, if $\beta \ge \alpha$, the $(1)$ and $(3)$ are equivalent, else they aren't.
What am I missing? Have I to suppose some conditions for the $(2)$ is effective? Is there a problem of integral interchange?
 A: If $\alpha<\beta$, we have
$$\begin{align}
\int_0^\alpha \int_0^\beta \min(x,y)\,dy\,dx&=\int_0^\alpha \int_0^\alpha \min(x,y)\,dy\,dx+\int_0^\alpha \int_\alpha^\beta \min(x,y)\,dy\,dx\\\\
&=\int_0^\alpha \left(\int_0^x \min(x,y)\,dy\,dx+\int_x^\alpha \min(x,y)\,dy\,dx\right)+\int_0^\alpha \int_\alpha^\beta \min(x,y)\,dy\,dx\\\\
&=\int_0^\alpha \int_0^x y\,dy\,dx+\int_0^\alpha \int_x^\alpha x\,dy\,dx+\int_0^\alpha \int_\alpha^\beta x\,dy\,dx\\\\
&=\int_0^\alpha \int_0^x y\,dy\,dx+\int_0^\alpha \int_x^\beta x\,dy\,dx
\end{align}$$
Can you finish now?
A: By definition
$$\min(x,y)=\begin{cases}x\le y\to x\\x\ge y\to y.\end{cases}$$
Then, assuming $\alpha\le\beta$ you can decompose the domain using
$$I=\int_{x=0}^\alpha\int_{y=0}^\beta\min(x,y)\,dy\,dx=\int_{x=0}^\alpha\int_{y=0}^x y\,dy\,dx+\int_{x=0}^\alpha\int_{y=x}^\beta x\,dy\,dx.$$
The condition is required because $y$ may not exceed $\beta$.
This gives
$$I=\int_0^\alpha\left(\frac{x^2}2+\beta x-x^2\right)dx=\frac{\alpha^2\beta}2-\frac{\alpha^3}6=\alpha^2\frac{3\beta-\alpha}6.$$
And by swapping $\alpha,\beta$, $$\alpha\ge\beta\to I=\beta^2\frac{3\alpha-\beta}6.$$
A: Probabilistic approach
Without loss of generality assume $\alpha<\beta$. Let us define two independent random variables $X\sim \text{Unif}[0,\alpha]$ and $Y\sim\text{Unif}[0,\beta]$. 
The integral you asked for is just: $\alpha\beta \mathbb{E}[\min\{X,Y \}]$
Define $Z=\min\{X,Y\}$. The density function of $Z$ can be obtained via straightforward calculation:
\begin{align}
f_Z(z) = 
\begin{cases}
\frac{1}{\alpha}+\frac{1}{\beta}-2\frac{z}{\alpha \beta}  & \text{ for } z\in[0,\alpha] \\
0 & \text{otherwise}
\end{cases}
\end{align}
Thus:
\begin{align}
\mathbb{E}[\min\{X,Y\}]=\mathbb{E}[Z]=\int_0^\alpha z f_z(z) \mathrm d z = \int^\alpha_0 \frac{z}{\alpha} +\frac{z}{\beta} - \frac{2z^2}{\alpha \beta} \mathrm dz = \frac{\alpha}{2}-\frac{\alpha^2}{6\beta}
\end{align}
Finally,
\begin{align}
\int^\alpha_0 \int^\beta_0 \min\{x,y\} \mathrm d y \mathrm dx = \alpha\beta \mathbb{E}[Z] = \frac{\alpha^2\beta}{2}-\frac{\alpha^3}{6}
\end{align}
A: When $\alpha\lt\beta$, we have

$$
\begin{align}
\int_0^\alpha\int_0^\beta\min(x,y)\,\mathrm{d}y\,\mathrm{d}x
&=\overbrace{2\int_0^\alpha\int_0^xy\,\mathrm{d}y\,\mathrm{d}x}^\text{integral over square}+\overbrace{\int_\alpha^\beta\int_0^\alpha y\,\mathrm{d}y\,\mathrm{d}x}^\text{integral over rectangle}\\
&=\frac13\alpha^3+\frac12\alpha^2(\beta-\alpha)\tag{1}
\end{align}
$$
Using $[\alpha\gt\beta]=\frac{\alpha-\beta+|\alpha-\beta|}{2(\alpha-\beta)}$ and $[\alpha\lt\beta]=\frac{\alpha-\beta-|\alpha-\beta|}{2(\alpha-\beta)}$ and $(1)$, we get
$$
\int_0^\alpha\int_0^\beta\min(x,y)\,\mathrm{d}y\,\mathrm{d}x
=\frac1{12}\left(|\alpha-\beta|^3-(\alpha+\beta)\left(\alpha^2-4\alpha\beta+\beta^2\right)\right)\tag{2}
$$
