Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently doing filter designs and stumbled across this mathematical problem which I cannot understand. I was hoping for some insight from experts around this field to help me with this.

$$\sum_{m=0}^{M-1}\ h_{m}\ x^{m} = \sum_{m=0}^{M-1}\ g_{m}\ P_{m}\left(x\right)$$

where $P_{m}\left(x\right)$ is the Legendre polynomials and $x^{m}$ is the conventional polynomials.

I want to know the relationship between $g_{m}$ and $h_{m}$, what is the best approach? Is there a closed form solution for $h_{m}$?

Thanks in advance, and apologies if it is a silly question.

share|cite|improve this question
up vote 1 down vote accepted

I might as well: there is an algorithm, due to Salzer, for converting to and from different orthogonal polynomial expansions. (I previously talked about this algorithm here.) If you intend to do this entire business of conversions, I believe an algorithm might be more useful to you than an integral expression.

What follows are a few relevant Mathematica routines. Even though I used Mathematica, I hope that the algorithm is still transparent and easily translatable (the indexing starts from 1; some adjustment is necessary if the indexing in your language starts at 0):

monomialToLegendre[pc_?VectorQ] := 
 Module[{n = Length[pc] - 1, lc, q},
  lc[1] = pc[[n]]; lc[2] = Last[pc];
   q[1] = lc[1];
   lc[1] = pc[[n - k + 1]] + lc[2]/3;
    q[j] = lc[j];
    lc[j] = j lc[j + 1]/(2 j + 1) + (j - 1) q[j - 1]/(2 j - 3);
    , {j, 2, k - 1}];
   q[k] = lc[k];
   lc[k] = (k - 1) q[k - 1]/(2 k - 3);
   lc[k + 1] = k q[k]/(2 k - 1);
   , {k, 2, n}];
  Table[lc[k], {k, n + 1}]]

One could use Salzer again for converting from the Legendre to the monomial basis. However, it is a bit clearer (and gives rise to essentially the same method) to treat the problem as one of Taylor/Maclaurin expansion of the polynomial expressed in terms of Legendre polynomials. One can then use Clenshaw's algorithm for the purpose:

legendreToMonomial[lc_?VectorQ] := 
 Module[{n = Length[lc] - 1, pc, v = 0, w, z},
  pc[1] = Last[lc]; pc[_] = z[_] = 0;
   w = pc[1];
   pc[1] = lc[[j]] - v z[1];
   z[1] = w;
    w = pc[i];
    pc[i] = (2 j - 1) z[i - 1]/j - v z[i];
    z[i] = w;
    , {i, 2, n - j + 2}];
   v = (j - 1)/j;
   , {j, n, 1, -1}];
  Table[pc[j], {j, n + 1}]]

As an example, to demonstrate the identity


monomialToLegendre[legendreToMonomial[{5, -4, -2, 3, 1}]] ==
 {5, -4, -2, 3, 1}

legendreToMonomial[monomialToLegendre[{51/8, -17/2, -27/4, 15/2, 35/8}]] 
 == {51/8, -17/2, -27/4, 15/2, 35/8}
share|cite|improve this answer
You are a champ J.M.! Good to see it works, I will follow some of your recommended readings and see if I can understand a bit. Since I am using Matlab instead of Mathematica, I am having a hard time understanding your equations used to do the conversion =( – JuniorEngie Nov 29 '11 at 5:23
MATLAB supports loops, so it shouldn't be too hard. The indexed variables should be turned into proper arrays in MATLAB, of the same dimensions as the array of coefficients. – J. M. Nov 29 '11 at 5:46

I am assuming your domain is $(-1,1)$ else you would need to do some rescaling of the following argument. The main thing to exploit is that the Legendre polynomials are orthogonal i.e. $$\displaystyle \int_{-1}^{1} P_m(x) P_n(x) = \frac{2}{2n+1} \delta_{mn}.$$ Using this we get that $$g_n = \left(\frac{2n+1}{2} \right) \sum_{m=0}^{M-1} \left( h_m \int_{-1}^{1} x^m P_n(x) \right)$$

share|cite|improve this answer
Yes sir, the domain had been rescaled to [-1, 1] and thank you for the closed form expression! Much much appreciated. Just wondering will it be possible to revert the expression around to get $h_{m}$ instead? Sorry my maths is quite lacking. – JuniorEngie Nov 28 '11 at 8:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.