Method of moments on uniform distributions I need help on how to find the estimates $a$ and $b$ in the uniform distribution $\mathcal U[a,b]$ using the method of moments.
This is where I am at:
I have found $U_1=\overline X$ and $m_1=\frac{a+b}2$ Also, $m_2=\frac1{n(E(X_i^2)}$ and $u_2=E(X_i^2)$ when I equate $m_1$ to $u_1$ and $m_2$ to $u_2$ I should find the estimates,right? I am unable to solve that.Kindly help.
 A: The population mean is $\dfrac{a+b}{2}$.  The population variance is $\dfrac{(b-a)^2}{12}$.  If you have already found that the popuation variance of the $\mathcal U[0,1]$ distribution is $1/12$, just notice that the length of the interval has been multiplied by $b-a$, and that is a scale factor, so you multiply the variance by $(b-a)^2$.  Hence the second moment is
$$
\frac{(b-a)^2}{12}+\left(\frac{a+b}{2}\right)^2 = \frac{a^2+b^2+ab}{3}.
$$
So the equations to be solved for $a$ and $b$ are:
\begin{align}
\frac{x_1+\cdots+x_n}{n} &  = \frac{a+b}{2} \\[10pt]
\frac{x_1^2+\cdots+x_n^2}{n} & = \frac{a^2+b^2+ab}{3}
\end{align}
One way would be to solve the first equation for $b$ and then substitute that for $b$ in the second equation, getting a quadratic equation in $a$:
$$
b = 2\bar x - a,
$$
$$
\frac{x_1^2+\cdots+x_n^2}{n} = \frac{a^2+(2\bar x - a)^2+a(2\bar x-a)}{3}
$$
$$
\frac{x_1^2+\cdots+x_n^2}{n} = \frac{a^2 + 2\bar x a + 4\bar x^2}{3}
$$
$$
a^2 + 2\bar x a + \left(4\bar x^2 - 3\frac{x_1^2+\cdots+x_n^2}{n}\right)=0.
$$
Then proceed the way you usually do with quadratic equations.
PS: Completing the square gives
$$
\begin{align}
a^2 + 2\bar x a + \bar x^2 + 3\left(\bar x^2 - \frac{x_1^2+\cdots+x_n^2}{n}\right)& = 0\\[10pt]
(a+\bar x)^2 & = 3\left(\frac{x_1^2+\cdots+x_n^2}{n} - \bar x^2\right) \\[10pt]
(a+\bar x)^2 & = 3s^2
\end{align}
$$
where this is taken to define the notation $s^2$.  That means $s^2$ is the sample variance if that is taken to mean the version with $n$ rather than $n-1$ in the denominator.
