I'm going over an exam I failed. I was told that I can't use the method I used to solve the following question, and I don't know why.
Can you please explain and suggest a correct solution?
Question
Find $x_i$ and $A_i$ such that the following integration rule is exact for all polynomials of degree $\leq 5$: $$ \int_{1}^{-1}f(x)|x| dx \approx A_0 f(x_0) + A_1 f'(x_1) + A_2 f'(x_2) $$
My Attempt
I tried to choose $x_i$ as a Gaussian Quadrature (PDF, section 6.6) relative to the weight function $\omega(x) = |x|$ (which satisfies $\omega(x) \geq 0$ for all $x$ so we can use it to define a proper inner product).
Then I wrote a system of linear equations by applying the rule to $P_n(x) = x^n, n \in \{0..5\}$ and trying to solve it for $A_i$. I didn't have time to finish that part so I'm not sure why it doesn't work.
I assume my approach fails because the integration rule uses derivatives of $f$, is that correct?
What would be the correct approach for this problem?
Edit: Extended explanation for my approach
To find $x_i$ we look for a Gaussian Quadrature:
- We define the inner product $<f,g> = \int_{-1}^{1}f(x)g(x)|x|dx$. We can do this since $\omega(x) \geq 0$ for all $x$.
- Then we find a basis of orthogonal polynomials relative to that inner product using Gram-Schmidt.
- $x_i$ are the roots of the 3rd degree polynomial we get using this process.
Then we want to find $A_i$:
- For $n \in {0..5}$ we write the equation: $$ P_n(x) = x^n \\ \int_{-1}^{1}P_n(x)|x|dx = A_0P_n(x_0) + A_1P'(x_1) + A_2P'(x_2) $$
- The only thing we don't know how to calculate is the $A_i$'s so we get a system of linear equations that we can solve to find them.
Thanks! :)