Expand f(x)=sum from i=1 to n(a_icos(ix)+b_isin(ix))
Expand $f(x)=\sum_{i=1}^n(a_i\cos(ix)+b_i\sin(ix))$ in a Fourier series on $(-\pi,\pi)$.
Explanation of Method
$f$ is already a finite linear combination of the orthogonal Fourier basis functions $\{\cos(ix),\sin(ix)\}$. Orthogonality on $(-\pi,\pi)$ ($\int_{-\pi}^\pi\cos(ix)\cos(kx)\,dx=\pi\delta_{ik}$, similarly for sine, with cross terms always zero) immediately extracts the coefficients back out, showing the Fourier series is simply the function itself, truncating exactly at $n$.
- Compute $A_0$: the average of a sum of pure sines/cosines over a full period is zero.
- Compute $A_k$ and $B_k$ using orthogonality, showing they equal $a_k,b_k$ for $k\le n$ and $0$ beyond.
- Conclude that any trigonometric polynomial is its own Fourier series.
Step 1 · Computing $A_0$
Since $\int_{-\pi}^\pi\cos(ix)\,dx=\int_{-\pi}^\pi\sin(ix)\,dx=0$ for every $i\ge1$: $$ A_0 = \frac1\pi\int_{-\pi}^\pi f(x)\,dx = 0. $$
Step 2 · Computing $A_k,B_k$ via orthogonality
Using $\int_{-\pi}^\pi\cos(ix)\cos(kx)\,dx=\pi$ if $i=k$ (else $0$), $\int_{-\pi}^\pi\sin(ix)\sin(kx)\,dx=\pi$ if $i=k$ (else $0$), and $\int_{-\pi}^\pi\cos(ix)\sin(kx)\,dx=0$ always: $$ A_k = \frac1\pi\int_{-\pi}^\pi f(x)\cos(kx)\,dx = \begin{cases}a_k, & 1\le k\le n\\0,& k>n\end{cases}, \qquad B_k = \begin{cases}b_k, & 1\le k\le n\\0,& k>n\end{cases}. $$
Step 3 · Conclusion
$$ \boxed{f(x) = \sum_{i=1}^n\bigl(a_i\cos(ix)+b_i\sin(ix)\bigr)} $$ — the Fourier series equals $f(x)$ exactly, with no infinite tail: it truncates at the $n$-th harmonic.
Summary Table
| Property | Value |
|---|---|
| $A_0$ | $0$ |
| $A_k,B_k$ for $k\le n$ | $a_k,b_k$ |
| $A_k,B_k$ for $k>n$ | $0$ |
Additional Notes
- This is the general principle underlying Problem 331's trivial expansion of $\cos(3x)$ — that problem is the $n=3$, single-term special case of this one.
- The key contrast is with Problem 332's $\sin(ax)$ for non-integer $a$: since $a$ is not one of the discrete basis frequencies $1,2,3,\ldots$, no finite truncation is possible, and the expansion is a genuine infinite series.
- This result is the finite-dimensional analogue of representing a vector in an orthogonal basis: the "coordinates" $A_k,B_k$ are recovered by projection (integration against the basis function), and a vector already given in that basis has trivial coordinates.