\documentclass[10pt]{article}
\usepackage{amsmath,amsfonts}

\textwidth17cm \textheight25.5cm \oddsidemargin-1cm \topmargin-2cm

\newcommand{\x}{\boldsymbol{x}}
\newcommand{\y}{\boldsymbol{y}}
\newcommand{\f}{\boldsymbol{f}}
\renewcommand{\v}{\boldsymbol{v}}
\newcommand{\w}{\boldsymbol{w}}
\renewcommand{\a}{\boldsymbol{a}}
\renewcommand{\b}{\boldsymbol{b}}
\renewcommand{\c}{\boldsymbol{c}}
\newcommand{\e}{\boldsymbol{e}}
\newcommand{\p}{\boldsymbol{p}}
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}
\newcommand{\Range}{\operatorname{Range}}
\newcommand{\Ker}{\operatorname{Ker}}
\renewcommand{\dim}{\operatorname{dim}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}

\newcommand{\Span}{\operatorname{Span}}
\newcommand{\C}{\mathbb{C}}


\begin{document}

{\LARGE Problem 5 of homework 6:}
\vspace{.5cm}

\parindent0cm

An orthonormal basis is $\displaystyle\left\{ c_0 = \frac 1 {\sqrt L},
c_k = \sqrt{\frac 2 L}
\cos\left( \frac{2 \pi kx}L \right), s_k = \sqrt{\frac 2 L}
\sin\left( \frac{2 \pi kx}L \right); k \in \N \right\}$

\begin{align*}
  f(x) &= \langle f(x), c_0 \rangle c_0 + \sum_{k=1}^\infty \langle f(x), c_k \rangle c_k
  + \sum_{k=1}^\infty \langle f(x), s_k \rangle s_k
\end{align*}

Here $f(x)= (x+\pi)^2$ on the intervall $[-\pi,\pi)$, so $L= 2\pi$.

\begin{align*}
  \langle f(x), c_0 \rangle &= \frac 1 {\sqrt{2 \pi}}
  \int_{-\pi}^\pi (x+\pi)^2 \, dx
  =  \frac 1 {\sqrt{2 \pi}} \: \frac 1 3 \, (x+\pi)^3 \Big|_{-\pi}^\pi
  =  \frac {8 \pi^3} {3 \sqrt{2 \pi}}\\
  \langle f(x), c_k \rangle &= \frac 1 {\sqrt{\pi}}
  \int_{-\pi}^\pi (x+\pi)^2 \cos(kx) \, dx
  =  \frac 1 {\sqrt{\pi}} \left( (x+\pi)^2 \frac 1 k \: \sin(kx)
  \Big|_{-\pi}^\pi
  - \int_{-\pi}^\pi 2 (x+\pi) \frac 1 k \sin(kx) \, dx \right) \\
  &=  \frac 1 {\sqrt{\pi}} \left( 0-
  2 \left( (x+\pi) \frac {-1} {k^2} \cos(kx) \Big|_{-\pi}^\pi
  + \int_{-\pi}^\pi  \frac {1} {k^2} \cos(kx) \, dx \right) \right) \\
  &=  \frac 2{\sqrt{\pi}} \left( 2\pi \frac {(-1)^k}{k^2} -0 \right)
  =  \frac {4\pi}{\sqrt{\pi}} \: \frac {(-1)^k}{k^2} \\
  \langle f(x), s_k \rangle &= \frac 1 {\sqrt{\pi}}
  \int_{-\pi}^\pi (x+\pi)^2 \sin(kx) \, dx
  =  \frac 1 {\sqrt{\pi}} \left( (x+\pi)^2 \frac {-1} k \: \cos(kx)
  \Big|_{-\pi}^\pi
  + \int_{-\pi}^\pi 2 (x+\pi) \frac 1 k \cos(kx) \, dx \right) \\
  &=  \frac 1 {\sqrt{\pi}} \left(-4 \pi ^2 \frac {(-1)^{k}} k 
  +2 \left( (x+\pi) \frac {1} {k^2} \sin(kx) \Big|_{-\pi}^\pi
  - \int_{-\pi}^\pi  \frac {1} {k^2} \sin(kx) \, dx \right) \right) \\
  &=  \frac 1 {\sqrt{\pi}} \left(-4 \pi^2 \frac {(-1)^{k}} k 
  + 0 -0 \right)
  = -\frac {4 \pi^2}{\sqrt{\pi}} \frac {(-1)^{k}} k \\
\end{align*}
 So the fourier representation of $f$ is:
\begin{align*}
  f(x) &= \frac 8 {3 \sqrt{2 \pi}} \:  \pi^3  \cdot \frac 1 {\sqrt{2\pi}}
  + \frac {4\pi}{\sqrt{\pi}} \sum_{k=1}^\infty 
  \frac {(-1)^k}{k^2}
  \cdot \frac 1 {\sqrt \pi} \cos kx
  -\frac {4\pi^2}{\sqrt{\pi}} \sum_{k=1}^\infty 
  \frac {(-1)^{k}} k \cdot \frac 1 {\sqrt \pi} \sin kx \\
  &= \frac 4 3 \:  \pi^2
  + 4 \sum_{k=1}^\infty \frac {(-1)^k}{k^2} \cos kx
  - 4 \pi \sum_{k=1}^\infty \frac {(-1)^{k}} k \sin kx 
\end{align*}

The values to which the Fourier series converges at $-\pi$ and $\pi$
are the same, because of the period $2\pi$.

For $x=\pi \mbox{ or } -\pi$ we get
\begin{align*}
  \frac 4 3 \:  \pi^2
  + 4 \sum_{k=1}^\infty \frac {(-1)^k}{k^2} \cos k\pi
  - 4 \pi \sum_{k=1}^\infty \frac {(-1)^{k}} k \sin k\pi 
  &= \frac 4 3 \:  \pi^2
  + 4 \sum_{k=1}^\infty \frac {1}{k^2}
  = \frac 4 3 \:  \pi^2 + 4 \frac {\pi^2} 6 = 2 \pi^2 \, ,
\end{align*}

for $x=0 \mbox{ or } 2\pi$ we get
\begin{align*}
  \frac 4 3 \:  \pi^2 + 4 \sum_{k=1}^\infty \frac {(-1)^k}{k^2} \, ,
\end{align*}
which has to be the same as $f(0)=\pi^2$, because $0 \in (-\pi,\pi)$.
\end{document}