IB Maths and GCSE Maths Resources from British International School Phuket. Theory of Knowledge (ToK). Maths explorations and investigations.  Real life maths. Maths careers. Maths videos. Maths puzzles and Maths lesson resources.

Screen Shot 2015-01-25 at 8.08.14 PM

British International School Phuket

Welcome to the British International School Phuket’s maths website. My name is Andrew Chambers and I am currently working at BISP.  I am running my site as the school’s maths resources website for both our students and students around the world.

We are a British international school located on the tropical island of Phuket in Southern Thailand. We offer a number of scholarships each year, catering for a number of national and international standard sports stars as well as for academic excellence. You can find out more about our school here.

There are a huge amount of resources to explore – especially for students doing their IAs and for students looking for revision videos.  You may also like to try our school code breaking site – where you can compete with over 10,000 students from around the world who have made it onto our school leaderboard.

 

Screen Shot 2018-03-19 at 4.35.19 PM

IB Revision with Revision Village

There’s a really great website been put together to help IB students with topic revision both for during the course and for the end of Year 12 school exams and Year 13 final exams.  I would strongly recommend students use this as a resource during the course (not just for final revision in Y13!) There are specific resources for HL, SL and Studies students.

You choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021) and get the following screen:

Screen Shot 2018-03-19 at 4.40.40 PM.png

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions like:

Screen Shot 2018-03-19 at 4.42.05 PM.png

What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial.  Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions.  This also has some harder exams for those students aiming for 6s and 7s.

Screen Shot 2018-03-19 at 4.46.36 PM

The Past IB Exams section takes you to full worked solutions to each full paper.

and lastly you can also get a prediction exam for the upcoming year.

For HL students (exam in 2020) you can click here

For SL students (exam in 2020) you can click here

For Studies students (exam in 2020) you can click here

For Analysis students and Applications students (exam in 2021) you can click here

You can also download the Mathematics Studies SL Formula booklet and the Standard Level Formula booklet from here if your teachers haven’t given you a copy.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

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.

Soap Bubbles and Catenoids

Soap bubbles form such that they create a shape with the minimum surface area for the given constraints.  For a fixed volume the minimum surface area is a sphere, which is why soap bubbles will form spheres where possible.  We can also investigate what happens when a soap film is formed between 2 parallel circular lines like in the picture below: [Credit Wikimedia Commons, Blinking spirit]


In this case the shape formed is a catenoid – which provides the minimum surface area (for a fixed volume) for a 3D shape connecting the two circles.  The catenoid can be defined in terms of parametric equations:

Where cosh() is the hyperbolic cosine function which can be defined as:

For our parametric equation, t and u are parameters which we vary, and c is a constant that we can change to create different catenoids.  We can use Geogebra to plot different catenoids.  Below is the code which will plot parametric curves when c =2 and t varies between -20pi and 20 pi.

 

We then need to create a slider for u, and turn on the trace button – and for every given value of u (between 0 and 2 pi) it will plot a curve.  When we trace through all the values of u it will create a 3D shape – our catenoid.

Individual curve (catenary)


Catenoid when c = 0.1

Catenoid when c = 0.5

Catenoid when c = 1

Catenoid when c = 2

Wormholes

For those of you who know your science fiction, the catenoids above may look similar to a wormhole.  That’s because the catenoid is a solution to the hypothesized mathematics of wormholes.  These can be thought of as a “bridge” either through curved space-time to another part of the universe (potentially therefore allowing for faster than light travel) or a bridge connecting 2 distinct universes.

Screen Shot 2019-09-29 at 7.03.34 PM

Above is the Morris-Thorne bridge wormhole [Credit The Image of a Wormhole].

Further exploration:

This is a topic with lots of interesting areas to explore – the individual curves (catenary) look similar to, but are distinct from parabola.  These curves appear in bridge building and in many other objects with free hanging cables.  Proving that catenoids form shapes with minimum surface areas requires some quite complicated undergraduate maths (variational calculus), but it would be interesting to explore some other features of catenoids or indeed to explore why the sphere is a minimum surface area for a given volume.

If you want to explore further you can generate your own Catenoids with the Geogebra animation I’ve made here.

For students taking their exams in 2021 there is a big change to the IB syllabus – there will now be 4 possible strands: IB HL Analysis and Approaches, IB SL Analysis and Approaches, IB HL Applications and Interpretations, IB SL Applications and Interpretations.

IB Applications and Interpretations

Screen Shot 2019-07-27 at 8.57.12 PM

There is a reasonable cross-over between the current Studies course and the new Applications SL course.  However there is quite a lot of new content – and as such the expectation is that this course could be quite a bit more challenging that the current SL course.   The HL Applications course is a rather odd mix of former Maths Studies topics, former SL topics and former IB HL Statistics topics.

Some key points:

  1. The SL Applications course will be a complete sub-set of the HL Applications course, and the HL exam will include some of the same questions as the SL exam.
  2. Both SL and HL will only have calculator papers (and have no non-calculator papers like Analysis)
  3. Both SL and HL will have Paper 1 consisting of short questions and Paper 2 with longer style questions (similar to the current Maths Studies course).
  4. HL students will do an investigation style Paper 3 – potentially with the use of technology.  This will lead students through an investigation on any topic on the syllabus.
  5. The Exploration coursework will remain – however the guidance is now that it should be 12-20 pages (rather than 6-12 previously).

What does this all mean for Applications SL?

If the IB follow through with their stated plan to have both new SL courses (Applications and Analysis) the same difficulty then either:

(a) The Analysis course will remain at the same level of difficulty as the current Maths SL and therefore many students who up until now have taken Maths Studies will find the new Applications course extremely challenging.

(b) The Analysis course will be made easier than the current Maths SL course, so that the new Applications course is also a little more accessible – though still harder than the current Maths Studies course.

I would predict that (b) is the more likely of these two – otherwise there will be a significant cohort of IB students (around 30%) who fail to get even a Level 4 in their maths.  At the moment I would advise that all weaker students should definitely take this course (IGCSE Grade C and below), but it may be the case that it is a good option for more stronger students who have traditionally taken SL rather than Studies.

What does this all mean for Applications HL?

This is really hard to work out – if Applications SL remains accessible for students with low IGCSE grades, and Applications HL contains a subset of these questions, then that would suggest that the Applications HL would be significantly easier than the current HL course.  However, there are a number of challenging topics on the Applications HL syllabus which could well be used to stretch top students.  Again the stated aim of the IB is for the two HL courses to be the same difficulty – so this is one we will really have to wait and see with.

Based on the current information I would advice only students with an A* in IGCSE to take this course. It would appear to be aimed at students who need some mathematical skills for their university courses (such as biology, medicine or business) but who do not want to study mathematics or a field with substantial mathematics in it (such as engineering, physics, computer science etc).

Resources for teachers and students

This will be a work in progress – but to get started we have:

General resources

  1. A very useful condensed pdf of the Applications and Interpretations formula book for both SL and HL.
  2. An excellent overview of the changes to the new syllabus – including more detailed information as to the syllabus changes, differences between the two courses and also what 10 of the leading universities have said with regards to course preferences.
  3. University acceptance.  Information collated by a group of IB teachers on university requirements as to which course they will require for different subjects (this may be not be up to date, so please check).

Investigation resources for Paper 3 [Higher Level]

  1. Old IA investigations

Standard Level

[Links removed – hopefully the IB will provide these resources elsewhere]

(a) All SL IA investigations from 1998 to 2009 : This is an excellent collection to start preparations for the new Paper 3.

(b) Specimen investigations: These are 8 specimen examples of IA investigations from 2006 with student answers and annotations.

(c) SL IA investigations 2011-2012: Some more investigations with teacher guidance.

(d) SL IA investigations 2012-2013: Some more investigations with teacher guidance.

(e) Koch snowflakes: This is a nice investigation into fractals.

Higher Level 

(a) All HL IA investigations from 1998 to 2009:  Lots more excellent investigations – with some more difficult mathematics.

(b) HL IA investigations 2011-2012: Some more investigations with teacher guidance.

(c) HL IA investigations 2012-2013: Some more investigations with teacher guidance.

For students taking their exams in 2021 there is a big change to the IB syllabus – there will now be 4 possible strands: IB HL Analysis and Approaches, IB SL Analysis and Approaches, IB HL Applications and Interpretations, IB SL Applications and Interpretations.

IB Analysis and Approaches

Screen Shot 2019-07-27 at 3.15.16 PM

There is a significant cross-over between the current SL and HL courses and the new Analysis courses.  The main differences are:

  1. The SL course will now be a complete sub-set of the HL course, and the HL exam will now include some of the same questions as the SL exam.  Previously whilst SL was almost a complete sub-set of the HL course, the questions on the HL paper were never the same as SL (and usually all significantly harder).
  2. There are a few small additions to the HL Analysis syllabus compared to the old HL syllabus – such as binomials with fractional indices, partial fractions and regression.   SL will be largely the same except that the unit on vectors has been taken out.
  3. The HL option unit has gone – and some of the old HL Calculus option has been added to the core syllabus (though only a relatively small proportion of it).
  4. HL students will instead do an investigation style Paper 3 – potentially with the use of technology.  This will lead students through an investigation on any topic on the syllabus.
  5. The Exploration coursework will remain – however the guidance is now that it should be 12-20 pages (rather than 6-12 previously).

What does this all mean?

Until we start to see some past papers it’s difficult to be too confident on this – but based on the syllabus and specimen paper I would say that the two new courses remain pitched at the same level as for the old SL and HL courses.  Therefore the Analysis and Approaches HL course is only suitable for the very best mathematicians who are looking to study either mathematics or a field with substantial mathematics in it (such as engineering, physics, computer science etc).  These students would usually have an A* at IGCSE and have also studied Additional Mathematics prior to starting the course.  The Analysis and Approaches SL course looks like it will still be a good quality mathematics course – and so will be aimed at students who need some mathematical skills for their university courses (such as biology, medicine or business).  These students would usually have an A* – B at IGCSE.

Resources for teachers and students

This will be a work in progress – but to get started we have:

General resources:

1) A very useful condensed pdf of the Analysis and Approaches formula book for both SL and HL.

2) An excellent overview of the changes to the new syllabus – including more detailed information as to the syllabus changes, differences between the two courses and also what 10 of the leading universities have said with regards to course preferences.

3) University acceptance.  Information collated by a group of IB teachers on university requirements as to which course they will require for different subjects (this may be not be up to date, so please check).

Specific resources for the new HL and SL syllabus content:

1. Linear correlation (previously only SL, now SL and HL)

Screen Shot 2019-07-30 at 1.49.53 PM.png

a) A worksheet (docx file) on using a GDC to calculate regression lines and r values.

2. Equation of regression line of x on y. (SL and HL)

Screen Shot 2019-07-30 at 1.51.27 PM.png

3. Sampling (SL and HL)

Screen Shot 2019-07-30 at 1.52.55 PM.png

4. Simple deductive proof (SL and HL)

Screen Shot 2019-07-30 at 12.54.15 PM.png

a) A deductive proof worksheet (docx file) with some simple examples of deductive proof.

5. Partial fractions. (HL)

Screen Shot 2019-07-30 at 1.59.06 PM.png

a) A Partial Fractions worksheet (docx file) with notes and some partial fraction questions.

6. Binomial expansion with fractional and negative indices (HL)

Screen Shot 2019-07-30 at 12.02.37 PM.png

a) A binomial expansion worksheet (docx file) requiring the use of fractional and negative indices, as well as use of the Maclaurin expansion.

7. More rational functions (HL)

Screen Shot 2019-07-30 at 1.44.11 PM.png

8. Graphing [f(x)]2 (HL)

Screen Shot 2019-07-30 at 1.46.14 PM

9. L’Hopital’s rule (Previously on the Calculus option now on HL)

Screen Shot 2019-07-30 at 1.25.13 PM

a) A Limits of functions worksheet (docx file) with some examples of simple limits and uses of L’Hopital’s rule. Markscheme here.

10. Euler method for differential equations (Previously on the Calculus option now on HL)

Screen Shot 2019-07-30 at 1.34.18 PM.png

a) A worksheet (docx file) with some questions using Euler’s method to solve differential equations.

11. Separating variables to solve differential equations (Previously on the Calculus option now on HL)

Screen Shot 2019-07-30 at 1.34.47 PM

a) A worksheet (docx file) with some questions separating variables to solve differential equations. Markscheme here.

12.  Solving differential equations by substitution (Previously on the Calculus option now on HL)

Screen Shot 2019-07-30 at 1.35.54 PM.png

a) A worksheet (docx file) with some questions using substitution to solve homogenous differential equations. Markscheme here.

13. Solving differential equations by the integrating factor method (Previously on the Calculus option now on HL)

Screen Shot 2019-07-30 at 1.37.10 PM.png

a) A worksheet (docx file) with some questions using the integrating factor to solve  differential equations. Markscheme  here.

14. Maclaurin series (Previously on the Calculus option now on HL)

Screen Shot 2019-07-30 at 1.39.41 PM.png

a) A worksheet (docx file) with some questions using the Maclaurin series. Markscheme here.

Investigation resources for Paper 3 [Higher Level]

  1. Old IA investigations

Standard Level

[Links removed – hopefully the IB will provide these resources elsewhere]

(a) All SL IA investigations from 1998 to 2009 : This is an excellent collection to start preparations for the new Paper 3.

(b) Specimen investigations: These are 8 specimen examples of IA investigations from 2006 with student answers and annotations.

(c) SL IA investigations 2011-2012: Some more investigations with teacher guidance.

(d) SL IA investigations 2012-2013: Some more investigations with teacher guidance.

(e) Koch snowflakes: This is a nice investigation into fractals.

Higher Level 

(a) All HL IA investigations from 1998 to 2009:  Lots more excellent investigations – with some more difficult mathematics.

(b) HL IA investigations 2011-2012: Some more investigations with teacher guidance.

(c) HL IA investigations 2012-2013: Some more investigations with teacher guidance.

Simulating a Football Season

This is a nice example of how statistics are used in modeling – similar techniques are used when gambling companies are creating odds or when computer game designers are making football manager games.  We start with some statistics.  The soccer stats site has the data we need from the 2018-19 season, and we will use this to predict the outcome of the 2019-20 season (assuming teams stay at a similar level, and that no-one was relegated in 2018-19).

Attack and defense strength

For each team we need to calculate:

  1. Home attack strength
  2. Away attack strength
  3. Home defense strength
  4. Away defense strength.

For example for Liverpool (LFC)

LFC Home attack strength = (LFC home goals in 2018-19 season)/(average home goals in 2018-19 season)

LFC Away attack strength = (LFC away goals in 2018-19 season)/(average away goals in 2018-19 season)

LFC Home defense strength = (LFC home goals conceded in 2018-19 season)/(average home goals conceded in 2018-19 season)

LFC Away defense strength = (LFC away goals conceded in 2018-19 season)/(average away goals conceded in 2018-19 season)

Calculating lamda

We can then use a Poisson model to work out some probabilities.  First though we need to find our lamda value.  To make life easier we can also use the fact that the lamda value for a Poisson gives the mean value – and use this to give an approximate answer.

So, for example if Liverpool are playing at home to Arsenal we work out Liverpool’s lamda value as:

LFC home lamda = league average home goals per game x LFC home attack strength x Arsenal away defense strength.

We would work out Arsenal’s away lamda as:

Arsenal away lamda = league average away goals per game x Arsenal away attack strength x Liverpool home defense strength.

Putting in some values gives a home lamda for Liverpool as 3.38 and an away lamda for Arsenal as 0.69.  So we would expect Liverpool to win 3-1 (rounding to the nearest integer).

Using Excel

I then used an Excel spreadsheet to work out the home goals in each fixture in the league season (green column represents the home teams)

and then used the same method to work out the away goals in each fixture in the league (yellow column represents the away team)

I could then round these numbers to the nearest integer and fill in the scores for each match in the table:

Then I was able to work out the point totals to produce a predicted table:

Here we had both Liverpool and Manchester City on 104 points, but with Manchester City having a better goal difference, so winning the league again.

Using a Poisson model.

The poisson model allows us to calculate probabilities.  The mode is:

P(k goals) = (eλk)/k!

λ is the symbol lamda which we calculated before.

So, for example with Liverpool at home to Arsenal we calculate

Liverpool’s home lamda = league average home goals per game x LFC home attack strength x Arsenal away defense strength.

Liverpool’s home lamda = 1.57 x 1.84 x 1.17 = 3.38

Therefore

P(Liverpool score 0 goals) = (e-3.383.380)/0! = 0.034

P(Liverpool score 1 goal) = (e-3.383.381)/1! = 0.12

P(Liverpool score 2 goals) = (e-3.383.382)/2! = 0.19

P(Liverpool score 3 goals) = (e-3.383.383)/3! = 0.22

P(Liverpool score 4 goals) = (e-3.383.381)/1! = 0.19

P(Liverpool score 5 goals) = (e-3.383.385)/5! = 0.13 etc.

Arsenal’s away lamda = 1.25 x 1.30 x 0.42 = 0.68

P(Arsenal score 0 goals) = (e-0.680.680)/0! = 0.51

P(Arsenal score 1 goal) = (e-0.680.681)/1! = 0.34

P(Arsenal score 2 goals) = (e-0.680.682)/2! = 0.12

P(Arsenal score 3 goals) = (e-0.680.683)/3! = 0.03 etc.

Probability that Arsenal win

Arsenal can win if:

Liverpool score 0 goals and Arsenal score 1 or more

Liverpool score 1 goal and Arsenal score 2 or more

Liverpool score 2 goals and Arsenal score 3 or more etc.

i.e the approximate probability of Arsenal winning is:

0.034 x 0.49 + 0.12 x 0.15 + 0.19 x 0.03 = 0.04.

Using the same method we could work out the probability of a draw and a Liverpool win.  This is the sort of method that bookmakers will use to calculate the probabilities that ensure they make a profit when offering odds.

IB Revision

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

Screen Shot 2018-03-19 at 4.42.05 PM.pngThe Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial.  Really useful!

Screen Shot 2019-07-27 at 10.02.40 AM

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions.  This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

 

The Van Eck Sequence

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

  1. If you have not seen the number in the sequence before, add a 0 to the sequence.
  2. 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.

 

Screen Shot 2019-05-27 at 9.06.57 AM

Computers can brute force a lot of simple mathematical problems, so I thought I’d try and write some code to solve some of them.  In nearly all these cases there’s probably a more elegant way of coding the problem – but these all do the job!  You can run all of these with a Python editor such as Repl.it.  Just copy and paste the below code and see what happens.

1) Happy Numbers.

Happy numbers are defined by the rule that you start with any positive integer, square each of the digits then add them together. Now do the same with the new number. Happy numbers will eventually spiral down to a number of 1. Numbers that don’t eventually reach 1 are called unhappy numbers.

As an example, say we start with the number 23. Next we do 2²+3² = 13. Now, 1²+3² = 10. Now 1²+0² = 1. 23 is therefore a happy number.


k= int(input("type a 2 digit number "))
a = int(k%10)
c = int(k//100)
b = int(k//10 -10*c)
print (a**2+b**2+c**2)

for k in range (1,20):

  k = a**2+b**2 + c**2
  a = int(k%10)
  c = int(k//100)
  b = int(k//10 -10*c)
  print (a**2+b**2+c**2)

2) Sum of 3 cubes

Most (though not all) numbers can be written as the sum of 3 cubes. For example:
13 + 23 + 23 = 17. Therefore 17 can be written as the sum of 3 cubes.

This program allows you to see all the combinations possible when using the integers -10 to 10 and trying to make all the numbers up to 29.


for k in range(1,30):

  for a in range(-10, 10):
    for b in range(-10,10):
      for c in range (-10, 10):
        if a**3+b**3+c**3 == k :
          print(k,a,b,c)

3) Narcissistic Numbers

A 3 digit narcissistic number is defined as one which the sum of the cubes of its digits equal the original number. This program allows you to see all 3 digit narcissistic numbers.

for a in range (0,10):
 for b in range(0, 10):
  for c in range(0,10):
   if a**3 + b**3 + c**3 ==100*a + 10*b + c:
    print(int(100*a + 10*b + c))

4) Pythagorean triples

Pythagorean triples are integer solutions to Pythagoras’ Theorem. For example:
32 + 42 = 52 is an integer solution to Pythagoras’ Theorem.
This code allows you to find all integer solutions to Pythagoras’ Theorem for the numbers in the range you specify.

k = 100

for a in range(1, k):
 for b in range(1,k):
  for c in range (1, 2*k):
   if a**2+b**2==c**2:
    print(a,b,c)

5) Perfect Numbers

Perfect numbers are numbers whose proper factors (factors excluding the number itself) add to the number. This is easier to see with an example.

6 is a perfect number because its proper factors are 1,2,3 and 1+2+3 = 6

8 is not a perfect number because its proper factors are 1,2,4 and 1+2+4 = 7

Perfect numbers have been known about for about 2000 years – however they are exceptionally rare. The first 4 perfect numbers are 6, 28, 496, 8128. These were all known to the Greeks. The next perfect number wasn’t discovered until around 1500 years later – and not surprisingly as it’s 33,550,336.

The code below will find all the perfect numbers less than 10,000.

for n in range(1,10000):
 list = []

 for i in range (1,n):

  if n%i ==0:
   list.append(i)
 if sum(list)==n:
  print(n)

Friendly Numbers

Friendly numbers are numbers which share a relationship with other numbers. They require the use of σ(a) which is called the divisor function and means the addition of all the factors of a. For example σ(7) = 1 + 7 = 8 and σ(10) = 1 +2 +5 + 10 = 18.

Friendly numbers therefore satisfy:

σ(a)/a = σ(b)/b

As an example:

σ(6) / 6 = (1+2+3+6) / 6 = 2,

σ(28) / 28 = (1+2+4+7+14+28) / 28 = 2

σ(496)/496 = (1+2+4+8+16+31+62+124+248+496)/496 = 2

Therefore 28 and 6 are friendly numbers because they share a common relationship.

This code will help find some Friendly numbers (though these are very difficult to find, as we need to check against every other integer until we find a relationship).

The code below will find some Friendly numbers less than 200, and their friendly pair less than 5000:


for n in range(1,5000):
 list = []

 for i in range (1,n+1):
  if n%i ==0:
   list.append(i)
 Result1 = sum(list)
 for m in range(1,200):
  list2 = []
  for j in range (1,m+1):
   if m%j ==0:
    list2.append(j)
  Result2 = sum(list2)

  if Result2/m ==Result1/n:
   if n != m:
    print(n,m)

Hailstone numbers

Hailstone numbers are created by the following rules:

if n is even: divide by 2

if n is odd: times by 3 and add 1

We can then generate a sequence from any starting number. For example, starting with 10:

10, 5, 16, 8, 4, 2, 1, 4, 2, 1…

we can see that this sequence loops into an infinitely repeating 4,2,1 sequence. Trying another number, say 58:

58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1…

and we see the same loop of 4,2,1.

The question is, does every number end in this loop? Well, we don’t know. Every number mathematicians have checked do indeed lead to this loop, but that is not a proof. Perhaps there is a counter-example, we just haven’t found it yet.

Run the code below, and by changing the value of n you can see how quickly the number enters the 4,2,1 loop.


n = 300
for k in range(1,40):

 if n%2 ==0:
  print(n/2)
  n =n/2
 elif n%2 !=0:
  print(3*n+1)
  n =3*n+1

Generating the Golden ratio

The Golden ratio can be approximated by dividing any 2 successive terms of the Fibonacci sequence. As we divide ever larger successive terms we get a better approximation for the Golden ratio. This code returns successive terms of the Fibonacci sequence and the corresponding approximation for the Golden ratio.


a = 0
b = 1
print(a)
print(b)
for k in range(1,30):

 a = a+b
 b = a+b

 print(a,b, b/a)

Partial sums

We can use programs to see if sums to infinity converge. For example with the sequence 1/n, if I add the terms together I get: 1/1 + 1/2 + 1/3 + 1/4…In this case the series (surprisingly) diverges. The code below shows that the sum of the sequence 1/n2 converges to a number (pi2/6).

list = []
for n in range(1,100):
 n = 1/(n**2)
 list.append(n)
 print(sum(list))

Returning to 6174

This is a nice number trick. You take any 4 digit number, then rearrange the digits so that you make the largest number possible and also the smallest number possible. You then take away the smallest number from the largest number, and then start again. For example with the number 6785, the largest number we can make is 8765 and the smallest is 5678. So we do 8765 – 5678 = 3087. We then carry on with the same method. Eventually we will arrive at the number 6174!


k= int(input("type a 4 digit number "))
a = int(k%10)
d = int(k//1000)
c = int(k//100 - 10*d)
b = int(k//10 -10*c-100*d)

for n in range(1,10):

 list = []
 list = [a,b,c,d]
 list.sort()

 a = list[0]
 d = list[3]
 c = list[2]
 b = list[1]
 print(1000*d+100*c+10*b+a -1000*a-100*b-10*c-d)
 k = int(1000*d+100*c+10*b+a -1000*a-100*b-10*c-d)
 a = int(k%10)
 d = int(k//1000)
 c = int(k//100 - 10*d)
 b = int(k//10 -10*c-100*d)
 list = []
 list = [a,b,c,d]
 list.sort()

 a = list[0]
 d = list[3]
 c = list[2]
 b = list[1]

 print(1000*d+100*c+10*b+a -1000*a-100*b-10*c-d)

Maximising the volume of a cuboid

If we take a cuboid of length n, and cut squares of size x from the corner, what value of x will give the maximum volume? This code will look at initial squares of size 10×10 up to 90×90 and find the value of x for each which give the maximum volume.


def compute():

 list1=[]
 k=6
 z = int(0.5*a*10**k)

 for x in range(1,z):
  list1.append((10*a-2*x/10**(k-1))*(10*a-2*x/10**(k-1))*(x/10**(k-1)))
 print("length of original side is, ", 10*a)
 y= max(list1)
 print("maximum volume is, ", max(list1))

 q = list1.index(y)
 print("length of square removed from corner is, ", (q+1)/10**(k-1))

for a in range(1,10):
 print(compute())

Stacking cannonballs – solving maths with code

Numberphile have recently done a video looking at the maths behind stacking cannonballs – so in this post I’ll look at the code needed to solve this problem.

Triangular based pyramid.

Screen Shot 2019-05-19 at 3.36.23 PM

A triangular based pyramid would have:

1 ball on the top layer

1 + 3 balls on the second layer

1 + 3 + 6 balls on the third layer

1 + 3 + 6 + 10 balls on the fourth layer.

Therefore a triangular based pyramid is based on the sum of the first n triangular numbers.

The formula for the triangular numbers is:

Screen Shot 2019-05-19 at 3.40.12 PM

and the formula for the sum of the first n triangular numbers is:

Screen Shot 2019-05-19 at 3.40.16 PM

Screen Shot 2019-05-19 at 3.54.28 PM

We can simplify this by using the identity for the sum of the first n square numbers and also the identity for the sum of the first n natural numbers:

Screen Shot 2019-05-19 at 3.54.39 PM

Screen Shot 2019-05-19 at 3.54.35 PM

Therefore:

Screen Shot 2019-05-19 at 3.54.44 PM

and the question we want to find out is whether there is triangular based pyramid with a certain number of cannonballs which can be rearranged into a triangular number i.e.:

Screen Shot 2019-05-19 at 3.54.49 PM

here n and m can be any natural number. For example if we choose n = 3 and m = 4 we see that we have the following:

Screen Shot 2019-05-19 at 3.54.52 PM

Therefore we can have a triangular pyramid of height 3, which has 10 cannonballs. There 10 cannonballs can then be rearranged into a triangular number.

Square based pyramids and above.

Screen Shot 2019-05-19 at 3.36.06 PM

For a square based pyramid we would have:

1 ball on the top layer

1 + 4 balls on the second layer

1 + 4 + 9 balls on the third layer

1 + 4 + 9 + 16 balls on the fourth layer.

This is the sum of the first n square numbers.  So the formula for the square numbers is:

Screen Shot 2019-05-19 at 4.07.43 PM

and the sum of the first n square numbers is:

Screen Shot 2019-05-19 at 4.07.45 PM

For a pentagonal based pyramid we have:

1 ball on the top layer

1 + 5 balls on the second layer

1 + 5 + 12 balls on the third layer

1 + 5 + 12 + 22 balls on the fourth layer.

This is the sum of the first n pentagonal numbers. So the formula for the pentagonal numbers is:

Screen Shot 2019-05-19 at 4.07.48 PM

and the formula for the first n pentagonal numbers is:

Screen Shot 2019-05-19 at 4.07.51 PM

For a hexagonal based pyramid we have:

The formula for the first n hexagonal numbers:

Screen Shot 2019-05-19 at 4.07.55 PM

and the formula for the sum of the first n hexagonal numbers:

Screen Shot 2019-05-19 at 4.07.58 PM

For a k-agon based pyramid we have

Screen Shot 2019-05-19 at 4.08.01 PM

and the formula for the sum of the first n k-agon numbers:

Screen Shot 2019-05-19 at 4.20.16 PM

Screen Shot 2019-05-19 at 4.20.22 PM

Screen Shot 2019-05-19 at 4.20.25 PM

Therefore the general case is to ask if a k-agonal pyramid can be rearranged into a k-agon number i.e:

Screen Shot 2019-05-19 at 4.20.29 PM

Computers to the rescue

We can then use some coding to brute force some solutions by running through large numbers of integers and seeing if any values give a solution.  Here is the Python code.  Type it (taking care with the spacing) into a Python editor and you can run it yourself.

Screen Shot 2019-05-19 at 4.28.45 PM

You can then change the k range to check larger k-agons and also change the range for a and b.  Running this we can find the following.  (The first number is the value of k, the second the height of a k-agonal pyramid, the third number the k-agon number and the last number the number of cannonballs used).

Solutions:

3 , 3 , 4 , 10
3 , 8 , 15 , 120
3 , 20 , 55 , 1540
3 , 34 , 119 , 7140
4 , 24 , 70 , 4900
6 , 11 , 22 , 946
8 , 10 , 19 , 1045
8 , 18 , 45 , 5985
10 , 5 , 7 , 175
11 , 25 , 73 , 23725
14 , 6 , 9 , 441
14 , 46 , 181 , 195661
17 , 73 , 361 , 975061
20 , 106 , 631 , 3578401
23 , 145 , 1009 , 10680265
26 , 190 , 1513 , 27453385
29 , 241 , 2161 , 63016921
30 , 17 , 41 , 23001
32 , 298 , 2971 , 132361021
35 , 361 , 3961 , 258815701
38 , 430 , 5149 , 477132085
41 , 204 , 1683 , 55202400
41 , 505 , 6553 , 837244045
43 , 33 , 110 , 245905
44 , 586 , 8191 , 1408778281
50 , 34 , 115 , 314755
88 , 15 , 34 , 48280
145, 162, 1191, 101337426
276,  26,  77, 801801)
322, 28, 86, 1169686
823, 113, 694, 197427385
2378, 103, 604, 432684460
31265, 259, 2407,  90525801730

Screen Shot 2019-05-19 at 8.58.44 PM

For example we can see a graphical representation of this.  When k is 6, we have a hexagonal pyramid with height 11 or the 22nd hexagonal number – both of which give a solution of 946.  These are all the solutions I can find – can you find any others?  Leave a comment below if you do find any others and I’ll add them to the list!

Plotting the Mandelbrot Set

The video above gives a fantastic account of how we can use technology to generate the Mandelbrot Set – one of the most impressive mathematical structures you can imagine. The Mandelbrot Set can be thought of as an infinitely large picture – which contains fractal patterns no matter how far you enlarge it.  Below you can see a Mandelbrot zoom – which is equivalent to starting with a piece of A4 paper and enlarging it to the size of the universe!  Even at this magnification you would still see new patterns emerging.

The way the Mandelbrot set is formed in the first video is by using the following iterative process:

Zn+1 = Zn2 + c

Here Z is a complex number (of the form a + bi) and c is a constant that we choose.  We choose our initial Z value as 0.  Z1 = 0. We then choose a value of c (which is also a complex number) and see what happens when we follow the iterative process.

Let’s choose c = 2i +1. Z1 = 0

Zn+1 = Zn2 + 2i +1
Z2 = (0)2 + 2i +1
Z2 = 2i + 1

We then repeat this process:
Z3 = Z22 + 2i +1
Z3 = (2i+1)2 + 2i +1
Z3 = (2i)(2i) + 2i + 2i + 1 + 2i +1
Z3 = 6i-2 (as i.i = -1)

As we continue this process Zn spirals to infinity.

What we are looking for is whether this iterated Z value will diverge to infinity (i.e get larger and larger) or if it will remain bounded. If diverges to infinity we colour the initial point 2i+1 as blue on a complex axis. If it remains bounded we will colour it in black. In this case our initial point 2i+1 will diverge to infinity and so it will be coloured in blue.

So, let’s use Geogebra to see this is action.  The Geogrebra online program for this is here.

We choose a value for c.  Let’s say c = 0.23 + 0.42i.  Z1 = 0
Zn+1 = Zn2 + 0.23 + 0.42i.
Z2 = (0)2 + 0.23 + 0.42i.
Z2 = 0.23 + 0.42i.

Z3 = Z22 + 0.23 + 0.42i.
Z3 = (0.23 + 0.42i.)2 + 0.23 + 0.42i.
Z3 = 0.1065 + 0.6132i
Z4 = (0.1065 + 0.6132i)2 + 0.23 + 0.42i.
Z4 = -0.13467199 + 0.5506116i

We carry on with this iterative process and plot the points that we get each time.  We can see the (0.23, 0.42), (0.1065, 0.42) and (-0.13467199, 0.5506116) correspond to the first coordinates on the spiral after (0,0).  We can see that as this process continues we see a convergence to a point close to (0.05, 0.45).

Screen Shot 2019-04-25 at 3.09.17 PM

If we choose another starting value for c: c = 0.17 + 0.56i we get the following diagram:

Screen Shot 2019-04-25 at 3.09.33 PM

Again we have a stable spiral which spirals around a geometric shape and does not diverge to infinity.

If we choose another starting value for c: c = -0.25 + 0.64i we get the following diagram:

Screen Shot 2019-04-25 at 3.10.04 PM

If we choose another starting value for c: c = 0.11 + 0.59i we get the following diagram:

Screen Shot 2019-04-25 at 3.09.43 PM

However, If we choose another starting value for c: c = 0.3 + 0.68i we get the following diagram:

Screen Shot 2019-04-25 at 3.10.12 PM

This time we can see that the orbit of points does not converge, but instead it diverges to infinity.

We can then colour in each point – simply categorising whether the value of c leads to an orbit which diverges or remains bounded.  Black means it remains bounded, blue that it has escaped to infinity.  So, below we can see that when we do the iterative process with c = 0.39+ 0.63i our orbit will escape to infinity (as it is coloured blue)

Screen Shot 2019-04-25 at 3.13.45 PM

If we do this exercise in much finer detail we arrive at the following picture:

Screen Shot 2019-04-25 at 3.14.02 PM

This is the Mandelbrot Set – and will keep producing fractal patterns as you zoom in to infinity.

IB Revision

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

Screen Shot 2018-03-19 at 4.42.05 PM.pngThe Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial.  Really useful!

Screen Shot 2019-07-27 at 10.02.40 AM

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions.  This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.
 

 

What’s so special about 277777788888899?

Numberphile have just done a nice video which combines mathematics and computer programing.  The challenge is to choose any number (say 347)

Then we do 3x4x7 = 84

next we do 8×4 = 32

next we do 3×2 = 6.

And when we get to a single digit number then we have finished.  It took 3 steps to get from 347 to a single digit number, therefore 347 has a persistence of 3.  The challenge is to find a number with as big a persistence as possible.  The current world record is 277777788888899 which is the smallest number with a persistence of 11.  No numbers with a persistence of greater than 11 have ever been found.  In the video Matt writes a Python program to check this, though I tried to make my own version below.  It’s not very sophisticated, but it gets the job done (with a small glitch of returning a 0 followed by 1s when it should just return 0s!)

Screen Shot 2019-04-08 at 9.37.27 AM
The full code should be available to run here, or download here. If you run the program above in an online Python site like repl.it you can choose any number you like as see what its persistence is.

Screen Shot 2019-04-08 at 9.16.46 AM

 

If you find any number that hasn’t gone to a single digit after 11 rounds, you’ve found a new world record persistence!

To very briefly explain the code used above:

Screen Shot 2019-04-08 at 9.39.38 AM

We start by defining “result” as 1.  We then have some add any integer number on the screen (let’s use 347).  We then do 347 mod 10 (number % 10) which gives 7, and do result (which is 1) multiplied by 7.  We then do 347 divided by 10 ignoring remainders (number//10).  This gives 34.

We then start the process again. 34 mod 10 = 4.  So now we have 1 x 7 x 4.  Next we do 34 divided by 10 ignoring remainders which gives 3.  Last we do 3 mod 10 = 3. So we have 1 x 7 x 4 x 3.  If we carried on the loop we would next have 3/10 = 0 ignoring remainders, therefore our loop would stop.

The program then defines the new starting number as 7x4x3 = 84 and then starts again. So, a nice use of mathematics and computing – see what levels of persistence you can find!

Website Stats

  • 6,517,475 views

Recent Posts

Follow IB Maths Resources from British International School Phuket on WordPress.com