Example 6. Expand the function $y=x$ into a Fourier series on the interval $(0,1)$ with respect to the Haar function system.
Solution. Haar functions are defined by the equations

$$
\begin{aligned}
& h_{0}(x)=1, \\
& h_{1}(x)=\left[\begin{array}{rcl}
1 & \text { if } & 0<x<1 / 2, \\
-1 & \text { if } & 1 / 2<x<1,
\end{array}\right. \\
& h_{n}(x)=\left[\begin{array}{rl}
u_{n} & \text { if } \alpha_{n}<x<\beta_{n}, \\
-u_{n} & \text { if } \beta_{n}<x<\gamma_{n}, \\
0 & \text { otherwise },
\end{array}\right.
\end{aligned}
$$

where $u_{n}=2^{k / 2}, \alpha_{n}=n / 2^{k}-1, \quad \beta_{n}=\alpha_{n}+1 / 2^{k+1}, \quad \gamma_{n}=\alpha_{n}+1 / 2^{k}$ and $k$ is such that $2^{k} \leqslant n<2^{k+1}$, i.e., $k=\left[\log _{2} n\right]$, where $[q]$ denotes the integer part of the number $q$.

The functions $h_{0}(x), h_{1}(x), h_{2}(x), \ldots$ form an orthogonal basis in the space of functions defined on the interval $(0,1)$, with the scalar product

$$
(u, v)=\int_{0}^{1} u(x) v(x) d x
$$

The desired expansion of the function $y=x$ in a Fourier series on the interval $(0,1)$ with respect to the system of functions $h_{0}(x), h_{1}(x), h_{2}(x), \ldots$ is given by

$$
x=\sum_{n=0}^{\infty} a_{n} h_{n}(x), \quad x \in(0,1)
$$

where the coefficients $a_{0}, a_{1}, a_{2}, \ldots$ are determined by the Euler-Fourier formulas:

$$
a_{n}=\frac{\left(x, h_{n}(x)\right)}{\left(h_{n}(x), h_{n}(x)\right)}=\frac{\int_{0}^{1} x h_{n}(x) d x}{\int_{0}^{1} h_{n}(x)^{2} d x}
$$

1. We check that

$$
\int_{0}^{1} x^{2} d x<\infty
$$

The inequality holds because the function $y=x$ is bounded on $(0,1)$.

2. We compute the coefficients $a_{0}, a_{1}, a_{2}, \ldots$ using the Euler-Fourier formulas (21).

We compute the integrals

$$
\begin{aligned}
\int_{0}^{1} x h_{0}(x) d x & =\frac{1}{2} \\
\int_{0}^{1} x h_{n}(x) d x & =u_{n} \int_{\alpha_{n}}^{\beta_{n}} x d x-u_{n} \int_{\beta_{n}}^{\gamma_{n}} x d x=-\frac{1}{2^{3 k / 2+2}}
\end{aligned}
$$

It is not difficult to verify that

$$
\int_{0}^{1} h_{n}(x)^{2} d x=1
$$

Substituting the computed integrals into (21), we get

$$
a_{0}=\frac{1}{2}, \quad a_{n}=-\frac{1}{4} \frac{1}{2^{3\left[\log _{2} n\right] / 2}}, \quad n=1,2, \ldots
$$

3. Substituting the found values of the coefficients $a_{0}, a_{1}, a_{2}, \ldots$ into (20). We obtain

$$
x=\frac{1}{2}-\frac{1}{4} \sum_{n=1}^{\infty} \frac{1}{2^{3\left[\log _{2} n\right] / 2}} h_{n}(x)
$$

Answer. $x=\frac{1}{2}-\frac{1}{4} \sum_{n=1}^{\infty} \frac{1}{2^{3\left[\log _{2} n\right] / 2}} h_{n}(x), x \in(0,1)$.

Conditions of the Problems. Expand the function $y=f(x)$ in a Fourier series on the interval $(a, b)$ with respect to the system $\varphi_{n}(x) \quad(n=0,1, \ldots)$

1. $f(x)=\arccos ^{2} x$ on $(-1,1), \varphi_{n}(x)=T_{n}(x)$ - Chebyshev polynomials.
2. $f(x)=x^{2}+1$ on $(-1,1), \varphi_{n}(x)=T_{n}(x)$ - Chebyshev polynomials.
3. $f(x)=|x|$ on $(-1,1), \quad \varphi_{n}(x)=P_{n}(x)$ - Legendre polynomials.
4. $f(x)=2+3 \cos x+\cos ^{2} x$ on $(0, \pi), \quad \varphi_{n}(x)=P_{n}(\cos x), P_{n}-$ Legendre polynomials.
5. $f(x)=1+\cos x-\cos 2 x+2 \cos 3 x$ on $(0, \pi), \varphi_{n}(x)=P_{n}(\cos x)$, $P_{n}$ - Legendre polynomials.
6. $f(x)=\operatorname{ch} x$ on $(-\infty, \infty), \varphi_{n}(x)=H_{n}(x)$ - Hermite polynomials.
7. $f(x)=\sin x$ on $(-\infty, \infty), \varphi_{n}(x)=H_{n}(x)$ - Hermite polynomials.
8. $f(x)=1-x^{2}$ on $(0,1), \varphi_{n}(x)=J_{0}\left(\mu_{n} x\right) \quad(n=1,2, \ldots), J_{0}-$ Bessel function, $J_{0}\left(\mu_{n}\right)=0$.
9. $f(x)=x\left(1-x^{2}\right)$ on $(0,1), \quad \varphi_{n}(x)=J_{1}\left(\mu_{n} x\right) \quad(n=1,2, \ldots)$, $J_{1}$ - Bessel function, $J_{1}\left(\mu_{n}\right)=0$.
10. $f(x)=1-2 x$ on $(0,1), \varphi_{n}(x)=h_{n}(x)$ - Haar functions.

## Answers.

1. $\arccos ^{2} x=\frac{\pi^{2}}{3}+4 \sum_{n=1}^{\infty} \frac{(-1)^{n}}{n^{2}} T_{n}(x), x \in(-1,1)$.
2. $x^{2}+1=\frac{3}{2} T_{0}(x)+\frac{1}{2} T_{2}(x), x \in(-1,1)$.
3. $|x|=\frac{1}{2}+\sum_{k=1}^{\infty} \frac{(-1)^{k}(4 k+1)}{2^{2 k+1} k(2 k+1)} P_{2 k}(x), x \in(-1,1)$.
4. $2+3 \cos x+\cos ^{2} x=\frac{7}{3} P_{0}(\cos x)+3 P_{1}(\cos x)+\frac{2}{3} P_{2}(\cos x)$, $x \in(0, \pi)$.
5. $1+\cos x-\cos 2 x+2 \cos 3 x=\frac{4}{3} P_{0}(\cos x)-\frac{1}{5} P_{1}(\cos x)-$

$$
-\frac{4}{3} P_{2}(\cos x)+\frac{16}{5} P_{3}(\cos x), \quad x \in(0, \pi)
$$

6. $\operatorname{ch} x=e^{1 / 4} \sum_{