As discussed in the class, if the set $(r)az1$ is orthonormal with respect to positive weight function $w(z)$ on $[a, b]$, that is,
$$\int_{a}^{b} f(x)g(x)w(x)dx = \delta_{mn},$$
then with any piecewise continuous function $f(x)$, we can identify an orthogonal expansion $f(x) = \sum_{n=0}^{\infty} c_n \phi_n(x)$,
where
$$c_n = \int_{a}^{b} f(x)\phi_n(x)w(x)dx.$$
The eigenfunctions corresponding to distinct eigenvalues are orthogonal with respect to $w(x)$ for a regular Sturm-Liouville boundary value problem. Hence, we can use the eigenfunctions to form an orthonormal system with respect to $w(x)$ simply by normalizing (scaling) each eigenfunction $\phi_n(x)$ so that
$$\int_{a}^{b} \phi_n(x)w(x)dx = 1.$$
Construct an orthonormal system of eigenfunctions corresponding to the regular Sturm-Liouville boundary value problem
$$y'' + Ay = 0, \quad y(0) = 0, \quad y(\pi) = 0.$$
Express
$$f(x) = 2\cos(x), \quad 0 < x < \frac{\pi}{2}, \quad \frac{\pi}{2} < x < \pi,$$
in an eigenfunction expansion using the orthonormal system of eigenfunctions obtained in part (a).