Solution (source code)

= Solution

The scaled maximum
$$
U=\frac{M}{2\theta}=\frac{\widehat\theta}{\theta}
$$
has <cumulative distribution function> $\mathbb P(U\le u)=u^n$ for $0\le u\le1$. Thus
$$
\mathbb E[U]=\frac n{n+1},
\qquad
\mathbb E[U^2]=\frac n{n+2}.
$$
The <mean squared error> of the maximum likelihood estimator is therefore
$$
\operatorname{MSE}(\widehat\theta)
=\theta^2\mathbb E[(U-1)^2]
=\boxed{\frac{2\theta^2}{(n+1)(n+2)}}.
$$

Each $X_i$ from the <uniform distribution> on $[0,2\theta]$ has mean $\theta$ and variance $\theta^2/3$. The sample mean is unbiased and has variance $\theta^2/(3n)$, hence
$$
\boxed{\operatorname{MSE}(\widetilde\theta)=\frac{\theta^2}{3n}}.
$$