Contour Integral along elliptical path The question is:
Let $a,b \in \mathbb{R}$ and let $\Gamma$ denote the curve with parameterization
$\gamma(t) = a\cos(t) + ib\sin(t), 0 \leq t \leq 2\pi . $
Compute
$\int_{\Gamma} |z|^2 dz$ .
My first thoughts with the problem was to check if $|z|^2$ was analytic and therefore it would be $0$. It's not analytic and so my next thought was to write $|z|^2$ as $\bar{z}z$. And then use the fact that $\int_{\Gamma} f(z) dz = \int_{a}^{b} f(\gamma(t))\gamma'(t)dt$ .
When I do this I get
$\int_{0}^{2\pi} (a^2\cos^2(t) + b^2\sin^2(t))(-a\sin(t) + ib\cos(t)) dt$, that is
$$\int_{0}^{2\pi} (-a^3\cos^2(t)\sin(t) + ia^2b\cos^3(t) - ab^2\sin^3(t) + ib^3\sin^2(t)\cos(t)) dt$$
Taking these integrals I'm getting $0$ for each one and that the entire integral is $0$. I thought this couldn't happen because the function is not analytic. Is it still possible for the integral to be $0$ even if the function isn't analytic? Also is there a different way to do this problem? We haven't gotten to residue theorem in the course yet so I have no idea what it is.
 A: Recall for logic:
\begin{array}{|c|c|} \hline
  \text{Conditional statement} &  P\to Q \\
  \text{Converse} & Q\to P \\
  \text{Contrapositive} & \neg Q\to \neg P \\
  \text{Inverse} & \neg P \to \neg Q \\ \hline
\end{array}

*

*Contrapositive is equivalent to the original conditional statement (if $P$ then $Q$).

*Converse and Inverse are equivalent.

*Converse also holds implying $P$ and $Q$ are necessary and sufficient conditions (if and only if).

If the integrand is holomorphic, then the closed contour integral is zero.  However the converse does not hold.
Example
Centroid for area bounded by a closed contour $C$,
\begin{align}
  A &= \frac{1}{2} \oint_C x\, dy-y\, dx \\
  &= \frac{1}{4i} \oint_C \bar z \, dz-z \, d\bar z \\
  &= \frac{1}{4i} \oint_C \bar z \, dz-z \, d\bar z \\
  &= \frac{1}{2i} \oint_C \bar z \, dz \\
  \langle z \rangle &= -\frac{1}{4Ai} \oint_C z^2 \, d\bar z \\
  \langle \bar z \rangle &= -\frac{1}{4Ai} \oint_C \bar z^2 \, dz \\
\end{align}
The last integrand is not analytic but vanishes for central ellipse, though your case is not the centroid formula.
A: $\int_\gamma f(z) \, dz$ happens to be zero in this case because the curve consists of two symmetric arcs on which $f$ takes the same values: $\gamma(t+\pi) = -\gamma(t)$ and $f(-z) = f(z)$, so that
$$
 \int_\gamma f(z) \, dz = \int_0^{2\pi} f(\gamma(t)) \gamma'(t) \, dt
$$
can be split into integrals $\int_0^{\pi}$ and $\int_\pi^{2\pi}$, which add up to zero.
This does not imply that $f$ is holomorphic. Only if $f$ is continuous and $\int_\gamma f(z) \, dz  = 0$ for every closed curve $\gamma$  then $f$ is holomorphic, that is Morera's theorem.
