A function $f(x)$ (quadratically integrable) is to be represented by a finite Fourier series. A convenient measure of the accuracy of the series is given by the integrated square of the deviation,
$$
\Delta_p=\int_0^{2 \pi}\left[f(x)-\frac{a_0}{2}-\sum_{n=1}^p\left(a_n \cos n x+b_n \sin n x\right)\right]^2 d x .
$$
Show that the requirement that $\Delta_p$ be minimized, that is,
$$
\frac{\partial \Delta_p}{\partial a_n}=0, \quad \frac{\partial \Delta_p}{\partial b_n}=0,
$$
for all $n$, leads to choosing $a_n$ and $b_n$ as given in Eqs. (14.2) and (14.3).
Note. Your coefficients $a_n$ and $b_n$ are independent of $p$. This independence is a consequence of orthogonality and would not hold for powers of $x$, fitting a curve with polynomials.