how can u change cos(3theta) which is 1/2(z^3+z^-3) to z^2???
Oops, forgot to explain that. I'm kinda used to just writing stuff. I'll let you explain, think about and how that relates to the real part of the residue? It just happens that the real part of the residue is the entire residue and so I just omitted it. My sloppy mistake