Evaluate$$\int_{\gamma} \frac{z^2 + 3\cos(z)}{z^2 - 4} dz$$ where $\gamma$ is the equilateral triangle inside $|z| = 2$, with $-2i$ as one of its points.
I've written down $$ \int_{\gamma} \frac{z^2 + 3\cos(z)}{z^2 - 4} dz = \frac{1}{4}\left(\int_{\gamma} \frac{z^2+3\cos(z)}{z-2} dz + \int_{\gamma} \frac{z^2+3\cos(z)}{z+2} dz\right). $$
Here it goes my problem: Both of the new integrals are $0$, right? Since their poles aren't in the triangle. I'm asking this because the teacher, in his text, says to use the Cauchy formula.
Am I doing this right? Thanks in advance.
I think you are indeed doing this right.
Here is what I'd do: Let $T$ denote the set of points which lie in the equilateral triangle. Let $\Omega \subset \mathbb{C}$ be open, such that $T \subseteq \Omega$, but such that the zeros of $z^2-4$ (i.e. $-2$ and $2$) are not contained in $\Omega$. You can draw a picture to see that this is possible. Then, $f : \Omega \to \mathbb{C}$, defined by $f(z) := (z^3+3\cos(z))/(z^2-4)$, is holomorphic on $\Omega$. Next, we see that $\partial T \simeq \partial \mathbb{D}$, i.e. the curves $\partial T$ and $\partial \mathbb{D}$ are homotopic in $\Omega$. Here $\mathbb{D}$ denotes the unit disk. Because $\partial \mathbb{D}$ is a smooth closed curve and because $\Omega$ is open and simply connected, we can use the Cauchy integral theorem, and obtain $$ \int_{\partial T}f(z)dz = \int_{\partial \mathbb{D}}f(z)dz = 0. $$ In the first equality we used that $\partial T \simeq \partial \mathbb{D}$.
I hope this helps!