My question is:
Suppose that $f$ is $2\pi$-periodic, and $C^{k}$. Show that $\hat{f}(n)=O\left(\frac{1}{|n|^{k}}\right)$ as $n\rightarrow\infty$. This notation means that there is a constant $C$ such $|\hat{f}(n)|\leq C/|n|^{k}$.
My attempt:
Using the complex notation, $$\hat{f}(n)=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)e^{-inx}dx$$
Using integration by parts, I can see that
$$\int_{-\pi}^{\pi}f(x)e^{-inx}dx=-\sum_{j=i}^{k}\left.\frac{1}{i^{j}n^{j}}f^{(j-1)}(x)e^{-inx}\right|_{-\pi}^{\pi}+\int_{-\pi}^{\pi}f^{(k)}(x)e^{-inx}dx $$
First, $f^{(k)}$ is continuous on $[-\pi,\pi]$, so the integral on the right side exists. By the equation above,
\begin{equation} \left|\int_{-\pi}^{\pi}f(x)e^{-inx}dx\right|\leq|\sum_{j=i}^{k}\left|\left.\frac{1}{i^{j}n^{j}}f^{(j-1)}(x)e^{-inx}\right|_{-\pi}^{\pi}\right|+\int_{-\pi}^{\pi}\left|f^{(k)}(x)e^{-inx}\right|dx \tag{1} \label{1} \end{equation}
There is a constant $A>0$ such that $$\int_{-\pi}^{\pi}\left|f^{(k)}(x)e^{-inx}\right|dx\leq A\cdot 2\pi,$$ and we have
\begin{equation} \left|\int_{-\pi}^{\pi}f(x)e^{-inx}dx\right|\leq\sum_{j=i}^{k}\left|\left.\frac{1}{i^{j}n^{j}}f^{(j-1)}(x)e^{-inx}\right|_{-\pi}^{\pi}\right|+\frac{A}{2\pi} \tag{2} \label{2} \end{equation}
Now, let
$$M=\frac{1}{2\pi}\max_{1\leq j\leq k} \left|\left.\frac{f^{(j-1)}(x)e^{-inx}}{i^{j}}\right|_{-\pi}^{\pi}\right|.$$
By $\ref{2}$, we have
\begin{equation} \left|\int_{-\pi}^{\pi}f(x)e^{-inx}dx\right|\leq M \sum_{j=i}^{k}\frac{1}{|n|^{j}}+\frac{A}{2\pi} \tag{3} \label{3} \end{equation}
So, replacing, we got by $\ref{3}$,
\begin{equation} \left|\hat{f}(n)\right|\leq 2\pi M \sum_{j=i}^{k}\frac{1}{|n|^{j}}+A \end{equation}
I think I'm close to prove that there is a constant $B$ such that
\begin{equation} |n|^{k}\hat{f}(n)\leq B \tag{4} \label{4} \end{equation}
Did I work right till here? If yes, what can I do to finish my problem?
First, note that if $h$ is a periodic function over $[-\pi, \pi)$, then
\begin{align} h(x)e^{-inx} \lvert_{-\pi}^{\pi} &= h(\pi)e^{-in \pi} - h(- \pi)e^{in \pi} \\ &= h(\pi)e^{-in \pi} - h(\pi)e^{in \pi} \\ &= -2i h(\pi) \left[ \frac{e^{in \pi} - e^{-in \pi}}{2i} \right] \\ &= -2i h(\pi) \sin(n \pi) \\ &= 0 \end{align}
Hence, integrating by parts $k$ times and using the fact that if $f$ is periodic with period $\alpha$, then $f'$ is periodic with period $\alpha$, we have
\begin{align} \hat{f} &= \frac{1}{2 \pi} \int_{-\pi}^{\pi} f e^{-inx} dx \\ &= \frac{1}{2 \pi} \left[ \require{cancel} \cancel{\frac{f e^{-inx}}{-in} \bigg|_{-\pi}^{\pi}} + \frac{1}{in} \int_{-\pi}^{\pi} f' e^{-inx} dx \right] \\ &= \frac{1}{2 \pi} \frac{1}{in} \int_{-\pi}^{\pi} f' e^{-inx} dx \\ &= \frac{1}{2 \pi} \frac{1}{in} \left[ \require{cancel} \cancel{\frac{f' e^{-inx}}{-in} \bigg|_{-\pi}^{\pi}} + \frac{1}{in} \int_{-\pi}^{\pi} f'' e^{-inx} dx \right] \\ &= \frac{1}{2 \pi} \frac{1}{(in)^{2}} \int_{-\pi}^{\pi} f' e^{-inx} dx \\ &= \dots \\ &= \frac{1}{2 \pi} \frac{1}{(in)^{k}} \int_{-\pi}^{\pi} f^{(k)} e^{-inx} dx \\ \implies |\hat{f}| &= \bigg| \frac{1}{2 \pi} \frac{1}{(in)^{k}} \int_{-\pi}^{\pi} f^{(k)} e^{-inx} dx \bigg| \\ &\le \frac{1}{n^{k}} \cdot \underbrace{\frac{1}{2 \pi} \int_{-\pi}^{\pi} |f^{(k)}| dx}_{C} \end{align}
Therefore, we have $\hat{f} = \mathcal{O}(n^{-k})$.