# Find quadrature points and weights

I'm struggling with the following problem:

What is the maximum degree of exactness that we can obtain with the following quadrature >formula $$\int_0^1 f(x)\frac{1}{\sqrt{x}}dx \approx w_0 f(x_0) + w_1 f(x_1)$$

Compute weights and nodes

I should use some theorem, but I can't understand which one! Also, I think that the maximum degree is $$r=3$$, because in this case, imposing the exactness I will end up with a system of $$4$$ equations in $$4$$ unknowns.

I choose a basis of $$\mathbb{P}^{3} = \{1,x,x^2,x^3\}$$, and I obtain

$$\begin{cases} w_0+w_1 = 2 \\ w_0x_0 + w_1x_1 = \frac23 \\ w_0x_0^2 + w_1x_1^2 = \frac25 \\ w_0 x_0^3 + w_1 x_1^3 = \frac27 \\ \end{cases}$$

but the solution seems too hard to do by hand. Am I missing something? How can I decide a priori the degree of exactness.

You need to use the so called Gauss–Jacobi quadrature with $$\alpha = 0$$ and $$\beta = -\frac{1}{2}$$. If you look at the error term, you see that you can integrate exactly for a degree up to $$2n-1$$ with a $$n$$ points scheme.

You want to use this theorem about Gaussian quadrature, theorem 3.6.12 in  for a book reference. In your case for two points with the weight function $$x \mapsto \frac{1}{\sqrt{x}}$$ on the interval $$(0,1)$$, you want to find the roots of $$P_2$$ where $$(P_n)_{n \ge 0}$$ are the orthogonal polynomials associated with the scalar product $$\langle f,g\rangle = \int_0^1 f(x)\, g(x)\, \frac{\mathrm{d}x}{\sqrt{x}}.$$
• Set $$P_0 = 1$$.
• Find $$P_1 = x + a$$ such that $$\langle P_0, P_1\rangle = 0$$.
• Find $$P_2 = x^2 + bx + c$$ such that $$\langle P_0, P_2\rangle = 0$$ and $$\langle P_1, P_2\rangle = 0$$.
• Find the roots of $$P_2$$ for the points $$x_0$$ and $$x_1$$.
• Solve for example $$\begin{cases} w_0 + w_1 = 2\\ w_0 x_0 + w_1 x_1 = \frac{2}{3} \end{cases}$$ to get the weights $$(w_0, w_1)$$.
• So I can integrate exactly polynomials of degree $3$ , as I expected. But in any case, I don't know how to compute the weights and nodes by hand, because this exercise was in a written exam – lukk Sep 9 '20 at 11:22