Understanding an integral related to copulas I am trying to understand the following example 5.1 from page 160 of Nelsen's book "Introduction to copulas".
$\int\int_{I^2} M(u,v)dM(u,v)=\int_0^1 u du$ 
where $M(u,v)=min(u,v)$ is Frechet-Hoeffding's upper bound. Using
$dM(u,v)=\frac{\partial M}{\partial u} du+\frac{\partial M}{\partial v}dv$ 
I get 
$ dM(u,v) = \left\{
  \begin{array}{l l}
    du& \quad \text{if $u<v$ }\\
    dv& \quad \text{if $u>v$}
  \end{array} \right.$
If the above is correct, how does it lead to the above answer in the book? Note that $M(u,v)$ is singular. 
 A: The integral represents the expectation of $M(U,V)$ where $(U,V)$ form a bivariate distribution with uniform marginals on the interval $[0,1]$.  The copula $M(u,v)$ itself characterizes the case of perfect correlation: $\Pr(U=V)=1$.  Thus the expectation must be the same as that of $M(U,U) = \min(U,U) = U$ where $U$ has a uniform distribution.  That expectation obviously is $\int_0^1 u du$.

This argument is supported by a formal calculation.  Let $f$ be any integrable function defined on $I^2 = [0,1]\times[0,1]$.  From the definition
$$\mathrm d M(u,v) = \frac{\partial^2M}{\partial u\partial v}(u,v)\mathrm{d}v\,\mathrm{d}u$$
we may write
$$\eqalign{
\iint_{I^2} f(u,v) \mathrm d M(u,v) &= \iint_{I^2} f(u,v) \frac{\partial^2M}{\partial u\partial v}(u,v)\mathrm{d}v\,\mathrm{d}u \\
&= \int_0^1 \left(\int_0^1 f(u,v) \frac{\partial^2M}{\partial u\partial v}(u,v)\mathrm{d}v\right)\mathrm{d}u.
}$$ 
Integration by parts converts the inner integral into
$$g(u) = \left(f(u,v) \frac{\partial M}{\partial u}(u,v)\right)\Bigg|_{v=0}^{v=1} - \int_0^1\frac{\partial f}{\partial v}(u,v)\frac{\partial M}{\partial u}(u,v)\mathrm{d}v .$$
For fixed $v$, the function $u\to M(u,v)$ equals $u$ for $u\le v$ and otherwise is fixed at $v$.  Therefore its derivative equals $1$ for $u\lt v$, $0$ for $u\gt v$, and is undefined otherwise-but that doesn't matter, because the set where $v=0$ has measure zero.  Assuming $0 \lt u \lt 1$, this shows  $\frac{\partial M}{\partial u}(u,1)=1$ and $ \frac{\partial M}{\partial u}(u,0)=0$. (The cases $u=0$ and $u=1$ do not contribute anything to the integral anyway.) Use this result to simplify the integration of $g(u)$ and break the integral at $u$ to accommodate the sudden change in the value of $\frac{\partial M}{\partial u}$ when $v=u$:
$$\eqalign{
g(u) &= \left(f(u,1)(1) - f(u,0)(0)\right) - \int_0^1\frac{\partial f}{\partial v}(u,v)\frac{\partial M}{\partial u}(u,v)\mathrm{d}v\\
&= f(u,1) - \int_0^u \frac{\partial f}{\partial v}(u,v)(0)\mathrm{d}v - \int_u^1 \frac{\partial f}{\partial v}(u,v)(1)\mathrm{d}v  \\
&= f(u,1)  - 0 - f(u,v)\Big|_{v=u}^{v=1} \\
&= f(u,1) - \left(f(u,1) - f(u,u)\right) \\
&= f(u,u).
}$$
Plugging this into the original double integral yields
$$\iint_{I^2} f(u,v) \mathrm d M(u,v) = \int_0^1 g(u) \mathrm{d}u = \int_0^1 f(u,u) \mathrm{d}u.$$
Setting $f(u,v) = M(u,v)$ (which, being continuous, is integrable) and noting $f(u,u) = M(u,u) = \min(u,u) = u$ produces the desired result.
