General explicit solution to polynomial interpolation

  • Context: High School 
  • Thread starter Thread starter FranzS
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around finding a general explicit solution for polynomial interpolation of a set of points \((x_i, y_i)\) using a polynomial \(P_n(x)\) of degree \(n = m-1\). Participants explore the formulation of coefficients \(\beta_k\) for various values of \(m\) and discuss the patterns observed in the solutions.

Discussion Character

  • Exploratory, Technical explanation, Mathematical reasoning

Main Points Raised

  • One participant outlines the process of interpolating points with a polynomial and presents explicit solutions for coefficients \(\beta_k\) for \(m = 1\) to \(m = 5\).
  • It is noted that for each coefficient \(\beta_k\), there appears to be a common factor of \((-1)^{n+k}\) in front of the expression.
  • Participants discuss the form of the terms constituting each coefficient, suggesting that they take the form \(\frac{y_i \cdot A_i}{B_i}\), where \(A_i\) represents product combinations of \(x\) values excluding \(x_i\).
  • There is a question raised regarding the legitimacy of the notation used in the expression for \(B_i\), specifically whether it is valid to sum from \(j=1\) when \(i\) could also be \(1\) and the requirement is \(j \neq i\).
  • A general expression for the coefficients \(\beta_0\) and \(\beta_n\) is proposed, with a similar inquiry about the notation for a generic coefficient \(\beta_k\).

Areas of Agreement / Disagreement

Participants express uncertainty regarding the notation and formulation of the general expressions for the coefficients. There is no consensus on the correctness of the notation or the general expressions proposed.

Contextual Notes

The discussion highlights potential limitations in notation and assumptions regarding the indices used in summations, which remain unresolved.

FranzS
Messages
86
Reaction score
26
TL;DR
Searching for a proper notation to express the general explicit solution of the linear system of equation for solving polynomial interpolation.
In order to interpolate a number ##m## of points ##(x_i,y_i)## with a polynomial ##P_n(x)## of grade ##n = m-1## (assuming all ##x_i## have different values), one has to solve the linear system...

$$

\begin{flalign*}

& y_i = \sum_{k=0}^n \beta_k \, {x_i}^k \quad \quad \forall \, i=1,2,...,m &
\end{flalign*}

$$

... and find the coefficients ##\beta_k## which define the interpolating polynomial itself.I'm well aware this linear system can be represented in matrix/vector form and solved as such with dedicated calculations (for example, with Excel's array formulas), but I have always been interested in a general solution that could be written down explicitly.

That should be pretty trivial, but I couldn't find any specific info on the internet. So, I spent myself some hours solving such linear systems. Hereafter I'm listing the solutions for some values of ##m## (or, equivalently, ##n=m-1##), which easily reveal the pattern of the general solution (which is discussed further down below):

Case with ##\; m=1 \; \; (n=0)##
Relevant polynomial monomial: ##\; P_0(x)=\beta_0##
Equivalent statement: "a single point is interpolated by a unique constant function"
Solution:
\begin{flalign*}
& \beta_0 = y_1 &
\end{flalign*}
Case with ##\; m=2 \; \; (n=1)##
Relevant polynomial: ##\; P_1(x)=\beta_0+\beta_1 x##
Equivalent statement: "there is only one line that can pass through any two given points"
Solutions:
\begin{flalign*}
& \beta_0 = - \left( \frac{ y_1 x_2 }{ x_1 - x_2} + \frac{ y_2 x_1 }{ x_2 - x_1} \right) \\
& \\
& \beta_1 = \frac{ y_1 }{ x_1 - x_2} + \frac{ y_2 }{ x_2 - x_1} &
\end{flalign*}
Case with ##\; m=3 \; \; (n=2)##
Relevant polynomial: ##\; P_2(x)=\beta_0+\beta_1 x + \beta_2 x^2##
Equivalent statement: "there is only one parabola that can pass through any three given (non-aligned) points"
Solutions:
\begin{flalign*}
& \beta_0 = \frac{ y_1 x_2 x_3}{ (x_1 - x_2)(x_1 - x_3) } + \frac{ y_2 x_1 x_3}{ (x_2 - x_1)(x_2 - x_3) } + \frac{ y_3 x_1 x_2}{ (x_3 - x_1)(x_3 - x_2) } \\
& \\
& \beta_1 = - \left( \frac{ y_1 (x_2 + x_3)}{ (x_1 - x_2)(x_1 - x_3) } + \frac{ y_2 (x_1 + x_3)}{ (x_2 - x_1)(x_2 - x_3) } + \frac{ y_3 (x_1 + x_2)}{ (x_3 - x_1)(x_3 - x_2) } \right) \\
& \\
& \beta_2 = \frac{ y_1 }{ (x_1 - x_2)(x_1 - x_3) } + \frac{ y_2 }{ (x_2 - x_1)(x_2 - x_3) } + \frac{ y_3 }{ (x_3 - x_1)(x_3 - x_2) } &
\end{flalign*}
Case with ##\; m=4 \; \; (n=3)##
Relevant polynomial: ##\; P_3(x)=\beta_0+\beta_1 x + \beta_2 x^2 + \beta_3 x^3##
Solutions:
\begin{flalign*}
& \beta_0 = - \left( \frac{ y_1 x_2 x_3 x_4}{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4) } + \frac{ y_2 x_1 x_3 x_4}{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4) } + \frac{ y_3 x_1 x_2 x_4}{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4) } + \frac{ y_4 x_1 x_2 x_3}{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3) } \right) \\
& \\
& \beta_1 = \frac{ y_1 (x_2 x_3 + x_2 x_4 + x_3 x_4)}{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4) } + \frac{ y_2 (x_1 x_3 + x_1 x_4 + x_3 x_4)}{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4) } + \frac{ y_3 (x_1 x_2 + x_1 x_4 + x_2 x_4)}{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4) } + \frac{ y_4 (x_1 x_2 + x_1 x_3 + x_2 x_3)}{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3) } \\
& \\
& \beta_2 = - \left( \frac{ y_1 (x_2+x_3+x_4)}{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4) } + \frac{ y_2 (x_1+x_3+x_4)}{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4) } + \frac{ y_3 (x_1+x_2+x_4)}{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4) } + \frac{ y_4 (x_1+x_2+x_3)}{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3) } \right) \\
& \\
& \beta_3 = \frac{ y_1 }{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4) } + \frac{ y_2 }{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4) } + \frac{ y_3 }{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4) } + \frac{ y_4 }{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3) } &
\end{flalign*}
... and let me write down one more, for a better understanding of how the pattern evolves...

Case with ##\; m=5 \; \; (n=4)##
Relevant polynomial: ##\; P_4(x)=\beta_0+\beta_1 x + \beta_2 x^2 + \beta_3 x^3 + \beta_4 x^4##
Solutions:
\begin{flalign*}
&
\beta_0 =
\frac{ y_1 x_2 x_3 x_4 x_5}{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4)(x_1-x_5) }
+
\frac{ y_2 x_1 x_3 x_4 x_5}{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4)(x_2-x_5)}
+
\frac{ y_3 x_1 x_2 x_4 x_5}{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4)(x_3-x_5)}
+
\frac{ y_4 x_1 x_2 x_3 x_5}{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3)(x_4-x_5)}
+
\frac{ y_5 x_1 x_2 x_3 x_4}{ (x_5 - x_1)(x_5 - x_2)(x_5 - x_3)(x_5-x_4)}
\\
& \\
&
\beta_1 =
- \left(
\frac{ y_1 (x_2 x_3 x_4 + x_2 x_3 x_5 + x_2 x_4 x_5 + x_3 x_4 x_5)}{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4)(x_1-x_5) }
+
\frac{ y_2 (x_1 x_3 x_4 + x_1 x_3 x_5 + x_1 x_4 x_5 + x_3 x_4 x_5)}{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4)(x_2-x_5)}
+
\frac{ y_3 (x_1 x_2 x_4 + x_1 x_2 x_5 + x_1 x_4 x_5 + x_2 x_4 x_5)}{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4)(x_3-x_5)}
+
\frac{ y_4 (x_1 x_2 x_3 + x_1 x_2 x_5 + x_1 x_3 x_5 + x_2 x_3 x_5)}{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3)(x_4-x_5)}
+
\frac{ y_5 (x_1 x_2 x_3 + x_1 x_2 x_4 + x_1 x_3 x_4 + x_2 x_3 x_4)}{ (x_5 - x_1)(x_5 - x_2)(x_5 - x_3)(x_5-x_4)}
\right)
\\
& \\
&
\beta_2 =
\frac{ y_1 (x_2 x_3 + x_2 x_4 + x_2 x_5 + x_3 x_4 + x_3 x_5 + x_4 x5)}{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4)(x_1-x_5) }
+
\frac{ y_2 (x_1x_3 + x_1 x_4 + x_1x_5 + x_3x_4 + x_3x_5 + x_4x_5)}{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4)(x_2-x_5)}
+
\frac{ y_3 (x_1x_2 + x_1 x_4 + x_1x_5 + x_2x_4 + x_2x_5 + x_4x_5)}{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4)(x_3-x_5)}
+
\frac{ y_4 (x_1x_2 + x_ 1x_3 + x_1x_5 + x_2x_3 + x_2x_5 + x_3x_5)}{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3)(x_4-x_5)}
+
\frac{ y_5 (x_1x_2 + x_1 x_3 + x_1x_4 + x_2x_3 + x_2x_4 + x_3x_4)}{ (x_5 - x_1)(x_5 - x_2)(x_5 - x_3)(x_5-x_4)}
\\
& \\
&
\beta_3 =
- \left(
\frac{ y_1 (x_2 + x_3 + x_4 + x_5)}{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4)(x_1-x_5) }
+
\frac{ y_2 (x_1 + x_3 + x_4 + x_5)}{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4)(x_2-x_5)}
+
\frac{ y_3 (x_1 + x_2 + x_4 + x_5)}{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4)(x_3-x_5)}
+
\frac{ y_4 (x_1 + x_2 + x_3 + x_5)}{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3)(x_4-x_5)}
+
\frac{ y_5 (x_1 + x_2 + x_3 + x_4)}{ (x_5 - x_1)(x_5 - x_2)(x_5 - x_3)(x_5-x_4)}
\right)
\\
& \\
&
\beta_4 =
\frac{ y_1 }{ (x_1 - x_2)(x_1 - x_3)(x_1 - x_4)(x_1-x_5) }
+
\frac{ y_2 }{ (x_2 - x_1)(x_2 - x_3)(x_2 - x_4)(x_2-x_5)}
+
\frac{ y_3 }{ (x_3 - x_1)(x_3 - x_2)(x_3 - x_4)(x_3-x_5)}
+
\frac{ y_4 }{ (x_4 - x_1)(x_4 - x_2)(x_4 - x_3)(x_4-x_5)}
+
\frac{ y_5 }{ (x_5 - x_1)(x_5 - x_2)(x_5 - x_3)(x_5-x_4)}
&
\end{flalign*}

Patterns
According to the way in which I expressed the solutions, I notice that:
  • For a given coefficient ##\beta_k##, there is a common factor equal to ##(-1)^{n+k}## in front of the whole expression.
  • Each of the terms constituting the expression of a given coefficient ##\beta_k## has the form:
$$ \frac{y_i \cdot A_i }{ B_i } $$
  • ##A_i## is constituted by all possible "product-combinations" of the ##x## values other than ##x_i##, taken ##n-k## by ##n-k## . The number of such combinations is equal to the binomial coefficient ##\binom{n}{k} = \frac{n!}{k!(n-k)!}##
  • Finally, ##B_i## is equal to:
$$ B_i = \prod_{j=1, \; j \neq i}^{n+1} (x_i-x_j) $$

Question: by the way, is this last notation correct? I mean, is it legit to write the sum from ##j=1## when ##i## could also be ##1## and the requirement is ##j \neq i##?General expression of solutions
I think I can write a general expression for the coefficients ##\beta_0## and ##\beta_n## as follows:
\begin{flalign*}
& \beta_0 = (-1)^n \cdot \sum_{i=1}^{n+1} \left( y_i \cdot \prod_{j=1, \; j \neq i }^{n+1} \frac{x_j}{(x_i-x_j)} \right) \\
& \beta_n = \sum_{i=1}^{n+1} \frac{y_i}{\prod\limits_{j=1, \; j \neq i}\limits^{n+1} (x_i-x_j)} &
\end{flalign*}

Again, same question: is it legit to write the sum from ##j=1## when ##i## could also be ##1## and the requirement is ##j \neq i##?

Anyway, I can't really find a proper notation for a generic coefficient ##\beta_k \;##...
\begin{flalign*}
& \beta_k = (-1)^{(n+k)} \cdot \sum_{i=1}^{n+1} \left( y_i \cdot \frac{???}{\prod\limits_{j=1, \; j \neq i }\limits^{n+1} (x_i-x_j)} \right) &
\end{flalign*}

Can anyone advise me?
Thanks for your attention.
 
  • Like
Likes   Reactions: berkeman
Mathematics news on Phys.org
I'm not sure what your goal is, but two common polynomial interpolation methods use the Lagrange form and the Newton form. The Lagrange form of the interpolating polynomial is here. The Newton form is here.
You should be aware that high order polynomial interpolations can have wild behavior between the points and especially if you extrapolate beyond the points. Spline functions are better behaved that way but they are piecewise defined and will not have continuous high order derivatives.
 
  • Like
Likes   Reactions: e_jane and fresh_42
The idea is to construct n polynomials \phi_1, \dots, \phi_n such that <br /> \phi_i(x_j) = \begin{cases} 1 &amp; i = j, \\ 0 &amp; i \neq j. \end{cases} Hence <br /> \phi_i(x) = \prod_{j\neq i} \frac{x - x_j}{x_i - x_j} which is the Lagrange interpolating polynomial, and the interpolant \mathcal{I}(y) of the function y is <br /> \left[\mathcal{I}(y)\right](x) = \sum_{i=1}^n y(x_i) \phi_i(x).
 
Thanks for the insights. I'm going to learn something new.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 21 ·
Replies
21
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
977
  • · Replies 10 ·
Replies
10
Views
3K