Start from the definition of a Gauss quadrature:
$$\int_{-1}^1 f(x)\ dx \approx \sum_{i=1}^3 g_i f(x_i).$$
We perform a change of variables to change the range of integration, so
$$\int_a^b f(x)\ dx = \frac{b-a}{2}\int_{-1}^1 f\left(\frac{b-a}{2}z+\frac{b+a}{2}\right)\ dz.$$
Apply gaussian quadrature to the new integral on the right.
$$\frac{b-a}{2}\int_{-1}^1 f\left(\frac{b-a}{2}z+\frac{b+a}{2}\right)\ dz \approx \frac{b-a}{2}\sum_{i=1}^3 g_i f\left(\frac{b-a}{2}z_i+\frac{b+a}{2}\right).$$
With a three-point quadrature, our points are $x_1 = a, x_2 = \frac{a+b}{2}, x_3 = b$. These correspond to $z_1 = -1, z_2 = 0, z_3 = 1$.
Plugging these in, we find
$$\begin{align*}
\int_a^b f(x)\ dx \approx \frac{b-a}{2}& \left[g_1 f\left(\frac{b-a}{2}\cdot -1
+ \frac{a+b}{2}\right)\right. \\
&+\left.g_2 f\left(\frac{b-a}{2}\cdot 0
+ \frac{a+b}{2}\right)\right. \\
&+ \left.g_3 f\left(\frac{b-a}{2}\cdot 1
+ \frac{a+b}{2}\right)\right].
\end{align*}$$
The right-hand side simplifies to $$\frac{b-a}{2}\left[ g_1 f(a) + g_2 f\left(\frac{a+b}{2}\right) + g_3 f(b)\right].$$
Now you can see the function arguments are in the right form, and now all you have to do is compute the weights, which is straightforward since $g(x) = 1$. You can use $g_i = \int_\alpha^\beta g(x) \prod_{\substack{1 \le j \le 3 \\ j \neq i}} \frac{x-x_j}{x_i-x_j}\ dx$. But note that we've already done the change of variables to shift $[a,b]$ to $[-1,1]$ in the quadrature, so $\alpha = -1$ and $\beta = 1$. It is very straightforward to compute the integrals.
For $g_1$, we have
$$g_1 = \int_{-1}^1 \frac{x-0}{-1-0}\cdot \frac{x-1}{-1 - 1}\ dx = \frac12\left[\left.\frac{x^3}{3}\right|_{-1}^1 - \left.\frac{x^2}{2}\right|_{-1}^1\right] = \frac12\left[\frac13+\frac13-\left(\frac12-\frac12\right)\right] = \frac13.$$
You should find that $g_2$ and $g_3$ are similar. The result follows.
– tenpercent Dec 04 '13 at 17:32http://en.wikipedia.org/wiki/Gaussian_quadrature, the part about fundamental theorem. Am I not right?