You are currently browsing the tag archive for the ‘geometry’ tag.

The Shoelace Algorithm to find areas of polygons

This is a nice algorithm, formally known as Gauss’s Area formula, which allows you to work out the area of any polygon as long as you know the Cartesian coordinates of the vertices.  The case can be shown to work for all triangles, and then can be extended to all polygons by first splitting them into triangles and following the same approach.

Let’s see if we can work out the algorithm ourselves using the construction at the top of the page.  We want the area of the triangle (4), and we can see that this will be equivalent to the area of the rectangle minus the area of the 3 triangles (1) (2) (3).

Let’s start by adding some other coordinate points for the rectangle:

Therefore the area of the rectangle will be:

(1) + (2) +(3) +(4): (x3-x2)(y1-y3)

And the area of triangles will be:

(1): 0.5(x3-x2)(y2-y3)

(2): 0.5(x1-x2)(y1-y2)

(3): 0.5(x3-x1)(y1-y3)

Therefore the area of triangle (4) will be:

Area = (x3-x2)(y1-y3) – 0.5(x3-x2)(y2-y3) – 0.5(x1-x2)(y1-y2) – 0.5(x3-x1)(y1-y3)

Therefore we have our algorithm!  Let’s see if it works with the following coordinates added:

x1 = 2  x = 1  x = 3
y1 = 3 y = 2  y = 1

Area = (x3-x2)(y1-y3) – 0.5(x3-x2)(y2-y3) – 0.5(x1-x2)(y1-y2) – 0.5(x3-x1)(y1-y3)

Area = (3-1)(3-1) – 0.5(3-1)(2-1) – 0.5(2-1)(3-2) – 0.5(3-2)(3-1)

Area = 4 – 1 – 0.5 – 1 = 1.5 units squared

We could check this using Pythagoras to find all 3 sides of the triangle, followed by the Cosine rule to find an angle, followed by the Sine area of triangle formula, but let’s take an easier route and ask Wolfram Alpha (simply type “area of a triangle with coordinates (1,2) (2,3) (3,1)).  This does indeed confirm an area of 1.5 units squared.  Our algorithm works.  We can of course simplify the area formula by expanding brackets and simplifying.  If we were to do this we would get the commonly used version of the area formula for triangles.

The general case for finding areas of polygons

The general formula for the area of an n-sided polygon is given above.

For a triangle this gives:

For a quadrilateral this gives:

For a pentagon this gives:

You might notice a nice shoelace like pattern (hence the name) where x coordinates criss cross with the next y coordinate along.  To finish off let’s see if it works for an irregular pentagon.

If we arbitrarily assign our (x1, y1) as (1,1) and then (x2, y2) as (3,2), and continue in a clockwise direction we will get the following:

area = absolute of 0.5( 1×2 + 3×4 + 3×1 + 4×0 + 2×1 – 3×1 – 3×2 – 4×4 – 2×1 – 1×0)

area = 4.

Let’s check again with Wolfram Alpha – and yes it does indeed have an area of 4.

It could be a nice exploration task to take this further and to explore how many different methods there are to find the area of polygons – and compare their ease of use, level of mathematics required and aesthetic appeal.

A geometric proof for the Arithmetic and Geometric Mean

There is more than one way to define the mean of a number.  The arithmetic mean is the mean we learn at secondary school – for 2 numbers a and b it is:

(a + b) /2.

The geometric mean on the other hand is defined as:


So for example with the numbers 1,2,3 the geometric mean is (1 x 2 x 3)1/3.

With 2 numbers, a and b, the geometric mean is (ab)1/2.

We can then use the above diagram to prove that (a + b) /2 ≥ (ab)1/2 for all a and b. Indeed this inequality holds more generally and it can be proved that the Arithmetic mean ≥ Geometric mean.

Step (1) We draw a triangle as above, with the line MQ a diameter, and therefore angle MNQ a right angle (from the circle theorems).  Let MP be the length a, and let PQ be the length b.

Step (2) We can find the length of the green line OR, because this is the radius of the circle.  Given that the length a+b was the diameter, then (a+b) /2 is the radius.

Step (3) We then attempt to find an equation for the length of the purple line PN.

We find MN using Pythagoras:  (MN)2 = a2 +x2

We find NQ using Pythagoras:  (NQ)2 = b2 +x2

Therefore the length MQ can also be found by Pythagoras:

(MQ)2 = (MN) + (NQ)2

(MQ) = a2 +x2 + b2 +x2

But MQ = a + b.  Therefore:

(a + b) = a2 +x2 + b2 +x2

a2+ b2 + 2ab = a2 +x2 + b2 +x2

2ab = x2 +x2

ab = x2

x = (ab)1/2

Therefore our green line represents the arithmetic mean of 2 numbers (a+b) /2 and our purple line represents the geometric mean of 2 numbers (ab)1/2. The green line will always be greater than the purple line (except when a = b which gives equality) therefore we have a geometrical proof of our inequality.

There is a more rigorous proof of the general case using induction you may wish to explore as well.

circular inversion2

Circular inversions II

There are some other interesting properties of circular inversions.  One of which is that they preserve the “angle” between intersecting circles.  Firstly, how can circles have an angle between them?  Well, we draw 2 tangents to both the circles at the point of intersection, and then measure the angle between the 2 tangents:

circular inversion17

Therefore we can see that the “angle” between these 2 circles is 59.85 degrees.  If we then carry out a circular inversion we see the following:

circular inversion16

The inversion has been done with regards to the black circle centred around the origin.  The red and blue circles are mapped from outside the the black circle onto circles inside the black circle.  Now if we do the same as before – by finding the 2 tangents at the point of intersection, we find that the angle has remained the same – it is still 59.85 degrees.

It is also possible to find circles which remain unchanged under the inversion.  This happens when a circle is orthogonal (at a 90 degree angle) to the circle with which the inversion is being carried out.

circular inversion 18

The small circle has an angle of 90 degrees with the large circle, and therefore when we invert with respect to the large circle, we map the small circle onto itself.

The question is, why is all this useful?  Well, an entire branch of mathematics (non-Euclidean geometry) is concerned with being able to map points in our traditional Euclidean worldview (the geometry of high school triangles, parallel lines and circle theorems) to different geometrical systems entirely.  Circular inversion is a good introduction to this concept.

Also, circular inversion can sometimes make studying mathematical shapes easier to understand and explain.  For example, (from Wolfram):

circular inversion21

It would be very difficult to explain mathematically how the shape above is generated – whilst there are patterns, it is not obvious how to explain them. However, if we invert this shape through a circular inversion (with the circle at centre of the image) then we get the following:

circular inversion20

This is the image inside the circle – and now we can clearly see the pattern behind the generated image.  So, inversion has a lot of potential for simplifying geometrical problems.



Visualising Algebra Through Geometry

This picture above is a fantastic example of how we can use geometry to visualise an algebraic expression.  It’s taken from Brilliant – which is a fantastic new forum for sharing maths puzzles.  This particular puzzle was created and uploaded by Arron Kau.  The question is, which of the following mathematical identities does this image represent?


See if you can work it out!  I will put the answer in white text at the bottom of the post – highlight it to reveal the solution.

Another example of the power of geometry in representing mathematical problems is provided by Ian Stewart’s Cabinet of Mathematical Curiosities.  The puzzle itself is pretty famous:

A farmer wants to cross a river and take with him a wolf, a goat, and a cabbage. There is a boat that can fit himself plus either the wolf, the goat, or the cabbage. If the wolf and the goat are alone on one shore, the wolf will eat the goat. If the goat and the cabbage are alone on the shore, the goat will eat the cabbage. How can the farmer bring the wolf, the goat, and the cabbage across the river?

wolf goat cabbage

The standard way of solving it is trial and error with some logic thrown in.  However, as Ian Stewart points out, we can actually utilise 3 dimensional geometry to solve the puzzle.  We start with a 3D wolf-goat-cabbage (w,g,c) space (shown in the diagram).  All 3 start at (0,0,0).  0 represents this side of the bank, and 1 represents the far side of the bank.  The target is to get therefore to (1,1,1).  In (w,g,c) space , the x direction represents the wolf’s movements, the y direction the goat and z the cabbage.  Therefore the 8 possible triplet combinations are represented by the 8 vertices on a cube.

We can now cross out the 4 paths:

(0,0,0) to (1,00) as this leaves the goat with the cabbages

(0,0,0) to (0,0,1) as this leaves the wolf with the goat

(0,1,1) to (1,1,1) as the farmer would leave the goat and cabbage alone

(1,1,0) to (1,1,1) as the farmer would leave the wolf and goat alone.

which reduces the puzzle to a geometric problem – where we travel along the remaining edges – and the 2 solutions are immediately evident.

(eg.  (0,0,0) – (0,1,0) – (1,1,0) – (1,0,0) – (1,0,1)- (1,1,1)   )

What’s really nice about this solution is that it shows how problems seemingly unrelated to mathematics can be “translated” in mathematics – and also it shows how geometrical space can be used for problem solving.

Solution to the initial puzzle, highlight to reveal: The answer is the third option – 13 + 23…. = (1+2+….)2. This is quite a surprising identity. You can see it by seeing that there are (for example) 2 squares of length 2 – this gives you a total area of 2x2x2 = 23. Adding all the squares will give you the same area as a square of sides (1+2+3….)(1+2+3….) – hence the result.



Website Stats


IB Maths Exploration Guide

IB Maths Exploration Guide

A comprehensive 63 page pdf guide to help you get excellent marks on your maths investigation. Includes:

  1. Investigation essentials,
  2. Marking criteria guidance,
  3. 70 hand picked interesting topics
  4. Useful websites for use in the exploration,
  5. A student checklist for top marks
  6. Avoiding common student mistakes
  7. A selection of detailed exploration ideas
  8. Advice on using Geogebra, Desmos and Tracker.

Available to download here.

IB Revision Notes

IB Revision Notes

Full revision notes for SL Analysis (60 pages), HL Analysis (112 pages) and SL Applications (53 pages).  Beautifully written by an experienced IB Mathematics teacher, and of an exceptionally high quality.  Fully updated for the new syllabus.  A must for all Analysis and Applications students!

Available to download here.

IB HL Paper 3 Practice Questions (120 page pdf)

IB HL Paper 3 Practice Questions 

Seventeen full investigation questions – each one designed to last around 1 hour, and totaling around 40 pages and 600 marks worth of content.  There is also a fully typed up mark scheme.  Together this is around 120 pages of content.

Available to download here.

IB Exploration Modelling and Statistics Guide

IB Exploration Modelling and Statistics Guide

A 60 page pdf guide full of advice to help with modelling and statistics explorations – focusing in on non-calculator methods in order to show good understanding. Includes:

  1. Pearson’s Product: Height and arm span
  2. How to calculate standard deviation by hand
  3. Binomial investigation: ESP powers
  4. Paired t tests and 2 sample t tests: Reaction times
  5. Chi Squared: Efficiency of vaccines
  6. Spearman’s rank: Taste preference of cola
  7. Linear regression and log linearization.
  8. Quadratic regression and cubic regression.
  9. Exponential and trigonometric regression.

Available to download here.

Recent Posts

Follow IB Maths Resources from British International School Phuket on