I am asked to solve $$\oint_{\gamma}\left(\frac{x+y}{x^2+y^2}-y\right)dx+\left(\frac{y-x}{x^2+y^2}+x\right)dy$$ where $\gamma$ is closed curve $\mid x \mid +\mid y \mid = 1$ with counterclockwise orientation.
Using Green's theorem it equals: $$\iint_{D}\left(\frac{-(x^2+y^2)+2x^2-2xy}{(x^2+y^2)^2}+1\right)-\left(\frac{x^2+y^2-2xy-2y^2}{(x^2+y^2)^2}-1\right)dA$$ Simplifying: $$\iint_{D}2dA=2A=4$$ Where A is the area of the enclosed area by $\gamma$.
I've been told that the correct answer is $4-2\pi$. What went wrong in the above calculation?
Formally, your calculations look right, but have you checked that the hypotheses of Green's theorem actually hold? In particular, you need continuous first order partial derivatives throughout the region of integration, and I doubt that this is true at the origin. It appears to me that the partial derivatives don't exist at $(0,0)$.
I think you have to do this one by computing the four line integrals directly.
EDIT
Actually, you can do this one with Green's theorem, but you have to take care. For $0<r<1$, let $\sigma_r$ be the positively circle of radius $r$ centered at the origin, and let $D_r$ be the region inside the given square, but outside $\sigma_r$. By Green's Theorem, $$\int_\gamma P\mathrm{d}x+Q\mathrm{d}y-\int_{\sigma_r} P\mathrm{d}x+Q\mathrm{d}y=\iint_{D_r}\left(Q_x-P_y\right)\mathrm{d}x\mathrm{dy}\tag{1}$$ and your calculation is valid over $D_r$.
The integral of $\sigma_r$ is easily evaluated by switching to polar coordinates. Now, if you let $r\to0+$, you'll get the integral over $\gamma$. Give it a try!