You are currently browsing the category archive for the ‘graphing’ category.

**Chaos and strange Attractors: Henon’s map**

Henon’s map was created in the 1970s to explore chaotic systems. The general form is created by the iterative formula:

The classic case is when a = 1.4 and b = 0.3 i.e:

To see how points are generated, let’s choose a point near the origin. If we take (0,0) the next x coordinate is given by:

We would then continue this process over several thousands iterations. If we do this then we get the very strange graph at the top of the page – the points are attracted to a flow like structure, which they then circulate round. The graph above was generated when we took our starting coordinate as (0.1,0.1), let’s take a different starting point. This time let’s have (1.1, 1.1):

We can see that exactly the same structure appears. All coordinates close to the origin will get attracted to this strange attractor – except for a couple of fixed points near the origin which remain where they are. Let’s see why. First we can rewrite the iterative formula just in terms of x:

Next we use the fact that when we have a fixed point the x coordinate (and y coordinate) will not change. Therefore we can define the following:

This allows us to then make the following equation:

Which we can then solve using the quadratic formula:

Which also gives y:

So therefore at these 2 fixed points the coordinates do not get drawn to the strange attractor.

Above we can see the not especially interesting graph of the repeated iterations when starting at this point!

But we can also see the chaotic behavior of this system by choosing a point very close to this fixed point. Let’s choose (0.631354477, 0.631354477) which is correct to 9 decimal places as an approximation for the fixed point.

We can see our familiar graph is back. This is an excellent example of chaotic behavior – a very small change in the initial conditions has created a completely different system.

This idea was suggested by the excellent Doing Maths With Python – which is well worth a read if you are interested in computer programing to solve mathematical problems.

**Finding focus with Archimedes**

*This post is based on the maths and ideas of Hahn’s Calculus in Context – which is probably the best mathematics book I’ve read in 20 years of studying and teaching mathematics. Highly recommended for both students and teachers!*

Hard as it is to imagine now, for most of the history of mathematics there was no coordinate geometry system and therefore graphs were not drawn using algebraic equations but instead were constructed. The ancient Greeks such as Archimedes made detailed studies of conic sections (parabolas, ellipses and hyperbola) using ideas of relationships in constructions. The nice approach to this method is that it makes clear the link between conic sections and their properties in reflecting light – a property which can then be utilized when making lenses. A parabolic telescope for example uses the property that all light collected through the scope will pass through a single focus point.

Let’s see how we can construct a parabola without any algebra – simply using the constructions of the Greeks. We start with a line and a focus point F not on the line. This now defines a **unique parabola**.

This unique parabola is defined as all the points A such that the distance from A to F is equal as the perpendicular distance from A to the line.

We can see above that point A must be on our parabola because the distance AB is the same as the distance AF.

We can also see that point C must be on our parabola because the length CD is the same as CF. Following this same method we could eventually construct every point on our parabola. This would finally create the following parabola:

**Focus point of a parabolic **mirror

We can now see how this parabola construction gives us an intrinsic understanding of reflective properties. If we have a light source entering parallel to the perpendicular though the focus then we can use the fact that this light will pass through the focus to find the path the light traces before it is reflected out.

Newton made use of this property when designing his parabolic telescope. It’s interesting to note how a different method leads to a completely different appreciation of the properties of a curve.

**Finding the area under a quadratic curve without calculus**

Amazingly a method for finding the area under a quadratic curve was also discovered by the Greek scientist and mathematician Archimedes around 2200 years ago – and nearly 2000 years before calculus. Archimedes’ method was as follows.

Choose 2 points on the curve, join them to make 2 sides of a triangle. Choose the 3rd point of the triangle as the point on the quadratic with the same gradient as the chord. This is best illustrated as below. Here I generated a parabola with focus at (0,1) and line with the x axis.

Here I chose points B and C, joined these with a line and then looked for the point on the triangle with the same gradient. This then gives a triangle with area 4. Archimedes then discovered that the area of the parabolic segment (i.e the total area enclosed by the line BC and the parabola) is 4/3 the area of the triangle. This gives 4/3 of 4 which is 5 1/3. Once we have this we can find the area under the curve (i.e the integral) using simple areas of geometric shapes.

**Using calculus**

We can check that Archimedes’ method does indeed work. We want to find the area enclosed by the 2 following equations:

This is given by:

It works! Now we can try a slightly more difficult example. This time I won’t choose 2 points parallel to the x-axis.

This time I find the gradient of the line joining B and C and then find the point on the parabola with the same gradient. This forms my 3rd point of the triangle. The area of this triangle is approximately 1.68. Therefore Archimedes’ method tells us the area enclosed between the line and the curve will be approximately 4/3 (1.68) = 2.24. Let’s check this with calculus:

Again we can see that this method works – our only error was in calculating an approximate area for the triangle rather than a more precise answer.

So, nearly 2000 years before the invention of calculus the ancient Greeks were already able to find areas bounded by line and parabolic curves – and indeed Archimedes was already exploring the ideas of the limit of sums of areas upon which calculus in based.

**Finding the average distance between 2 points on a hypercube**

This is the natural extension from this previous post which looked at the average distance of 2 randomly chosen points in a square – this time let’s explore the average distance in n dimensions. I’m going to investigate what dimensional hypercube is required to have an average distance of more than one, and then also what happens to the average distance as n approaches infinity.

**Monte Carlo method**

The Monte Carlo method is a very powerful technique which utilizes computational power. Basically we use the fact that the average of a very large number of trials will serve as an approximation to an exact result. In this case I will run a Python program 10 million times – each time it will select 2 coordinate points and then work out the distance between them. It will then find the average of these 10 million trials. The code above generates 2 coordinates in 3 dimensional space inside a unit cube. We can modify this for n-dimensional space by remembering that Pythagoras still works in higher dimensions.

**Results**

Running this code helps to generate the above results. This answers our first question – we need a 7 dimensional unit hypercube until the average distance between two randomly chosen points is greater than 1. We can also see that the difference between the average distances is reducing – but it’s not clear if this will approach a limit or if it will continue growing to infinity. So let’s do some more trials.

**Further trials**

This takes us up to a 22-dimensional hypercube. At this point it’s probably useful to plot a graph to see the trend.

**Reciprocal model**

This reciprocal model is of the form:

We can see that this is a pretty good fit (R squared 0.9994). If this model is accurate then this would suggest that the average distance approaches a limit as n approaches infinity.

**Polynomial model**

This polynomial model is of the form:

We can see that this is also a very good fit (R squared 0.9997). If this model is accurate then as b is greater than 0, this would suggest that the average distance approaches infinity as n approaches infinity.

**Reflection**

Quite annoyingly we have 2 model which both fit the data very accurately – but predict completely different results! Logically we could probably say that we would expect the average distance to approach infinity as n approaches infinity – and also we could possibly justify this by the fact that the polynomial model is a slightly better fit. Given the similarity between the 2 models it probably time to find out the actual results for this.

**Average n-dimensional distance bounds**

Not surprisingly the mathematics required to work this out is exceptionally difficult – and ends up with non-solvable integrals which require analytic solutions. The Monte Carlo method with very large numbers of trials is a reasonably good approach to approximating this answer. There is however a very useful lower and upper bound for the average distance in n dimensional space given by:

This shows immediately that the average distance will approach infinity as n grows large – as the lower bound will grow to infinity. Quite pleasingly we can see that the polynomial model we derived is similar to the lower bound. We can plot both upper and lower bound along with our polynomial model to see how these all compare. We have lower bound (green), polynomial model (black) and upper bound (green):

We can see that our polynomial model very closely follows the upper bound in our domain. As we extend the domain this polynomial approximation remains above the lower and tracks the upper bounds before gradually growing less accurate. When n is 50 our model predicts a distance of 2.94, whereas the upper bound is 2.88. This is quite a nice result – we have used the Monte Carlo method to derive a polynomial approximation to the average distance in n-dimensional hypercubes and it both closely follows the upper bound over a reasonable domain and also is of a very similar form to the lower bound. We can use this lower bound to see that a 36 dimensional hypercube (and higher) would be guaranteed to have an average distance of more than 2.

**Conclusion**

This was a nice example of the power of the Monte Carlo method in these kind of problems – we were able to use it quite successfully to get a polynomial approximation which turned out to be reasonably accurate. We could have significantly improved this accuracy by running 100 million (or 1 billion etc) trials each time – though this would have probably required a more powerful computer!

**Have you got a Super Brain?**

Adapting and exploring maths challenge problems is an excellent way of finding ideas for IB maths explorations and extended essays. This problem is taken from the book: The first 25 years of the Superbrain challenges. I’m going to see how many different ways I can solve it.

The problem is to find all the integer solutions to the equation above. Finding only integer solutions is a fundamental part of number theory – a branch of mathematics that only deals with integers.

**Method number 1: Brute force**

This is a problem that computers can make short work of. Above I wrote a very simple Python program which checked all values of x and y between -99 and 99. This returned the only solution pairs as:

Clearly we have not proved these are the only solutions – but even by modifying the code to check more numbers, no more pairs were found.

**Method number 2: Solving a linear equation**

We can notice that the equation is linear in terms of y, and so rearrange to make y the subject.

We can then use either polynomial long division or the method of partial fractions to rewrite this. I’ll use partial fractions. The general form for this fraction can be written as follows:

Next I multiply by the denominator and the compare coefficients of terms.

This therefore gives:

I can now see that there will only be an integer solution for y when the denominator of the fraction is a factor of 6. This then gives (ignoring non integer solutions):

I can then substitute these back to find my y values, which give me the same 4 coordinate pairs as before:

**Method number 3: Solving a quadratic equation**

I start by making a quadratic in x:

I can then use the quadratic formula to find solutions:

Which I can simplify to give:

Next I can note that x will only be an integer solution if the expression inside the square root is a square number. Therefore I have:

Next I can solve a new quadratic as follows:

As before I notice that the expression inside my square root must be a square number. Now I can see that I need to find m and n such that I have 2 square numbers with a difference of 24. I can look at the first 13 square numbers to see that from the 12th and 13th square numbers onwards there will also be a difference of more than 24. Checking this list I can find that m = 1 and m = 5 will satisfy this equation.

This then gives:

which when I solve for integer solutions and then sub back into find x gives the same four solutions:

**Method number 4: Graphical understanding**

Without rearranging I could imagine this as a 3D problem by plotting the 2 equations:

This gives the following graph:

We can see that the plane intersects the curve in infinite places. I’ve marked A, B on the graph to illustrate 2 of the coordinate pairs which we have found. This is a nice visualization but doesn’t help find our coordinates, so lets switch to 2D.

In 2D we can use our rearranged equation:

This gives the following graph:

Here I have marked on the solution pairs that we found. The oblique asymptote (red) is y = 2x-1 because as x gets large the fraction gets very small and so the graph gets closer and closer to y = 2x -1.

All points on this curve are solutions to the equation – but we can see that the only integer solution pairs will be when x is small. When x is a large integer then the curve will be close to the asymptote and hence will return a number slightly bigger than an integer.

So, using this approach we would check all possible integer solutions when x is small, and again should be able to arrive at our coordinate pairs.

So, 4 different approaches that would be able to solve this problem. Can you find any others?

**3D Printing with Desmos: Stewie Griffin**

Using Desmos or Geogebra to design a picture or pattern is quite a nice exploration topic – but here’s an idea to make your investigation stand out from the crowd – how about converting your image to a 3D printed design?

**Step 1**

Create an image on Desmos or Geogebra. Remove the axes and grid pattern. This image is a pre-drawn image already on Desmos available here.

**Step 2**

Take a screen capture image of your picture (jpeg, gif, png). We need to convert this to a SVG file. You can convert these for free at sites like picsvg.

**Step 3**

Lastly we need to use a 3D editing site . You can join up with a site like Tinkercad for free.

**Step 4**

Making our 3D model. We import our SVG file and we get the image above. We can then resize this to whatever dimensions we wish – and also add 3D depth.

Lastly I would then save this file and send it to a 3D printer. You can see the finished file below:

So, if we printed this we’d get something like this:

**3D printing the Eiffel Tower**

Let’s use another Desmos art work. The Eiffel Tower above was a finalist in their annual art competition drawn by Jerry Yang from the USA.

This is then converted to the SVG file above.

And this is the result on Tinkercad when I add some depth and change the colour scheme. Let’s see what that would look like printed:

Pretty good- we’ve created a cheap tourist souvenir in about 5 minutes!

**Mathematical art**

I thought I’d have a go at making my own mathematical art. I started with using some polar coordinates to create this nice pattern:

Which then creates the following 3D shape:

This topic has a lot of scope for exploration and links with art, design technology and engineering. Thanks to our ever resourceful ICT wizz at school Jon for assistance, and also thanks for this excellent method which was posted by Ryan on Thingiverse. You can also explore huge numbers of ready made 3D templates on the site.

**Projectile Motion Investigation II**

Another example for investigating projectile motion has been provided by fellow IB teacher Ferenc Beleznay. Here we fix the velocity and then vary the angle, then to plot the maximum points of the parabolas. He has created a Geogebra app to show this (shown above). The locus of these maximum points then form an ellipse.

We can see that the maximum points of the projectiles all go through the dotted elliptical line. So let’s see if we can derive this equation.

Let’s start with the equations for projectile motion, usually given in parametric form:

Here v is the initial velocity which we will keep constant, theta is the angle of launch which we will vary, and g is the gravitational constant which we will take as 9.81.

We can plot these curves parametrically, and for each given value of theta (the angle of launch) we will create a projectile motion graph. If we plot lots of these graphs for different thetas together we get something like this:

We now want to see if the maximum points are in any sort of pattern. In order to find the maximum point we want to find when the gradient of dy/dx is 0. It’s going to be easier to keep things in parametric form, and use partial differentiation. We have:

Therefore we find the partial differentiation of both x and y with respect to t. (This simply means we can pretend theta is a constant).

We can then say that:

We then find when this has a gradient of 0:

We can then substitute this value of t back into the original parametric equations for x:

and also for y:

We now have the parametric equations in terms of theta for the locus of points of the maximum points. For example, with g= 9.81 and v =1 we have the following parametric equations:

This generates an ellipse (dotted line), which shows the maximum points generated by the parametric equations below (as we vary theta):

And here is the graph:

We can vary the velocity to create a new ellipse. For example the ellipse generated when v =4 creates the following graph:

So, there we go, we have shown that different ellipses will be created by different velocities. If you feel like a challenge, see if you can algebraically manipulate the parametric equations for the ellipse into the Cartesian form!

**Ramanujan’s Taxi Cabs and the Sum of 2 Cubes **

The Indian mathematician Ramanujan (picture cite: Wikipedia) is renowned as one of great self-taught mathematical prodigies. His correspondence with the renowned mathematician G. H Hardy led him to being invited to study in England, though whilst there he fell sick. Visiting him in hospital, Hardy remarked that the taxi that had brought him to the hospital had a very “rather dull number” – number 1729. Ramanujan remarked in reply, ” No Hardy, it’s a very interesting number! It’s the smallest number expressible as the sum of 2 cubes in 2 different ways!”

Ramanujan was profoundly interested in number theory – the study of integers and patterns inherent within them. The general problem referenced above is finding integer solutions to the below equation for given values of A:

In the case that A = 1729, we have 2 possible ways of finding distinct integer solutions:

The smallest number which can be formed through 3 distinct (positive) integer solutions to the equation is A = 87, 539, 319.

Although this began as a number theory problem it has close links with both graphs and group theory – and it is from these fields that mathematicians have gained a deeper understanding as to the nature of its solutions. The modern field of elliptical curve cryptography is closely related to the ideas below and provides a very secure method of encrypting data.

We start by sketching the graph of:

For some given integer value of A. We will notice that the graph has a line of symmetry around y = x and also an asymptote at y = -x. If we plot:

We can see that both our integer solutions to this problem (1,12) and (9,10) lie on the curve:

**Group theory**

Groups can be considered as sets which follow a set number of rules with regards to operations like multiplication, addition etc. Establishing that a set is a group then allows certain properties to be inferred. If we can establish the following rules hold then we can create an Abelian group. If we start with a set A and and operation Θ.

1) **Identity.** For an element e in A, we have a Θ e = a for all a in A.

(for example 0 is the identity element for the addition operation for the set of integers numbers. a+0 = a for all a in the real numbers).

2) **Closure**. For all elements a,b in A, a Θ b = c, where c is also in A.

(For example with the addition operation, the addition of 2 integers numbers is still an integer)

3) **Associativity**. For all elements a,b,c in A, (a Θ b) Θ c = a Θ (b Θ c)

(For example with the addition operation, (1+2) + 3 = 1 + (2+3) )

4) **Inverse**. For each a in A there exists a b in A such that a Θ b = b Θ a = e. Where e is the identity.

(For example with the addition operation, 4+-4 = -4+4 = 0. 0 is the identity element for addition)

5) **Commutativity**. For all elements a,b in A, a Θ b = b Θ a

(For example with the addition operation 1+2 = 2+1).

As we have seen, the set of integers under the operation addition forms an abelian group.

**Establishing a group**

So, let’s see if we can establish a Abelian group based around the rational coordinates on our graph. We can demonstrate with the graph:

We then take 2 coordinate points with rational coordinates (i.e coordinates that can be written as a fraction of integers). In this case A (1,12) and B (9,10).

We then draw the line through A and B. This will intersect the graph in a 3rd point, C (except in a special case to be looked at in a minute).

We then reflect this new point C in the line y = x, giving us C’.

In this case C’ is the point (46/3, -37/3)

We therefore define *addition* (our operation Θ) in this group as:

A + B = C’.

(1,12) + (9,10) = (46/3, -37/3).

We now need to deal with the special case when a line joining 2 points on the curve does not intersect the curve again. This will happen whenever the gradient of this line is -1, which will make it parallel to the graph’s asymptote y = -x.

In this case we affix a special point at infinity to the Cartesian (x,y) plane. We define this point as the point through which all lines with gradient -1 intersect. Therefore in our expanded geometry, the line through AB *will* intersect the curve at this point at infinity. Let’s call our special point Φ. Now we have a new geometry, the (x,y) plane affixed with Φ.

We can now create an Abelian group. For any 2 rational points P(x,y), Q(x,y) we will have:

1) **Identity.** P + Φ = Φ + P = P

2) **Closure**. P + Q = R. (Where R(x,y) is also a rational point on the curve)

3) **Associativity**. (P+Q) + R = P+(Q+R)

4) **Inverse**. P + (-P) = Φ

5) **Commutativity**. P+Q = Q+P

**Understanding the identity**

Let’s see if we can understand some of these. For the identity, if we have a point A on the line and the point at infinity then this will contain the line with gradient -1. Therefore the line between the point at infinity and A will intersect the curve again at B. Our new point, B’ will be created by reflecting this point in the line y = x. This gets us back to point A. Therefore P + Φ = P as required.

**Understanding the inverse**

With the inverse of our point P(x,y) given as -P = (-x,-y) we can see that this is the reflection in the line y = x. We can see that we we join up the 2 points reflected in the line y = x we will have a line with slope -1, which will intersect with the curve at our point at infinity. Therefore P + (-P) = Φ.

Through our graphical understanding the commutativity rule also follows immediately, It doesn’t matter which of the 2 points come first when we draw a line that connects them, therefore P+Q = Q+P.

**Understanding associativity and closure**

Neither associativity nor closure are obvious from our graph. We could check individual points to show that (P+Q) + R = P+(Q+R), but it would be harder to explain why this always held. Equally whilst it’s clear that P+Q will always create a point on the curve it’s not obvious that this will be a *rational* point.

In fact we do have both associativity and closure for our group as we have the following algebraic definition for our addition operation:

The addition of 2 points is given by:

In the case of our curve:

If we take P = (1,12). P + P will be given by:

We can check this result graphically. If P and Q are the same point, then the line that passes through both P and Q has to be the tangent to the curve at that point. Therefore we would have:

Here the tangent at A does indeed meet the curve again – at point C, which does reflect in y = x to give us the coordinates above.

We could also find this intersection point algebraically. If we differentiate the original curve to find the gradient when x = 1 we can find the equation of the tangent when x=1 and then substitute this back into the equation of the curve to find the intersection point. This would give us:

We would then reverse the x and y coordinates to reflect in the line y = x. This also gives us the same coordinates.

More generally if we have the 2 rational coordinates on the curve:

We have the algebraic formula for addition as:

If P = (1,12) and Q = (9,10), P + Q would give (after much tedious substitution!):

This agrees with the coordinates we found earlier using the much easier geometrical approach. As we can see from this formula, both coordinate points will always be rational – as they will be composed of combinations of our original rational coordinates. For any given curve there will be a generator set of coordinates through which we can generate all other rational coordinates on the curve through our addition operation.

So, we seem to have come a long way from our original goal – finding integer solutions to an algebraic equation. Instead we seem to have got sidetracked into studying graphs and establishing groups. However by reinterpreting this problem as one in group theory then this then opens up many new mathematical techniques to help us understand the solutions to this problem.

A fuller introduction to this topic is the very readable, “Taxicabs and the Sum of Two Cubes” by Joseph Silverman (from which the 2 general equations were taken) .

**Finding the volume of a rugby ball (prolate spheroid)**

With the rugby union World Cup currently underway I thought I’d try and work out the volume of a rugby ball using some calculus. This method works similarly for American football and Australian rules football. The approach is to consider the rugby ball as an ellipse rotated 360 degrees around the x axis to create a volume of revolution. We can find the equation of an ellipse centered at (0,0) by simply looking at the x and y intercepts. An ellipse with y-intercept (0,b) and x intercept (a,0) will have equation:

Therefore for our rugby ball with a horizontal “radius” (vertex) of 14.2cm and a vertical “radius” (co-vertex) of 8.67cm will have equation:

We can see that when we plot this ellipse we get an equation which very closely resembles our rugby ball shape:

Therefore we can now find the volume of revolution by using the following formula:

But we can simplify matters by starting the rotation at x = 0 to find half the volume, before doubling our answer. Therefore:

Rearranging our equation of the ellipse formula we get:

Therefore we have the following integration:

Therefore our rugby ball has a volume of around 4.5 litres. We can compare this with the volume of a football (soccer ball) – which has a radius of around 10.5cm, therefore a volume of around 4800 cubic centimeters.

We can find the general volume of any rugby ball (mathematically defined as a prolate spheroid) by the following generalization:

We can see that this is very closely related to the formula for the volume of a sphere, which makes sense as the prolate spheroid behaves like a sphere deformed across its axes. Our prolate spheroid has “radii” b, b and a – therefore r cubed in the sphere formula becomes b squared a.

**Prolate spheroids in nature**

The image above [wiki image NASA] is of the Crab Nebula – a distant Supernova remnant around 6500 light years away. The shape of Crab Nebula is described as a prolate spheroid.

**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): (x_{3}-x_{2})(y_{1}-y_{3})

And the area of triangles will be:

(1): 0.5(x_{3}-x_{2})(y_{2}-y_{3})

(2): 0.5(x_{1}-x_{2})(y_{1}-y_{2})

(3): 0.5(x_{3}-x_{1})(y_{1}-y_{3})

Therefore the area of triangle (4) will be:

Area = (x_{3}-x_{2})(y_{1}-y_{3}) – 0.5(x_{3}-x_{2})(y_{2}-y_{3}) – 0.5(x_{1}-x_{2})(y_{1}-y_{2}) – 0.5(x_{3}-x_{1})(y_{1}-y_{3})

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

x_{1 } = 2 x_{2 } = 1 x_{3 } = 3

y_{1 } = 3 y_{2 } = 2 y_{3 } = 1

Area = (x_{3}-x_{2})(y_{1}-y_{3}) – 0.5(x_{3}-x_{2})(y_{2}-y_{3}) – 0.5(x_{1}-x_{2})(y_{1}-y_{2}) – 0.5(x_{3}-x_{1})(y_{1}-y_{3})

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 (x_{1}, y_{1}) as (1,1) and then (x_{2}, y_{2}) 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.

**The Van Eck Sequence**

This is a nice sequence as discussed in the Numberphile video above. There are only 2 rules:

- If you have not seen the number in the sequence before, add a 0 to the sequence.
- If you have seen the number in the sequence before, count how long since you last saw it.

You start with a 0.

0

You have never seen a 0 before, so the next number is 0.

00

You have seen a 0 before, and it was 1 step ago, so the next number is 1.

001

You have never seen a 1 before, so the next number is 0.

0010

You have seen a 0 before, it was 2 steps ago, so the next number is 2.

00102.

etc.

I can run a quick Python program (adapted from the entry in the Online Encyclopedia of Integer Sequences here) to find the first 100 terms.

```
```A181391 = [0, 0]

for n in range(1, 10**2):

for m in range(n-1, -1, -1):

if A181391[m] == A181391[n]:

A181391.append(n-m)

break

else:

A181391.append(0)

print(A181391)

This returns:

[0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5, 3, 0, 3, 2, 9, 0, 4, 9, 3, 6, 14, 0, 6, 3, 5, 15, 0, 5, 3, 5, 2, 17, 0, 6, 11, 0, 3, 8, 0, 3, 3, 1, 42, 0, 5, 15, 20, 0, 4, 32, 0, 3, 11, 18, 0, 4, 7, 0, 3, 7, 3, 2, 31, 0, 6, 31, 3, 6, 3, 2, 8, 33, 0, 9, 56, 0, 3, 8, 7, 19, 0, 5, 37, 0, 3, 8, 8, 1, 46, 0, 6, 23]

I then assigned each term an x coordinate value, i.e.:

0 , 0

1 , 0

2 , 1

3 , 0

4 , 2

5 , 0

6 , 2

7 , 2

8 , 1

9 , 6

10 , 0

11 , 5

12 , 0

13 , 2

14 , 6

15 , 5

16 , 4

17 , 0

18 , 5

19 , 3

20 , 0

etc.

This means that you can then plot the sequence as a line graph, with the y values corresponding to the sequence terms. As you can see, every time we hit a new peak the following value is 0, leading to the peaks and troughs seen below:

Let’s extend the sequence to the first 1000 terms:

We can see that the line y = x provides a reasonably good upper bound for this data:

But it is not known if every number would actually appear in the sequence somewhere – so this bound may not hold for larger values.

**Length of steps before new numbers appear.**

We can also investigate how long we have to wait to see each number for the first time by running the following Python code:

```
```A181391 = [0, 0]

for n in range(1, 10**3):

for m in range(n-1, -1, -1):

if A181391[m] == A181391[n]:

A181391.append(n-m)

break

else:

A181391.append(0)

for m in range(1,50):

if A181391[n]==m:

print(m, ",", n+1)

break

This returns the following data:

1 , 3

2 , 5

6 , 10

5 , 12

4 , 17

3 , 20

9 , 24

14 , 30

15 , 35

17 , 41

11 , 44

8 , 47

42 , 52

20 , 56

32 , 59

18 , 63

7 , 66

31 , 72

33 , 81

19 , 89

etc.

The first coordinate tells us the number we are interested in, and the second number tells us how long we have to wait in the sequence until it appears. So (1 , 3) means that we have to wait until 3 terms in the sequence to see the number 1 for the first time.

Plotting this for numbers 1-50 on a graph returns the following:

So, we can see (for example that we wait 66 terms to first see a 7, and 173 terms to first see a 12. There seems to be a general trend that as the numbers get larger we have to wait longer to see them. Testing this with a linear regression we can see a weak to moderate correlation:

Checking for the numbers up to 300 we get the following:

For example this shows that we have to wait 9700 terms until we see the number 254 for the first time. Testing this with a linear correlation we have a weaker positive correlation than previously.

So, a nice and quick investigation using a combination of sequences, coding, graphing and regression, with lots of areas this could be developed further.