Find weights and coefficients such that quadarature formula is exact 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.
 A: You are correct, you can get the order of exactness $3$ - defined as the quadrature producing the exact answer for that order polynomial and less.  If you have quadrature with $N$ function evaluations, the order of exactness will always be $2N-1$.  This is in Theorem $3.6.12$ from "Introduction to Numerical Analysis" by Stoer and Bulirsch.
You start by constructing the orthogonal polynomials by using the Gram-Schmidt procedure, and this has been done for this weighting function already here: Gaussian Quadrature - Construction
The polynomials resulting from Gram-Schmidt are
$$
p_0(x)=1\\
p_1(x)=x-\frac{1}{3}\\
p_2(x)=x^2-\frac{6}{7}x +\frac{3}{35}.
$$
Choose the nodes to be the zeros of $p_2(x)$, which are $x_i\in \left\{\frac{2}{35}\sqrt{30} \mp \frac{3}{7} \right\}$.  Then make sure the orthogonality conditions are satisfied by the quadrature method
$$
\int_0^1 p_n(x)\frac{1}{\sqrt{x}}dx=\sum_{i=0}^2 w_ip_n(x_i)=\delta_{n,0}2
$$
where the 2 came from the integral of $p_0(x)$.  This results in the matrix equation
$$
\left[\begin{array}{cc}
1 & 1 \\
\frac{2}{21}-\frac{2}{35}\sqrt{30} & \frac{2}{21}+\frac{2}{35}\sqrt{30}
\end{array}\right]
\left[\begin{array}{c}
w_0\\
w_1
\end{array}\right] =\left[\begin{array}{c}
2\\
0
\end{array}\right]
$$
which has solution $w_i\in \left[1\pm\frac{1}{18}\sqrt{30} ​\right]$.
