Skip to main content

Section 1.5 Application: Polynomial Curve Fitting

Polynomial curve fitting is the process of finding a polynomial that passes through a given set of data points. When we have \(n\) distinct points \((x_1,y_1), (x_2,y_2), \ldots, (x_n,y_n)\text{,}\) we can determine a unique polynomial of degree at most \(n-1\) that passes exactly through all these points. This leads to a system of linear equations in the polynomial coefficients.
For a polynomial \(p(x) = a_0 + a_1 x + a_2 x^2 + \cdots + a_{n-1} x^{n-1}\text{,}\) the condition that \(p(x_i) = y_i\) gives us the linear system:
\begin{equation*} \begin{aligned} a_0 + a_1 x_1 + a_2 x_1^2 + \cdots + a_{n-1} x_1^{n-1} &= y_1\\ a_0 + a_1 x_2 + a_2 x_2^2 + \cdots + a_{n-1} x_2^{n-1} &= y_2\\ &\vdots\\ a_0 + a_1 x_n + a_2 x_n^2 + \cdots + a_{n-1} x_n^{n-1} &= y_n \end{aligned} \end{equation*}
This is a system of \(n\) equations in \(n\) unknowns \(a_0, a_1, \ldots, a_{n-1}\text{.}\)

Subsection 1.5.1 Example 1: Quadratic Through Three Points

Example 1.5.1.

Determine the polynomial \(p(x) = a_0 + a_1 x + a_2 x^2\) whose graph passes through the points \((1, 4)\text{,}\) \((2, 0)\text{,}\) and \((3, 12)\text{.}\)
Solution.
The conditions \(p(1) = 4\text{,}\) \(p(2) = 0\text{,}\) and \(p(3) = 12\) give us:
\begin{align*} a_0 + a_1(1) + a_2(1)^2 &= 4\\ a_0 + a_1(2) + a_2(2)^2 &= 0\\ a_0 + a_1(3) + a_2(3)^2 &= 12 \end{align*}
This simplifies to the linear system:
\begin{align*} a_0 + a_1 + a_2 &= 4\\ a_0 + 2a_1 + 4a_2 &= 0\\ a_0 + 3a_1 + 9a_2 &= 12 \end{align*}
In matrix form: \(A\mathbf{a} = \mathbf{b}\) where
\begin{equation*} A = \begin{bmatrix} 1 & 1 & 1\\ 1 & 2 & 4\\ 1 & 3 & 9 \end{bmatrix}, \quad \mathbf{a} = \begin{bmatrix}a_0\\a_1\\a_2\end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix}4\\0\\12\end{bmatrix}. \end{equation*}

Subsection 1.5.2 Example 2: Polynomial Through Five Points

Example 1.5.2.

Find a polynomial that fits the points \((-2, 3)\text{,}\) \((-1, 5)\text{,}\) \((0, 1)\text{,}\) \((1, 4)\text{,}\) and \((2, 10)\text{.}\)
Solution.
Since we have 5 points, we need a polynomial of degree at most 4:
\begin{equation*} p(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4. \end{equation*}
The conditions \(p(x_i) = y_i\) give us the system:
\begin{align*} a_0 + a_1(-2) + a_2(-2)^2 + a_3(-2)^3 + a_4(-2)^4 &= 3\\ a_0 + a_1(-1) + a_2(-1)^2 + a_3(-1)^3 + a_4(-1)^4 &= 5\\ a_0 + a_1(0) + a_2(0)^2 + a_3(0)^3 + a_4(0)^4 &= 1\\ a_0 + a_1(1) + a_2(1)^2 + a_3(1)^3 + a_4(1)^4 &= 4\\ a_0 + a_1(2) + a_2(2)^2 + a_3(2)^3 + a_4(2)^4 &= 10 \end{align*}
Simplifying the powers:
\begin{equation*} A = \begin{bmatrix} 1 & -2 & 4 & -8 & 16\\ 1 & -1 & 1 & -1 & 1\\ 1 & 0 & 0 & 0 & 0\\ 1 & 1 & 1 & 1 & 1\\ 1 & 2 & 4 & 8 & 16 \end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix}3\\5\\1\\4\\10\end{bmatrix}. \end{equation*}

Subsection 1.5.3 Theory: Vandermonde Matrices

The coefficient matrix in polynomial interpolation is called a Vandermonde matrix. For distinct points \(x_1, x_2, \ldots, x_n\text{,}\) the Vandermonde matrix is:
\begin{equation*} V = \begin{bmatrix} 1 & x_1 & x_1^2 & \cdots & x_1^{n-1}\\ 1 & x_2 & x_2^2 & \cdots & x_2^{n-1}\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 1 & x_n & x_n^2 & \cdots & x_n^{n-1} \end{bmatrix}. \end{equation*}
The determinant of this matrix is \(\det(V) = \prod\limits_{1 \leq i < j \leq n}(x_j - x_i)\text{.}\) Since all \(x_i\) are distinct, this determinant is nonzero, guaranteeing that the Vandermonde matrix is invertible and the polynomial interpolation problem has a unique solution.