How can you calculate the area of a polygon given its vertices?

  • Thread starter Thread starter Chris L T521
  • Start date Start date
Click For Summary
The discussion focuses on calculating the area of a polygon defined by its vertices in a counterclockwise orientation. The area formula is derived using the coordinates of the vertices, expressed as a sum of determinants involving pairs of coordinates. Participants shared their solutions, with MarkFL and Sudharaka providing correct answers. The problem encourages engagement with geometric concepts and the application of linear algebra techniques. This method of area calculation is essential for computational geometry and related fields.
Chris L T521
Gold Member
MHB
Messages
913
Reaction score
0
Thanks to those who participated in last week's POTW! Here's this week's problem!

-----

Problem: Let $(x_1,y_1),(x_2,y_2),\ldots,(x_n,y_n)$ be points in $\mathbb{R}^2$ such that when they are joined together in succession by line segments [and $(x_n,y_n)$ is joined to $(x_1,y_1)$], the segments enclose a polygonal region $R$ (see attached picture).


Assuming that the polygonal boundary is counterclockwise oriented, prove that the area of the region $R$ is given in terms of the coordinates of its vertices as follows:

\[A(R)=\frac{1}{2}\left(\begin{vmatrix}x_1 & x_2\\ y_1 & y_2\end{vmatrix}+\begin{vmatrix}x_2 & x_3\\ y_2 & y_3\end{vmatrix}+\cdots+\begin{vmatrix}x_{n-1} & x_n\\ y_{n-1} & y_n\end{vmatrix}+\begin{vmatrix}x_n & x_1\\ y_n & y_1\end{vmatrix}\right)\]

-----

Hint:
Use Green's Theorem.

 

Attachments

  • polygonalregion.png
    polygonalregion.png
    4.1 KB · Views: 109
Last edited:
Physics news on Phys.org
P.S: For you curious ones out there, here's the TeX code I used to make that image. [I originally was going to put this in the original question post, but it exceeded the character limit... >_>]

Code:
\begin{figure}
   \centering
   \begin{tikzpicture}[domain=-6:6]
      \draw[->] (-3,-1) -- (-3,5) node[above]{$y$};
      \draw[->] (-4,0) -- (5.5,0) node[right]{$x$};
      \fill (2,.5) -- (3.5,1.5) -- (4,3) -- (2.5,4) -- (0,4) -- (-1.5,2.5) -- (-1, 1.5) -- (0,2) -- (1.5,1.5);
      \draw (2,.5) -- (3.5,1.5) -- (4,3) -- (2.5,4) -- (0,4) -- (-1.5,2.5) -- (-1, 1.5) -- (0,2) -- (1.5,1.5) -- (2,.5);
      \fill (2,.5) circle (2pt);
      \fill (3.5,1.5) circle (2pt);
      \fill (4,3) circle (2pt);
      \fill (2.5,4) circle (2pt);
      \fill (0,4) circle (2pt);
      \fill (-1.5,2.5) circle (2pt) node[right]{$\color{black}(x_n,y_n)$};
      \fill (-1, 1.5) circle (2pt) node[below]{$\color{black}(x_1,y_1)$};
      \fill (0,2) circle (2pt)  node[above=.25cm,right]{$\color{black}(x_2,y_2)$};
      \fill (1.5,1.5) circle (2pt) node[right]{$\color{black}(x_3,y_3)$};
      \draw (2,.5) -- (2.75,1);
      \draw (3.5,1.5) -- (3.75,2.25);
      \draw (4,3) -- (3.25,3.5);
      \draw (2.5,4) -- (1.25,4);
      \draw (0,4) -- (-.75,3.25);
      \draw (-1.5,2.5) -- (-1.25,2);
      \draw (-1,1.5) -- (-.5,1.75);
      \draw (0,2) -- (.75,1.75);
      \draw (1.5,1.5) -- (1.75,1);
   \end{tikzpicture}
   
\end{figure}

To get it to compile, you'll need the tikz package!)
 
This week's question was correctly answered by MarkFL and Sudharaka.

Here's MarkFL's solution:

Using Green's theorem, we may state:

$\displaystyle A(R)=\int_{R}\langle 0,x \rangle\cdot dr=\int_{R}\langle -y,0 \rangle\cdot dr$

Let $\displaystyle R_k$ be an arbitrary side of $\displaystyle R$, which we may parametrize as follows:

$\displaystyle r_k(t)=\langle x_k+t(x_{k+1}-x_k),y_k+t(y_{k+1}-y_k) \rangle$ where $\displaystyle 0\le t\le1$

where $\displaystyle 1\le k\le n$ and $\displaystyle (x_{n+1},y_{n+1})=(x_1,y_1)$.

Using the two integrals above, we may state:

(1) $\displaystyle A(R)=\int_{R}\langle 0,x \rangle\cdot dr=\sum_{k=1}^n\left(\int_{R_k}\langle 0,x \rangle\cdot dr \right)$

(2) $\displaystyle A(R)=\int_{R}\langle -y,0 \rangle\cdot dr=\sum_{k=1}^n\left(\int_{R_k}\langle -y,0 \rangle\cdot dr \right)$

Using:

$\displaystyle r_k'(t)=\langle x_{k+1}-x_k,y_{k+1}-y_k \rangle$

we now have:

$\displaystyle \int_{R_k}\langle 0,x \rangle\cdot dr=\int_0^1 \langle 0,x_k+t(x_{k+1}-x_k) \rangle\cdot\langle x_{k+1}-x_k,y_{k+1}-y_k \rangle\,dt$

$\displaystyle \int_{R_k}\langle 0,x \rangle\cdot dr=(y_{k+1}-y_k)\int_0^1 x_k+t(x_{k+1}-x_k)\,dt$

$\displaystyle \int_{R_k}\langle 0,x \rangle\cdot dr=(y_{k+1}-y_k)\left[x_kt+(x_{k+1}-x_k)\frac{t^2}{2} \right]_0^1$

$\displaystyle \int_{R_k}\langle 0,x \rangle\cdot dr=(y_{k+1}-y_k)\left(x_k+\frac{1}{2}(x_{k+1}-x_k) \right)$

$\displaystyle \int_{R_k}\langle 0,x \rangle\cdot dr=\frac{1}{2}(y_{k+1}-y_k)(x_k+x_{k+1})$

Using our summation formula (1), we find:

$\displaystyle A(R)=\sum_{k=1}^n\left(\frac{1}{2}(y_{k+1}-y_k)(x_k+x_{k+1}) \right)$

Using the second integral, we have:

$\displaystyle \int_{R_k}\langle -y,0 \rangle\cdot dr=\int_0^1 \langle -(y_k+t(y_{k+1}-y_k)),0 \rangle\cdot\langle x_{k+1}-x_k,y_{k+1}-y_k \rangle\,dt$

$\displaystyle \int_{R_k}\langle -y,0 \rangle\cdot dr=(x_{k+1}-x_k)\int_0^1 -(y_k+t(y_{k+1}-y_k)\,dt$

$\displaystyle \int_{R_k}\langle -y,0 \rangle\cdot dr=-(x_{k+1}-x_k)\left[y_kt+(y_{k+1}-y_k)\frac{t^2}{2} \right]_0^1$

$\displaystyle \int_{R_k}\langle -y,0 \rangle\cdot dr=-(x_{k+1}-x_k)\left(y_k+\frac{1}{2}(y_{k+1}-y_k) \right)$

$\displaystyle \int_{R_k}\langle -y,0 \rangle\cdot dr=\frac{1}{2}(x_k-x_{k+1})(y_k+y_{k+1})$

Using our summation formula (2), we find:

$\displaystyle A(R)=\sum_{k=1}^n\left(\frac{1}{2}(x_k-x_{k+1})(y_k+y_{k+1}) \right)$

Adding the two summations, there results:

$\displaystyle 2A(R)=\sum_{k=1}^n\left(\frac{1}{2}(y_{k+1}-y_k)(x_k+x_{k+1}) \right)+\sum_{k=1}^n\left(\frac{1}{2}(x_k-x_{k+1})(y_k+y_{k+1}) \right)$

$\displaystyle 4A(R)=\sum_{k=1}^n\left((y_{k+1}-y_k)(x_k+x_{k+1})+(x_k-x_{k+1})(y_k+y_{k+1}) \right)$

$\displaystyle 4A(R)=2\sum_{k=1}^n\left(x_ky_{k+1}-x_{k+1}y_k \right)$

$\displaystyle 2A(R)=\sum_{k=1}^n\left(\begin{vmatrix}x_k & x_{k+1}\\ y_k & y_{k+1}\end{vmatrix} \right)$

Hence:

$\displaystyle A(R)=\frac{1}{2}\left(\begin{vmatrix}x_1 & x_2\\ y_1 & y_2\end{vmatrix}+\begin{vmatrix}x_2 & x_3\\ y_2 & y_3\end{vmatrix}+\cdots+\begin{vmatrix}x_{n-1} & x_n\\ y_{n-1} & y_n\end{vmatrix}+\begin{vmatrix}x_n & x_1\\ y_n & y_1\end{vmatrix}\right)$

Shown as desired.

Here's Sudharaka's solution:

Using the Green's theorem with \(M=\dfrac{x}{2}\) and \(L=-\dfrac{y}{2}\) we get,

\[A=\iint_{R}\mathrm{d}x\, \mathrm{d}y=\frac{1}{2}\oint_{C} (-y\, \mathrm{d}x + x\, \mathrm{d}y)\]

where \(C\) is the boundary of the region \(R\).

\[\therefore A=\frac{1}{2}\sum_{k=1}^{n}\int_{A_1}^{A_2}(-y\, \mathrm{d}x + x\, \mathrm{d}y)\]

where \(A_{1}=(x_{k},\, y_{k})\) and \(A_2=(x_{k+1},\, y_{k+1})\) with \((x_{n+1},\,y_{n+1})=(x_{1},\,y_{1})\).

The equation of the line joining the points, \(A_1\) and \(A_2\) is,

\[y=y_{k+1}+\left(\frac{y_{k+1}-y_{k}}{x_{k+1}-x_{k}}\right)(x-x_{k+1})\]

\[\therefore dy=\left(\frac{y_{k+1}-y_{k}}{x_{k+1}-x_{k}}\right)dx\]

Hence we get,

\begin{eqnarray}

A&=&\frac{1}{2}\sum_{k=1}^{n}\int_{A_1}^{A_2} \left[-y_{k+1}-\left(\frac{y_{k+1}-y_{k}}{x_{k+1}-x_{k}}\right)(x-x_{k+1})+x \left(\frac{y_{k+1}-y_{k}}{x_{k+1}-x_{k}}\right)\right]\, dx\\

&=&\frac{1}{2}\sum_{k=1}^{n}\int_{A_1}^{A_2} \left[-y_{k+1}+\left(\frac{y_{k+1}-y_{k}}{x_{k+1}-x_{k}}\right)x_{k+1}\right]\, dx\\

&=&\frac{1}{2}\sum_{k=1}^{n}\left\{\left[-y_{k+1}+\left(\frac{y_{k+1}-y_{k}}{x_{k+1}-x_{k}}\right)x_{k+1}\right](x_{k+1}-x_{k})\right\}\\

&=&\frac{1}{2}\sum_{k=1}^{n}(y_{k+1}x_k-y_{k}x_{k+1})\\

&=&\frac{1}{2}\sum_{k=1}^{n}\begin{vmatrix}x_{k} & x_{k+1}\\ y_{k} & y_{k+1}\end{vmatrix}\\

&=&\frac{1}{2}\left(\begin{vmatrix}x_1 & x_2\\ y_1 & y_2\end{vmatrix}+\begin{vmatrix}x_2 & x_3\\ y_2 & y_3\end{vmatrix}+\cdots+\begin{vmatrix}x_{n-1} & x_n\\ y_{n-1} & y_n\end{vmatrix}+\begin{vmatrix}x_n & x_1\\ y_n & y_1\end{vmatrix}\right)

\end{eqnarray}
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K