Derive the one and two-point Gaussian quadrature formulas for $$I=\int^1_0xf(x)dx\approx \sum_{j=1}^nw_jf(x_j)$$ with weight function $w(x)=x$.

Which I know how to do and which I attached below (I will re-edit this sometime in the future by deleting my attachment and writing it in LaTex).

My question is:

How can I do this problem when asked of three-point Gaussian quadrature with the weighted function $x^2$ and when $\int^1_0xf(x)dx\approx \sum_{j=1}^3w_jf(x_j)$? • You might be interested in my determination of the GQ quadrature points and weights for this case in this SciComp.SE Answer. – hardmath Sep 8 '14 at 11:49

I think you should follow the same procedure you have done above. \begin{align*} \int_{0}^{1}x^{2}f(x)dx & \thickapprox w_{1}f(x_{1})+w_{2}f(x_{2})+w_{3}f(x_{3}) \end{align*} \begin{align*} f(x)=1\Longrightarrow w_{1}+w_{2}+w_{3} & =\int_{0}^{1}1.x^{2}dx=1/3\\ f(x)=x\Longrightarrow w_{1}x_{1}+w_{2}x_{2}+w_{3}x_{3} & =\int_{0}^{1}x.x^{2}dx=1/4\\ & \vdots\\ f(x)=x^{5}\Longrightarrow w_{1}x_{1}^{5}+w_{2}x_{2}^{5}+w_{3}x_{3}^{5} & =\int_{0}^{1}x^{5}.x^{2}dx=1/8 \end{align*} So you have a nonlinear system of equations. You should solve it with a solver. \begin{align*} \int_{a}^{b}w(x)f(x)dx & \thickapprox \sum_{j=1}^{n} w_{j}f(x_{j}) \end{align*}\qquad (*)
Additionally as i know in $(*)$ the node points $x_i$ are the zeros of the n-th degree orthogonal polynomial on $[a, b]$ with respect to weight function $w(x)$.