# How do I find the limits of integration?

NOTE: the topic is Green's Theorem in the Plane

I'm working on a problem that requires me to find the outward flux of the field:

$$F = \left(3xy - \frac{x}{1+y^2}\right) \hat{i} + \left(e^x + \arctan(y) \right) \hat{j}$$

across the cardioid $r = a(1+ \cos(\theta)), a > 0$.

I've already set up the integral, but I'm having trouble understanding how to find the limits of integration. (The integral that I've set up is: the double integral of $3y dx dy$) Thank you in advance!

Let $\pmb{F} = M(x,y) \pmb{i} + N(x,y) \pmb{j}$ be the vector field over a region $\mathcal{D}$ in the plane with $$M(x,y)=\left(3xy - \frac{x}{1+y^2}\right)\quad\text{and}\quad N(x,y)=\left(e^x + \arctan y \right).$$ Denote by $\mathcal{C}$ the cardioid $r = a(1+ \cos(\theta)), a > 0,\theta\in[0,2\pi)$ in $\mathcal{D}$, and by $\mathcal{S}$ the region enclosed by this loop.
The outward flux $\Phi$ of $\pmb{F}$ across $\mathcal{C}$ is equal to the double integral of $\operatorname{div}(\pmb{F})$ over $\mathcal{S}$:
$$\Phi=\oint_{\mathcal{C}} \pmb{F}\cdot \hat{\pmb{n}}\operatorname{d}s=\oint_{\mathcal{C}} (M\operatorname{d}x-N\operatorname{d}y)=\iint_{\mathcal{S}} \left(\frac{\partial M}{\partial x} +\frac{\partial N}{\partial y} \right) \operatorname{d}x \operatorname{d}y.$$ Observing that $\frac{\partial M}{\partial x}=3y - \frac{1}{1+y^2}$ and $\frac{\partial N}{\partial y}=\frac{1}{1+y^2}$, we have \begin{align} \Phi&=\iint_{\mathcal{S}} \left(\frac{\partial M}{\partial x} +\frac{\partial N}{\partial y} \right) \operatorname{d}x \operatorname{d}y=\iint_{\mathcal{S}} 3y \operatorname{d}x \operatorname{d}y\\ &=\iint_{\mathcal{S}} 3r\sin\theta \cdot r\operatorname{d}r \operatorname{d}\theta\qquad\qquad\text{(transforming to polar coordinates)}\\ &=\int_{0}^{2\pi}\int_0^{a(1+ \cos\theta)}3r^2\sin\theta \operatorname{d}r \operatorname{d}\theta=\int_{0}^{2\pi}3\left[\frac{r^3}{3}\right]_0^{a(1+ \cos\theta)}\sin\theta \operatorname{d}\theta\\ &=a^3\int_{0}^{2\pi}(1+ \cos\theta)^3\sin\theta \operatorname{d}\theta\\ &=a^3\int_{0}^{2\pi}\cos^6\left(\frac{\theta}{2}\right)2\sin\left(\frac{\theta}{2}\right)\cos\left(\frac{\theta}{2}\right) \operatorname{d}\theta\\ &=a^3\int_{0}^{2\pi}\cos^7\left(\frac{\theta}{2}\right)2\sin\left(\frac{\theta}{2}\right) \operatorname{d}\theta\\ &=4a^3\int_{0}^{\pi}\cos^7 u \sin u \operatorname{d}u\qquad (\text{putting}\;u=\theta/2)\\ &=4a^3\left[-\frac{1}{8}\cos^8 u\right]_0^{\pi}=0. \end{align}