Problem. Find the work done by the force $\renewcommand{\vec}{\overrightarrow}\vec{F}(x,y) = (x^2 - y^2) \ \vec{i} + 2xy \ \vec{j}$ in moving a particle counterclockwise around the square with corners $(0,0)$, $(a,0)$, $(a,a)$, $(0,a)$, $a > 0$.
Solution. \begin{align*} \int_{\vec{c}} \vec{F} \cdot d\vec{s} &= \int_{\vec{c}} (x^2 - y^2) \ dx + 2xy \ dy \\ &= \int_0^a x^2 \ dx + \int_0^a 2ay \ dy - \int_0^a (x^2 - a^2) \ dx - \int_0^a 2 \cdot 0 \cdot y \ dy \\ &= \frac{x^3}{3} \bigg\vert_0^a + ay^2 \bigg\vert_0^a - \left(\frac{x^3}{3} - a^2 x \right) \bigg\vert_0^a - 0 \\ &= \frac{a^3}{3} + a^3 - \frac{a^3}{3} + a^3 \\ &= 2a^3. \end{align*}
The problem and solution are given. Can someone explain to me how they set up these integrals? I'm really confused.
If you know the Green theorem, it is also handy for these problems: $$ \oint_C \vec{F}\cdot d\vec{r} = \iint_S\frac{\partial\;2xy}{\partial x}-\frac{\partial(x^2-y^2)}{\partial y}\;dS = \int_{x=0}^a\int_{y=0}^a4y\;dydx = 2a^3 $$
You have one integral to compute instead of four..