Area of an irregular polygon

enter image description here

Let $O$ is the origin. Denote "signed area" of triangle $OAB$: $~~S_{OAB}= \dfrac{1}{2}(x_Ay_B-x_By_A)$.
It can be derived from cross product of vectors $\vec{OA}, \vec{OB}$.

If way $AB$ is $\circlearrowleft$ (if polar angle of $A$ less than polar angle of $B$), then $S_{OAB}>0$ ;
if way $AB$ is $\circlearrowright$ (if polar angle of $A$ greater than polar angle of $B$), then $S_{OAB}<0$.

Now, for each edge $A_jA_{j+1}$ ($j=1,2,\ldots,n$; $A_{n+1}\equiv A_1$) of polygon $A_1A_2\ldots A_n$ we can build $2$ vectors: $\vec{OA_j}$ and $\vec{OA_{j+1}}$.

And "signed area" of polygon (which sign depends on numerating direction) $$ S_{A_1A_2...A_n} = \sum_{j=1}^n S_{OA_jA_{j+1}} = \sum_{j=1}^n \dfrac{1}{2}(x_jy_{j+1}-x_{j+1}y_j) = \dfrac{1}{2}\sum_{j=1}^n (x_jy_{j+1}-x_{j+1}y_j). $$

When positive term adds, then square will increase, when negative, then area will decrease.

We will mark "positive" area as blue, and "negative" as red.

Illustration:
enter image description here


The formula in question can be explained by means of Green's formula in the plane.

Let ${\bf F}=(P,Q)$ be a force field in the plane, and assume that $\Omega$ is a finite domain with boundary cycle $\partial\Omega$. Then Green's formula says that $$\int\nolimits_{\partial B} (P\>dx+Q\>dy)=\int\nolimits_B (Q_x-P_y)\ {\rm d}(x,y)\ .\tag{1}$$ When ${\bf F}=(0,x)$ or ${\bf F}=(-y,0)$ then $Q_x-P_y\equiv1$, and the right hand side of $(1)$ just gives the area of $\Omega$. It follows that $${\rm area}(\Omega)=\int\nolimits_{\partial B} x\ dy=-\int\nolimits_{\partial B} y\ dx={1\over2}\int\nolimits_{\partial B} (x\> dy-y\>dx)\ ,$$ where practical considerations dictate which version should be applied in the particular case at hand.

When $\Omega$ is a polygon with $n$ vertices given in cyclic order then $\partial\Omega$ consists of $n$ directed segments $\sigma_k$. Writing out the line integral for each $\sigma_k$ and cyclically summing over $k$ one arrives at the given formula (resp. to one of its equivalents).