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.

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!

Normal Numbers – and random number generators

Numberphile have a nice new video where Matt Parker discusses all different types of numbers – including “normal numbers”.  Normal numbers are defined as irrational numbers for which the probability of choosing any given 1 digit number is the same, the probability of choosing any given 2 digit number is the same etc.  For example in the normal number 0.12345678910111213141516… , if I choose any digit in the entire number at random P(1) = P(2) = P(3) = … P(9) = 1/10.  Equally if I choose any 2 digit number at random I have P(10) = P(11) = P(12) = P(99) = 1/100.

It is incredibly hard to find normal numbers, but there is a formula to find some of them.

Screen Shot 2019-03-13 at 8.24.28 PM

In base 10, we are restricted to choosing a value of c such that 10 and c are relatively prime (i.e share no common factors apart from 1).  So if we choose c = 3 this gives:

Screen Shot 2019-03-13 at 8.24.33 PM

Screen Shot 2019-03-13 at 8.24.38 PM

We can now put this into Wolfram Alpha and see what number this gives us:

Screen Shot 2019-03-13 at 8.29.29 PM.png

So we can put the first few digits into an online calculator to find the distributions

0.000333333444444444444448148148148148148148148148148148148148148149382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049382716049827160493827160493827160479423863312 7572016460905349794238683127572016460905349794238683127572016460 9053497942386831275720164609053497942386831275720164609053497942

4: 61
1: 41
8: 40
3: 38
0: 36
2: 33
7: 33
9: 33
6: 32
5: 10

We can see that we are already seeing a reasonably similar distribution of single digits, though with 4 and 5 outliers.  As the number progressed we would expect these distributions to even up (otherwise it would not be a normal number).

One of the potential uses of normal numbers is in random number generators – if you can use a normal number and specify a digit (or number of digits) at random then this should give an equal chance of returning each number.

To finish off this,  let’s prove that the infinite series:

Screen Shot 2019-03-13 at 8.24.33 PM

does indeed converge to a number (if it diverged then it could not be used to represent a real number).  To do that we can use the ratio test (only worry about this bit if you have already studied the Calculus Option for HL!):

Screen Shot 2019-03-13 at 8.24.43 PM

Screen Shot 2019-03-13 at 8.24.46 PM

Screen Shot 2019-03-13 at 8.24.50 PM

We can see that in the last limit 3 to the power n+1 will grow faster than 3 to the power n, therefore as n increases the limit will approach 0.  Therefore by the ratio test the series converges to a real number.

Is pi normal?

Interestingly we don’t know if numbers like e, pi and ln(2) are normal or not.  We can analyse large numbers of digits of pi – and it looks like it will be normal, but as yet there is no proof.  Here are the distribution of the first 100,000 digits of pi:

1: 10137
6: 10028
3: 10026
5: 10026
7: 10025
0: 9999
8: 9978
4: 9971
2: 9908
9: 9902

Which we can see are all very close to the expected value of 10,000 (+/- around 1%).

So, next I copied the first 1 million digits of pi into a character frequency counter which gives the following:

5: 100359
3: 100230
4: 100230
9: 100106
2: 100026
8: 99985
0: 99959
7: 99800
1: 99758
6: 99548

This is even closer to the expected values of 100,000 with most with +/- 0.25 %.

Proving that pi is normal would be an important result in number theory – perhaps you could be the one to do it!

 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.

Screen Shot 2015-11-22 at 6.36.36 PM

Crack the Beale Papers and find a $65 Million buried treasure?

The story of a priceless buried treasure of gold, silver and jewels (worth around $65 million in today’s money) began in January 1822. A stranger by the name of Thomas Beale walked into the Washington Hotel Virginia with a locked iron box, which he gave to the hotel owner, Robert Morriss.  Morriss was to look after the box for Beale as he went off on his travels.

In May 1822 Morriss received a letter from Beale which stated that the  box  contained papers of huge value – but that they were encoded for protection.  Beale went on to ask that Morriss continue to look after the box until his return.  He added that if he did not return in the next 10 years then he had instructed a close friend to send the cipher key on June 1832.  After that time Morriss would be able to decipher the code and learn of the box’s secrets.

Well, Beale never returned, nor did Morriss receive the promised cipher key.  Eventually he decided to open the box.  Inside were three sheets of paper written in code, and an explanatory note. The note detailed that Beale had, with a group of friends discovered a seam of gold and other precious metals in Santa Fe. They had mined this over a number of years – burying the treasure in a secret location for safe keeping.  The note then explained that the coded messages would give the precise location of the treasure as well as detailing which men were due a share.

Screen Shot 2015-11-22 at 6.37.27 PM

Morriss devoted many years to trying to decipher the code in vain – before deciding at the age of 84 in 1862 that he should share his secret with a close friend.  That friend would later publish the Beale Papers in 1885.  The pamphlet that was published stirred huge interest in America – inspiring treasure hunters and amateur cryptographers to try and crack the code.  The second of the 3 coded messages was cracked by the author of the pamphlet using what is known as a book code.  The United States Declaration of Independence was used as the book to encode the message above.

Screen Shot 2015-11-22 at 6.51.08 PM

The first number 115 refers to the 115th word in the Declaration of Independence, which is the word “instituted”.  Therefore the first letter of the decoded message is “I”.  The second number is 73, which refers to the 73rd word in the declaration – which is “hold”, so the second letter of the decoded message is “h”.  Following this method, the following message was revealed:

I have deposited in the county of Bedford, about four miles from Buford’s, in an excavation or vault, six feet below the surface of the ground, the following articles, belonging jointly to the parties whose names are given in number three, herewith:

The first deposit consisted of ten hundred and fourteen pounds of gold, and thirty-eight hundred and twelve pounds of silver, deposited Nov. eighteen nineteen. The second was made Dec. eighteen twenty-one, and consisted of nineteen hundred and seven pounds of gold, and twelve hundred and eighty-eight of silver; also jewels, obtained in St. Louis in exchange for silver to save transportation, and valued at thirteen thousand dollars.

The above is securely packed in iron pots, with iron covers. The vault is roughly lined with stone, and the vessels rest on solid stone, and are covered with others. Paper number one describes the exact locality of the vault, so that no difficulty will be had in finding it. Source

After the pamphlet was published there was great interest in cracking the 2 remaining papers, an interest which has persisted into modern times.  One of the uncracked papers is shown below:

Screen Shot 2015-11-22 at 6.37.03 PM

In 1983 2 amateur treasure hunters were jailed for trying to dig up graves in Bedford, sure that they were about to find the missing gold.  In 1989 a professional treasure hunter called Mel Fisher secretly bought a large plot of land after believing that the treasure was buried underneath.  However nothing was found.  Up until now all efforts to crack the code above have  ended in failure.  Perhaps the pamphlet was a giant hoax?  Or perhaps the treasure is still waiting to be found.

Screen Shot 2015-11-30 at 9.52.12 PM

The town of Bedford still receives visitors from around the world, keen to try and crack this centuries old puzzle.  You can hire metal detectors and go looking for it yourself.  The map above from 1891 shows the 4 mile radius from Buford’s tavern which is thought to contain the treasure.  Maybe one day Beale’s papers will finally be cracked.

For more information on this topic read Simon Singh’s excellent The Code Book – which has more details on this case and many other code breaking puzzles throughout history.

If you want to try your own codebreaking skills, head over to our Schoolcodebreaking site – to test your wits against students from schools around the world!

Website Stats

  • 6,423,315 views

Recent Posts

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