Problem 330
Easy Remainders and Fourier Series

Expand f(x) = cases ax, - pi<x<0, bx, 0<x<pi cases

Expand $f(x) = \begin{cases}ax, & -\pi

Explanation of Method

With two independent slopes, $f$ is generally neither even nor odd, so all three coefficient types must be computed directly. Straightforward integration by parts gives $a_0$ and $a_n$ (nonzero only for odd $n$) and $b_n$ (nonzero for all $n$), reducing to the special cases $a=b$ (odd, recovering Problem 324) and $a=-b$ (even, recovering Problem 325-type behavior) when checked.

  1. Compute $a_0$ directly by splitting the integral at $x=0$.
  2. Compute $a_n$ and $b_n$ via integration by parts on each piece.
  3. Check the special cases $a=b$ and $a=-b$ against known odd/even results.

Step 1 · Computing $a_0$

$$ a_0 = \frac1\pi\left[\int_{-\pi}^0 ax\,dx+\int_0^\pi bx\,dx\right] = \frac1\pi\left[-\frac{a\pi^2}2+\frac{b\pi^2}2\right] = \frac{\pi(b-a)}2. $$

Step 2 · Computing $a_n$ and $b_n$

Using $\int x\cos(nx)\,dx=\frac{x\sin(nx)}n+\frac{\cos(nx)}{n^2}$ and $\int x\sin(nx)\,dx=-\frac{x\cos(nx)}n+\frac{\sin(nx)}{n^2}$ on each piece, with $\sin(n\pi)=0$, $\cos(n\pi)=(-1)^n$: $$ a_n = \frac{(a-b)\bigl(1-(-1)^n\bigr)}{\pi n^2} = \begin{cases}\dfrac{2(a-b)}{\pi n^2}, & n\text{ odd}\\[4pt]0,& n\text{ even}\end{cases}, \qquad b_n = \frac{(a+b)(-1)^{n+1}}n. $$ (Verified numerically at $a=2,b=3$: $a_1\approx-0.6366=\frac{2(a-b)}\pi$, $b_1=5=a+b$, $b_2=-2.5=\frac{a+b}2\cdot(-1)$, matching the formulas exactly.)

Step 3 · Fourier series

$$ \boxed{f(x) = \frac{\pi(b-a)}4 + \frac{2(a-b)}\pi\sum_{k=1}^\infty\frac{\cos((2k-1)x)}{(2k-1)^2} + (a+b)\sum_{n=1}^\infty\frac{(-1)^{n+1}}n\sin(nx)} $$


Summary Table

PropertyValue
$a_0$$\pi(b-a)/2$
$a_n$$\frac{2(a-b)}{\pi n^2}$ (odd $n$), $0$ (even $n$)
$b_n$$\frac{(a+b)(-1)^{n+1}}n$

Additional Notes

Result

$$ f(x) = \frac{\pi(b-a)}4 + \frac{2(a-b)}\pi\sum_{k=1}^\infty\frac{\cos((2k-1)x)}{(2k-1)^2} + (a+b)\sum_{n=1}^\infty\frac{(-1)^{n+1}}n\sin(nx). $$