I have this function
$$ f(t) = \begin{cases} -t, & \text{0 ≤ t ≤ π} \\[2ex] \end{cases}$$
I'm asked to show solve the Fourier-cosine function
After setting up and solving the integrals I get
$$a_0= -π$$ and $$a_n=-\frac{2}{πn^2}(cos(nπ)-1)$$
I have checked my solutions and they are correct.
I proceed to check what values $cos(nπ)$ gives me for $n$, and I found that I will get $1$ for all even numbers and $-1$ for all odd numbers
That means: $$a_n=-\frac{2}{πn^2}(1-1)=0$$ for all even numbers
and
$$a_n=-\frac{2}{πn^2}(-1-1)=-\frac{2}{πn^2}(-2)=\frac{4}{πn^2}$$ for all odd numbers.
I have checked my solutions and they are correct.
What I dont understand is this step where the solution manual says
$$a_n=\frac{4}{πn^2}=\frac{4}{π(2n-1)^2}$$
from where did we get $(2n-1)^2$ ?
The answer seems to be poorly written in your solution manual, but the left-hand side seems to say:
$$ a_n \;\; =\;\; \frac{4}{\pi n^2} \; \text{for all} \; n \in \{1,3,5,7,\ldots\} $$
while the right-hand side is saying:
$$ a_n \;\; =\;\; \frac{4}{\pi (2n-1)^2} \; \text{for all} \; n \in \mathbb{N} = \{1,2,3,4,5,\ldots\}. $$
In this case using $2n-1$ as the index will immediately filter out all odd numbers if you plug in $n=1,2,3,4,\ldots$ while if you simply write $n^2$ you have to specify that the only numbers to plug in must be odd.
Your book should've been more careful to point this out because it's simply not correct to just say $\frac{4}{\pi n^2} = \frac{4}{\pi(2n-1)^2}$. It's standard to change $n\to 2n-1$ if you're only dealing with odd indices, or $n\to 2n$ if only dealing with even indices.