Integral over circle area limited by two straight lines I need to integrate a function over the area limited by the circle and two straight lines, i.e.$x^2+y^2<R^2$ and $x<-b, y>a$. For this I integrate over $y$ from $a$ to $\sqrt{R^2-x^2}$ and $x$ from $-\sqrt{R^2-a^2}$ to $-b$. The problem is the result I get is not equal to $0$ if I substitute $a=R$ or $b=R$, which is what I would have expected it to be correct, since then the area limited by these curves dissapear. Are these limits wrong and should I add some Heaviside function to meet my expectations or the integration result is correct and I should expect this kind of behaviour?
 A: Consider the lines $x = -b$ and $y = a.$
These two lines are perpendicular and divide the plane into three quadrants
around the point $(-b,a).$
The two conditions $x < -b$ and $y > a$ together say that we can integrate only in the quadrant that is above and to the left of the point $(-b,a).$
If $a$ and $b$ are both positive, it should be clear that this quadrant intersects the disk $x^2 + y^2 < R^2$ only if $(-b,a)$ is inside the disk.
That is, if $(-b)^2 + a^2 = a^2 + b^2 \geq R^2$ then there is no area to integrate over, and the integral is zero.
If $a = R$ or $b = R$ then you will always have $a^2 + b^2 \geq R^2$,
so your original thinking that the integral should be zero was correct.
But if you blindly apply the formulas for the lower and upper bounds you may not get a zero integral. You should also see then that the lower bound is greater than the upper bound in at least one of the integrals, which is a symptom of the error.
The general procedure for integrating over a region is,
first determine that you have a region of integration at all,
then determine what the region is,
then find formulas for the bounds of the integrals.
I suppose you could multiply the entire integral by a Heaviside function whose value is $1$ when $a^2 + b^2 < R^2$ and $0$ when $a^2 + b^2 > R^2,$
and this would give you the correct zero result when $(-b,a)$ is outside the disk, but I think it is simpler to just put a condition on the answer.
If you allow $a < 0$ or $b < 0$ then the situation becomes more complicated.
You have a region of integration if $(-b,a)$ is in the first quadrant below the line $y=R$, in the third quadrant to the right of the line $x=-R,$ or in the fourth quadrant. In some cases you may have to change the order of integration or even split the integral into two parts that are added together at the end in order to get correct results.
A: I think my expectations are wrong and if a or b=R then I should get negative result. It should be 0 when a=sqrt(1-b^2) or b=-sqrt(1-a^2)
