Finding the method of moments estimator for the Uniform Distribution 
Let $X_1, \ldots, X_n \sim \text{Uniform}(a,b)$ where $a$ and $b$ are unknown paramaters and $a < b$.
(a) Find the method of moments estimators for $a$ and $b$.
(b) Find the MLE $\hat{a}$ and $\hat{b}$.

For part (b), consider that
$$
f(x) = \begin{cases} 0 & \text{ if } x \notin [a,b] \\
                     1/(b-a) & \text{ if } x \in [a,b] \\
\end{cases} 
$$
Thus, the MLE estimate will be $(\min \{X_1, \ldots, X_n \}$, $\max \{X_1, \ldots, X_n \})$.
But what about part (a)?
 A: The first moment is
$$
\int_a^b x f(x)\,dx = \int_a^b \frac{x\,dx}{b-a} = \frac 1 2 \cdot \frac{b^2-a^2}{b-a} = \frac{b+a} 2.
$$
The second moment is
$$
\int_a^b x^2 f(x) \,dx = \int_a^b \frac{x^2\,dx}{b-a} = \frac 1 3 \cdot \frac{b^3 -a^3}{b-a} = \frac{b^2+ba+a^2} 3.
$$
So equate the sample moments with the population moments found above:
\begin{align}
& \frac{x_1+\cdots+x_n} n = \overline x = \frac{b+a} 2 \tag 1 \\[10pt]
& \frac{x_1^2+\cdots+x_n^2} n = \frac{b^2+ba+a^2} 3 \tag 2
\end{align}
It's routine to solve $(1)$ for $b$.  Plug that expression into $(2)$ wherever you see $b$.  You get a quadratic equation in $a$.  Solving a quadratic equation can be done by a known algorithm.  You get two solutions.  The estimate of $a$ will be the smaller of the two (Exercise: Figure out why it's the smaller one).
A bit of algebra that may be useful in simplifying the answer is this:
$$
\frac{x_1^2+\cdots+x_n^2} n - \left(\frac{x_1+\cdots+x_n} n\right)^2 = \frac{(x_1-\bar x)^2 + \cdots + (x_n-\bar x)^2} n \text{ with } \bar x \text{ as above.}
$$
An alternative approach is to let $m$ be the midpoint of the interval $[a,b]$ and let $c$ be the half-length of the interval, so that the interval is $[m-c, m+c]$.  Then you'd have
\begin{align}
& \frac{x_1+\cdots+x_n} n = m, \\[10pt]
& \frac{x_1^2+\cdots+x_n^2} n = m^2 + \frac{c^2} 3.
\end{align}
It's easy to solve that for $m$ and $c$, and above you're given $a$ and $b$ as functions of $m$ and $c$.
Note: The method-of-moments estimators plainly omit some relevant information in the data.  The MLEs do not.  I won't be surprised if there are some sequences $x_1,\ldots,x_n$ for which the method-of-moments estimator of $b$ is smaller than $\max\{x_1,\ldots,x_n\}$, and if so, then a similar problem would aflict the estimator of $a$ in a data set that can easily be constructed from that one.  Maybe both pathologies could occur simultaneously.
