# 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/approximation-function-polynomial
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/ai-ds/linear-methods/approximation-function-polynomial/en.mdx

Learn Gauss approximation techniques for function modeling with polynomial and trigonometric spaces, Euclidean norms, and scalar products.

---

## Best Approximation in Function Spaces

Our goal is to perform approximation of a specific function within an appropriate subspace of function space using a certain norm with optimal results.

The set $$C([a; b])$$ of continuous functions $$f : [a; b] \to \mathbb{R}$$ forms an infinite-dimensional real vector space. Imagine this space like a massive library containing all possible continuous functions on the interval $$[a; b]$$.

Visible text: The set of continuous functions forms an infinite-dimensional real vector space. Imagine this space like a massive library containing all possible continuous functions on the interval .

## Scalar Product and Euclidean Space

With the scalar product defined as

```math
\langle f, g \rangle = \int_a^b f(x) g(x) \, dx
```

then $$C([a; b])$$ becomes a Euclidean vector space. The corresponding norm is the quadratic mean

Visible text: then becomes a Euclidean vector space. The corresponding norm is the quadratic mean

```math
\|f\| = \sqrt{\langle f, f \rangle} = \left( \int_a^b f(x)^2 \, dx \right)^{\frac{1}{2}}
```

This scalar product is like a way to measure similarity between two functions, similar to calculating how similar two songs are based on their harmonic resonance. While the norm provides a measure of the "magnitude" of a function in the quadratic sense, like measuring the average volume of a piece of music.

## Definition of Best Approximation

Let $$S \subset C([a; b])$$ be a finite-dimensional vector subspace and $$f \in C([a; b])$$. Our task is to determine $$g \in S$$ such that

Visible text: Let be a finite-dimensional vector subspace and . Our task is to determine such that

```math
\|f - g\| = \min_{\varphi \in S} \|f - \varphi\|
```

A function $$g \in S$$ with this property is called a Gauss approximation. Such $$g \in S$$ with this property is called the best approximation of $$f$$ in $$S$$ with respect to the norm $$\| \cdot \|$$.

Visible text: A function with this property is called a Gauss approximation. Such with this property is called the best approximation of in with respect to the norm .

Like searching for the photo that most closely resembles the original from a limited photo collection, the best approximation provides the function that most closely matches the original function within the available space.

## Polynomial Spaces

Next, we will examine

```math
S = P_n([a; b])
```

which is the set of all polynomials of maximum degree $$n$$. Polynomial space is like a mathematical toolbox containing various simple curves to approximate more complex function shapes. The higher the degree $$n$$, the more "tools" are available to form more flexible curves.

Visible text: which is the set of all polynomials of maximum degree . Polynomial space is like a mathematical toolbox containing various simple curves to approximate more complex function shapes. The higher the degree , the more "tools" are available to form more flexible curves.

## Trigonometric Polynomials

Another possibility is the set of all trigonometric polynomials

```math
S = T_n(\omega) = \left\{ \frac{a_0}{2} + \sum_{i=1}^n \left( a_i \cos\left(\frac{2\pi i x}{\omega}\right) + b_i \sin\left(\frac{2\pi i x}{\omega}\right) \right) : a_i, b_i \in \mathbb{R} \right\}
```

for approximation of periodic functions $$f : \mathbb{R} \to \mathbb{R}$$ with period $$\omega > 0$$.

Visible text: for approximation of periodic functions with period .

These trigonometric polynomials are like a mathematical orchestra where sine and cosine functions serve as musical instruments that harmonize to create the melody of repeating functions. Each term in this series adds a different harmonic frequency, just like musical instruments playing fundamental notes and their harmonics.