Understanding the use of Morera's Theorem Here is the question I am trying to understand its solution:



I am trying to learn complex analysis by myself, the statement of Morera's theorem I can see in the book I am using is:
Let $f(z)$ be continuous in a domain D. If $\int_C f(z) dz = 0$ along every simple closed contour $C$ contained in $D,$ then $f(z)$ is analytic in $D.$
But I do not understand how $f(z)$ being analytic will lead to that $f(z)$ will be equal zero. I also did not understand the solution of the case $m \geq 1$ and why the integration in this case and what does it mean for the integration to be $-2$ in regard to the required to be proved?
Could anyone help me answer these questions please?  Is the solution of the question correct?
 A: I agree that the solution provided is unclear, and is far too short to really show the delicate nature of this exercise. I will go over each and every step and its justification in the solution process of this exercise. The result of the exercise is rather obvious, but the details very much are not.
First, we review:

Morera's Theorem: Let $U\subseteq \mathbb C$ be an open set and let $\phi:U\to \mathbb C$. If, for any closed piecewise $C^1$ curve $S$ contained in $U$, we have $\oint _S \phi(z)\mathrm dz=0$, then $\phi$ is analytic in $U$.

Problem: Let's suppose $$f:\mathbb C\setminus \{0\}\to\mathbb C\\f(z)=\sum_{k=1}^n c_kz^{-k}$$ where each $c_k$ is a complex number, and that
$$\oint_S f(z)(z-w)^{2m}\mathrm dz=0\tag{1}$$
For all $m\in\mathbb N_0$, all $w\in\mathbb C$, and for all contours $S$ contained in $\Bbb C\setminus \{0\}$. Then $f\equiv 0$.
Proof:
By Morera's theorem, we know that if $(1)$ holds for any contour $S$, then the function $z\mapsto f(z)(z-w)^{2m}$ must be analytic. In particular, consider $w=0$. Then the function
$$z\mapsto z^{2m}\sum_{k=1}^n c_kz^{-k}$$
Must be analytic. However, recall:

Cauchy's Theorem. Let $U$ be an open subset of $\Bbb C$ and let $\phi:U\to\Bbb C$ be analytic in $U$. Then, for every piecewise smooth closed curve $S$ contained entirely in $U$,
$$\oint_S \phi(z)\mathrm dz=0$$

(Cauchy's theorem and Morera's theorem are conjugate statements.) Therefore, in particular, we should have
$$\oint\limits_{\partial\Bbb B(0,1)}z^{2m}\sum_{k=1}^n c_k z^{-k}~\mathrm dz=0\tag{2}$$
Another theorem needed:

Cauchy's Residue Theorem. Let $U$ be an open subset of $\Bbb C$ and let $\phi:U\to\Bbb C$ be meromorphic, having poles at points $z_1,\dots,z_m\in U$. Then, for every non-intersecting, piecewise smooth closed curve $S$ entirely contained in $U$, surrounding all of the poles of $\phi$, we have
$$\oint_S \phi(z)\mathrm dz=2\pi i\sum_{k=1}^m \operatorname{Res}(\phi,z_k)$$

Going back to $(2)$, and taking $m=0$ in particular, this means
$$\oint\limits_{\partial\mathbb B(0,1)}\sum_{k=1}^n c_k z^{-k}~\mathrm dz=2\pi i c_1=0 \\ \implies c_1=0$$
Taking $m=1$,
$$\oint\limits_{\partial\Bbb B(0,1)}\sum_{k=1}^n c_k z^{2-k}~\mathrm dz=2\pi i c_3=0 \\ \implies c_3=0$$
In this way we can enforce $c_1=c_3=\dots=c_{2k+1}=\dots=0$. So, we now know that $f$ must be of the form
$$f(z)=\frac{c_2}{z^2}+\frac{c_4}{z^4}+\dots=\sum_{k=1}^{\lfloor n/2\rfloor}c_{2k}z^{-2k}$$
Can we eliminate the even numbered coefficients as well? Yes. Recall that we said the function
$$z\mapsto f(z)(z-w)^{2m}$$
Must be analytic. We select $w=1$. Then, by Cauchy's theorem,
$$\oint\limits_{\partial \Bbb B(0,1)}(z-1)^{2m}\sum_{k=1}^{\lfloor n/2 \rfloor}c_{2k}z^{-2k}~\mathrm dz=0 \\ \sum_{k=1}^{\lfloor n/2 \rfloor}c_{2k} \oint\limits_{\partial \Bbb B(0,1)}(z-1)^{2m}z^{-2k}~\mathrm dz=0 \tag{3}$$
So we consider the integral
$$I(m,k)=\oint\limits_{\partial \Bbb B(0,1)}\frac{(z-1)^{2m}}{z^{2k}}~\mathrm dz = 2\pi i\operatorname{Res}(\phi,0)$$
Where $\phi(z)=\frac{(z-1)^{2m}}{z^{2k}}$.
One final theorem needed:

Calculation of Residues. Let $\phi$ be a meromorphic function with a pole of order $N$ at the point $s\in\Bbb C$. Then,
$$\operatorname{Res}(\phi,s)=\frac{1}{(N-1)!} \lim_{z\to s}~\mathrm D^{N-1}\bigg(w\mapsto (w-s)^N \phi(w)\bigg)(z)$$

Then, looking at $\phi(z)=(z-1)^{2m}z^{-2k}$,
$$\operatorname{Res}(\phi,0)=\frac{1}{(2k-1)!}\lim_{z\to 0}~\mathrm D^{2k-1} \bigg(w\mapsto (w-1)^{2m}\bigg)(z)$$
But, $(z-1)^{2m}$ is a polynomial of degree $2m$, and so its $(2k-1)$th derivative at $0$ is either
$$\mathrm D^{2k-1} \bigg(w\mapsto (w-1)^{2m}\bigg)(z) = \begin{cases}(2k-1)!\cdot \big((2k-1)\text{th coeff. of }(z-1)^{2m}\big) & k\leq m \\0 & k>m\end{cases}$$
The upshot of this is that $I(m,k)\neq 0$ whenever $m\geq k$. Now, return to $(3)$:
$$\sum_{k=1}^{\lfloor n/2 \rfloor}c_{2k}~I(m,k)=0 \\ \forall m$$
Choosing $m=2$ we can eliminate the $k=1$ or the $c_2$ coefficient. Choosing $m=3$ we can eliminate the $k=2$ or the $c_4$ coefficient and we can continue doing so until we have enforced that all of the $c_{2k}$ are equal to $0$.
$\blacksquare$
