# Complex integral on rectangle

I have to calculate the integral $$\oint_C \frac{z^2+z+1}{(z-i)^2}dz$$ where $$C$$ is the positively oriented rectangle between $$-1, 1, 1+2i, -1+2i$$.

My attempt is to use Cauchy's integral formula, but obviously the integrand is not differentiable at $$i$$ which lies inside $$C$$ which means that it is not holomorphic. Does this matter? If yes, how do I fix it?
If this does not matter, I simply choose e.g. $$z_0=1/2(1+i)$$ which lies inside $$C$$ and calculate its index $$I_C(z_0)=\frac{1}{2\pi i}\oint_C \frac{d\xi}{\xi-z_0}$$ respective to $$C$$ and then use $$f(z_0)I_C(z_0)=\frac{1}{2\pi i}\oint_C\frac{f(\xi)}{\xi-z_0}d\xi$$ Am I on the right track?

• In your penultimate paragraph you introduce a whole slew of undefined symbols: please edit. BTW I think the answer is $2\pi i(2i+1)$. Oct 14, 2022 at 13:18

Note the Cauchy integration is $$f'(\zeta)=\frac{1}{2\pi i}\oint_C\frac{f(z)}{(z-\zeta)^2}dz$$ where $$f(z)$$ is analytic in $$C$$ which is a simple closed curve. Now $$C$$ is the four sides of a square and $$z=i$$ is inside $$C$$. Hence $$\oint_C \frac{z^2+z+1}{(z-i)^2}dz=2\pi i (z^2+z+1)'|_{z=i}=2\pi (2i+1)=2\pi+4\pi i.$$ Here
• Could you please add some explanation? Why does it not matter that $i$ is a singularity? Oct 14, 2022 at 13:56
Let us write $$w=z-i$$, so we have to compute an integral on the "moved square" contour $$S$$, $$\oint_D\frac{h^2 +(2i+1)h +i}{h^2}\; dh\ .$$ Now use ttne Residue Theorem, or just integrate on the contour $$D$$ the functions $$1$$ (to get zero), $$1/h$$ (to get $$2\pi i$$), and $$1/h^2$$ (with primitive $$-1/h$$ to get zero).