2

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:

  1. 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$.
  2. Then we find a basis of orthogonal polynomials relative to that inner product using Gram-Schmidt.
  3. $x_i$ are the roots of the 3rd degree polynomial we get using this process.

Then we want to find $A_i$:

  1. 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) $$
  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! :)

Hila
  • 1,919
  • Can you write everything you wrote in your exam? I am not sure what you were doing. – Batominovski Aug 02 '15 at 16:33
  • @Batominovski Done. Now that I look at my extended explanation, I see that I get too many equations in my last step, so it makes sense that I'm wrong. – Hila Aug 02 '15 at 16:47
  • 3
    Your error is to assume that Gaussian quadrature will work if there are derivatives involved in the approximation. – Batominovski Aug 02 '15 at 17:01

2 Answers2

2

A quick work would be as follows. By symmetry ($x\mapsto -x$ in the integral), we can see that $x_0=0$ and $x_1+x_2=0$. By integrating with $P_0$, we obtain $A_0=1$. With $P_1$, we get $A_0+A_1=0$. By integrating with $P_2$, $\frac{1}{2}=2A_1x_1+2A_2x_2$. With $P_4$, we get $\frac13=4A_1x_1^3+4A_2x_2^3$. Thus, $A_1x_1=\frac{1}{8}$ and $A_1x_1^3=\frac{1}{24}$, or $x_1^2=\frac{1}{3}$. We can assume without loss of generality that $x_1=+\frac1{\sqrt3}$ and $x_2=-\frac1{\sqrt3}$. Hence, $A_1=+\frac{\sqrt{3}}{8}$ and $A_2=-\frac{\sqrt{3}}{8}$.

Batominovski
  • 49,629
1

Due to the fact that both the integration segment $[-1,1]$ and $\omega(x)$ are symmetric to the transformation $x \to -x$, one might look for a quadrature with the same symmetry. That is weights $A_i$ should satisfy (the minus comes from the fact that replacing $x$ with $-x$ also negates the first derivatives): $$ A_1 = -A_2 $$ and the abscissae should satisfy $$ x_1 = -x_2 \equiv, \quad x_0 = -x_0 = 0. $$ Thus letting $A = A_0, B = A_1, \xi = x_1$ $$ \int_{-1}^{1} f(x) |x|dx = A f(0) + B \left(f'(\xi) - f'(-\xi)\right). $$ Also, since we are already restricting ourselves to symmetric quadratures, we don't need to check every polynomial $x^{k}, k = 0,\dots, 5$, but only those, that are symmetric (there is a theorem for that fact, but it is quite obvious that $\int_{-1}^{1}x^{2m+1}|x|dx = 0$ both for the exact integration and the quadrature rule).

As I said, it is necessary to check only symmetric (even for the case) polynomials $P_1 = x^0 = 1, P_2 = x^2$ and $P_3 = x^4$. That will give three equations for three parameters - quite sane. $$ \int_{-1}^1 |x| dx = 2\int_0^1 xdx = 1 = A \cdot P_1(0) = A,\quad \Rightarrow A = 1\\ \int_{-1}^1 x^2|x| dx = 2\int_0^1 x^3dx = \frac{1}{2} = B(2\xi + 2\xi) = 4\xi B,\quad \Rightarrow 4\xi B = \frac{1}{2}\\ \int_{-1}^1 x^4|x| dx = 2\int_0^1 x^5dx = \frac{1}{3} = B(4\xi^3 + 4\xi^3) = 8\xi^3 B,\quad \Rightarrow 8\xi^3 B = \frac{1}{3}\\ $$ Thus either $\xi = \frac{1}{\sqrt{3}}, B = \frac{\sqrt{3}}{8}$ or $\xi = -\frac{1}{\sqrt{3}}, B = -\frac{\sqrt{3}}{8}$. Both gives essentially the same rule $$ \int_{-1}^1 f(x) |x| dx \approx f(0) + \frac{\sqrt{3}}{8} \left( f'\left(\frac{1}{\sqrt{3}}\right) - f'\left(-\frac{1}{\sqrt{3}}\right) \right) $$

uranix
  • 7,503