Example 3. Expand the function $y=\alpha+\beta \cos \vartheta+\gamma \cos ^{2} \vartheta$ into a Fourier series on the interval $(0, \pi)$ with respect to the system $P_{0}(\cos \vartheta), P_{1}(\cos \vartheta), P_{2}(\cos \vartheta), \ldots$, where $P_{n}$ are Legendre polynomials.
Solution. The functions $P_{0}(\cos \vartheta), P_{1}(\cos \vartheta), P_{2}(\cos \vartheta), \ldots$ form an orthogonal basis in the space of functions defined in the interval $(0, \pi)$, with the scalar product

$$
(u, v)=\int_{0}^{\pi} u(\vartheta) v(\vartheta) \sin \vartheta d \vartheta
$$

The desired expansion of the function $y=\alpha+\beta \cos \vartheta+\gamma \cos ^{2} \vartheta$ in a Fourier series on the interval $(0, \pi)$ with respect to the system $P_{0}(\cos \vartheta), P_{1}(\cos \vartheta), P_{2}(\cos \vartheta), \ldots$ is given by

$$
\alpha+\beta \cos \vartheta+\gamma \cos ^{2} \vartheta=\sum_{n=0}^{\infty} a_{n} P_{n}(\cos \vartheta), \quad 02$ are zero.

The integrals

$$
\int_{-1}^{1} P_{n}(\cos \vartheta)^{2} \sin \vartheta d x=\int_{-1}^{1} P_{n}(x)^{2} d x
$$

are determined by formula (10).

Substituting the computed integrals into (12), we get

$$
a_{0}=\alpha+\frac{1}{3} \gamma, \quad a_{1}=\beta, \quad a_{2}=\frac{2}{3} \gamma, \quad a_{3}=0, \quad a_{4}=0, \quad \ldots
$$

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

$$
\alpha+\beta \cos \vartheta+\gamma \cos ^{2} \vartheta=\left(\alpha+\frac{1}{3} \gamma\right) P_{0}(\cos \vartheta)+\beta P_{1}(\cos \vartheta)+\frac{2}{3} P_{2}(\cos \vartheta)
$$

We perform a check using the fact that by formula (6)

$$
P_{0}(x)=1, \quad P_{1}(x)=x \quad \text { and } \quad P_{2}(x)=3 x^{2} / 2-1 / 2
$$

Answer. $\alpha+\beta \cos \vartheta+\gamma \cos ^{2} \vartheta=$

$$
=\left(\alpha+\frac{1}{3} \gamma\right) P_{0}(\cos \vartheta)+\beta P_{1}(\cos \vartheta)+\frac{2}{3} P_{2}(\cos \vartheta), 0<\vartheta<\pi
$$