# Nakafa Learning Content

> For AI agents: use [llms.txt](https://nakafa.com/llms.txt) for the site index. Markdown versions are available by appending `.md` to content URLs or sending `Accept: text/markdown`.

URL: https://nakafa.com/en/subjects/ai-ds/linear-methods/orthogonal-polynomials
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/ai-ds/linear-methods/orthogonal-polynomials/en.mdx

Learn Chebyshev and Legendre polynomials with weighted scalar products, Gram-Schmidt process, and Gauss approximation for numerical analysis.

---

## Weighted Scalar Product

In numerical analysis, we often need to measure the difference between two functions using the maximum norm. This norm is defined as:

```math
\|f - g\|_\infty = \max_{x \in [-1,1]} |f(x) - g(x)|
```

In general, the maximum norm can become very large, especially near the endpoints of the interval where large errors often occur. Imagine measuring the height of a mountain only from its highest peak without considering the slope of its sides.

To address this problem, we can use a weighted scalar product that gives different emphasis to each part of the interval:

```math
\langle f, g \rangle_\omega = \int_{-1}^{1} f(x)g(x)\omega(x) \, dx
```

with the weight function:

```math
\omega(x) = \frac{1}{\sqrt{1-x^2}}
```

This weight function provides stronger emphasis on the interval endpoints, allowing us to suppress large errors that typically occur in those regions.

## Orthogonalization and Chebyshev Polynomials

When we orthogonalize the monomial basis $$1, x, \ldots, x^n$$ with respect to this weighted scalar product, we obtain orthogonal polynomials $$p_k$$ that satisfy a two-level recurrence relation. This process is like rearranging building blocks so that each floor stands perfectly perpendicular to the others:

Visible text: When we orthogonalize the monomial basis with respect to this weighted scalar product, we obtain orthogonal polynomials that satisfy a two-level recurrence relation. This process is like rearranging building blocks so that each floor stands perfectly perpendicular to the others:

Component: MathContainer
Children:

```math
p_0(x) = 1
```

```math
p_1(x) = x
```

```math
p_{k+1}(x) = 4xp_k(x) - 4p_{k-1}(x), \quad k = 1, \ldots, n
```

The norm of these polynomials is:

Component: MathContainer
Children:

```math
\|p_k\|_\omega = \begin{cases}
\sqrt{\pi}, & k = 0 \\
\sqrt{\pi/2}, & k \neq 0
\end{cases}
```

```math
p_k(1) = 2^{k-1}
```

If we perform normalization at $$x = 1$$, we obtain the famous Chebyshev polynomials:

Visible text: If we perform normalization at , we obtain the famous Chebyshev polynomials:

```math
T_k(x) = 2^{1-k}p_k(x) = \cos(k \arccos(x)), \quad k = 0, 1, 2, \ldots
```

This trigonometric form shows that Chebyshev polynomials are essentially transformations of cosine functions adapted for the interval $$[-1, 1]$$.

Visible text: This trigonometric form shows that Chebyshev polynomials are essentially transformations of cosine functions adapted for the interval .

There exists a theorem stating that two-way recurrence relations hold generally for polynomials derived from monomial bases in the space $$C([-1, 1])$$ with certain symmetry properties. The scalar product satisfies the relation:

Visible text: There exists a theorem stating that two-way recurrence relations hold generally for polynomials derived from monomial bases in the space with certain symmetry properties. The scalar product satisfies the relation:

```math
\langle p, xq \rangle = \langle xp, q \rangle
```

for all polynomials $$p, q \in P$$.

Visible text: for all polynomials .

## Gram-Schmidt Process

Through the Gram-Schmidt orthogonalization process from the basis $$1, x, \ldots, x^n$$, we obtain orthogonal polynomials $$\tilde{p}_k$$ with $$k = 0, \ldots, n$$. This process is like building a structural framework where each beam is positioned based on the previous beam with accurate calculations:

Visible text: Through the Gram-Schmidt orthogonalization process from the basis , we obtain orthogonal polynomials with . This process is like building a structural framework where each beam is positioned based on the previous beam with accurate calculations:

Component: MathContainer
Children:

```math
\tilde{p}_0(x) = 1
```

```math
\tilde{p}_1(x) = x - \beta_0
```

```math
\tilde{p}_{k+1}(x) = (x - \beta_k)\tilde{p}_k(x) - \gamma_k\tilde{p}_{k-1}(x), \quad k = 1, \ldots, n
```

with coefficients:

Component: MathContainer
Children:

```math
\beta_k = \frac{\langle x\tilde{p}_k, \tilde{p}_k \rangle}{\|\tilde{p}_k\|^2}, \quad k = 0, \ldots, n
```

```math
\gamma_k = \frac{\|\tilde{p}_k\|^2}{\|\tilde{p}_{k-1}\|^2}, \quad k = 1, \ldots, n
```

The orthonormal polynomials are then obtained through:

```math
p_k = \|\tilde{p}_k\|^{-1}\tilde{p}_k, \quad k = 0, \ldots, n
```

## Legendre Polynomials

For orthonormalization of the basis $$1, x, \ldots, x^n$$ with respect to the standard scalar product:

Visible text: For orthonormalization of the basis with respect to the standard scalar product:

```math
\langle f, g \rangle = \int_{-1}^{1} f(x)g(x) \, dx
```

we obtain polynomials related to Legendre polynomials:

```math
\varphi_k(x) = \frac{(2k-2)!}{(k-1)!^2} \sqrt{\frac{2k-1}{2^{k-1}}} L_{k-1}(x), \quad k = 1, \ldots, n+1
```

where $$L_k(x)$$ are Legendre polynomials defined through a two-level recurrence relation.

Visible text: where are Legendre polynomials defined through a two-level recurrence relation.

The Legendre polynomials themselves are defined as:

Component: MathContainer
Children:

```math
L_0(x) = 1
```

```math
L_1(x) = x
```

```math
L_{k+1}(x) = xL_k(x) - \frac{k^2}{4k^2-1}L_{k-1}(x), \quad k = 1, \ldots, n
```

With respect to the standard scalar product, Legendre polynomials produce an orthonormal system $$\varphi_i : [-1, 1] \to \mathbb{R}$$ with $$i = 0, \ldots, n$$ that satisfies:

Visible text: With respect to the standard scalar product, Legendre polynomials produce an orthonormal system with that satisfies:

```math
\langle \varphi_i, \varphi_j \rangle_t = \delta_{ij}
```

## Transformation to Different Intervals

When we have another approximation interval $$[a, b]$$ different from the standard interval, we perform a linear variable substitution. This process is like changing the scale on a map from one region to another while maintaining the correct proportions:

Visible text: When we have another approximation interval different from the standard interval, we perform a linear variable substitution. This process is like changing the scale on a map from one region to another while maintaining the correct proportions:

Component: MathContainer
Children:

```math
x = a + \frac{b-a}{2}(t+1) \in [a, b]
```

```math
t = -1 + \frac{2}{b-a}(x-a) \in [-1, 1]
```

Then the differential becomes:

```math
dx = \frac{b-a}{2}dt
```

On the interval $$[a, b]$$ there exist polynomials $$\tilde{\varphi}_i : [a, b] \to \mathbb{R}$$ with $$i = 0, \ldots, n$$ expressed as:

Visible text: On the interval there exist polynomials with expressed as:

```math
\tilde{\varphi}_i(x) = \sqrt{\frac{2}{b-a}}\varphi_i\left(-1 + \frac{2}{b-a}(x-a)\right) = \sqrt{\frac{2}{b-a}}\varphi_i(t)
```

### Verification of Orthonormal Properties

We can verify that the orthonormal properties remain valid after transformation:

Component: MathContainer
Children:

```math
\langle \tilde{\varphi}_i, \tilde{\varphi}_j \rangle_x = \int_a^b \tilde{\varphi}_i(x)\tilde{\varphi}_j(x) \, dx
```

```math
= \int_a^b \sqrt{\frac{2}{b-a}}\varphi_i\left(-1 + \frac{2}{b-a}(x-a)\right)
```

```math
\times \sqrt{\frac{2}{b-a}}\varphi_j\left(-1 + \frac{2}{b-a}(x-a)\right) \, dx
```

With substitution, we obtain:

Component: MathContainer
Children:

```math
= \int_{-1}^1 \frac{2}{b-a}\varphi_i(t)\varphi_j(t) \frac{b-a}{2} \, dt
```

```math
= \int_{-1}^1 \varphi_i(t)\varphi_j(t) \, dt = \langle \varphi_i, \varphi_j \rangle_t = \delta_{ij}
```

Thus:

```math
\langle f, \tilde{\varphi}_i \rangle_x = \int_a^b f(x)\varphi_i\left(-1 + \frac{2}{b-a}(x-a)\right)\sqrt{\frac{2}{b-a}} \, dx
```

## Gauss Approximation

In Gauss approximation with the scalar product:

```math
\langle f, g \rangle = \int_{-1}^1 f(t)g(x) \, dx
```

this method provides a very important foundation in numerical analysis. The orthogonal polynomials we have studied become the fundamental basis for developing efficient Gauss quadrature methods for various computational applications that require function approximation with high accuracy.