Anatomy of a Puzzle

Recently I was asked to provide a Puzzle For Today for the BBC Radio 4 Today programme which was partially coming as an Outside Broadcast from Ulster University.

I’ve written a post about the puzzle itself, and some of the ramifications of it; this post is really more about the thought process that went into constructing it.

When I was first asked to do this I had a look at the #PuzzleForToday hashtag on Twitter and found that a lot of people found the puzzles pretty hard, so I thought I might try to construct a two part puzzle with one part being relatively easy and the other a bit harder. I also wanted something relatively easy to remember and work out in your head for those people driving, since commuters probably make up a lot of the Today programme audience.

A lot of my students will know I often do puzzles with them in class, but most are quite visual, or are really very classic puzzles, so I needed something else. Trying to find something topical I thought about setting a puzzle around a possible second referendum election, since this was much in the news at the time. My first go at this was coming up with a scenario about an election count, and different ballot counters with different speeds counting a lot of ballots.

I constructed an idea that a Returning Officer had a ballot with a team of people to count votes. One of the team could count all the votes in two hours, the next in four hours, and the next in eight hours. But how long would they take if they worked all together? The second part would be: if there were more counters available but each took twice as long again as the one before, what was the least possible time to complete the task.

I liked this idea because I thought there were a lot of formal and informal ways to get to the answer, and indeed the answers I saw on Twitter and Facebook confirmed this. Perhaps the easiest way to approach the puzzle is this: to consider how much work each can do in an hour. We see the first person gets half of it done, the next one quarter and the next one eighth. All together then:

We need to work out what number we would multiply by this to get one – i.e. the whole job being done. In this case it works out as

which works out (a bit imprecisely) with a bit of work, or a decent calculator, as one hour, eight minutes and thirty four seconds and a bit. So, not great, but the second part of the puzzle works out much more smoothly. If we keep on with out pattern, we get

Formally, this is called a Geometric Progression, there is a constant factor between each terms. Sometimes these infinite sums actually have a finite answer, which might be surprising. If you keep adding these fractions you might see that are adding ever closer to 1. Therefore this potentially infinite number of counters gets the work done in one hour, it can’t be less.

So, I was happy the second number worked out nicely, but the first is pretty tricky, and not easily worked out in one’s head. So I wondered what numbers I could use instead that would work out as an exact number of minutes. This really means that my three fractions from the first part of the problem, divide perfectly into 60. I used some Python to help me with this with a list comprehension:

# Establish a top size to work with n = 100
# Find all the triples where# a,b,c <= n and 1/a + 1/b + 1/c
# divides evenly into 60

triples = [(a,b,c) for a in range(1,n+1)
for b in range(1,a)
for c in range(1,b)
if (60/(1/a + 1/b + 1/c)).is_integer()]

It turns out that restricting ourselves to three numbers for the first quiz all of which are under 100 that there are 902 such sets of numbers. The very smallest numbers are 1, 2 and 6. The problem is that most of these triples don’t have the property of my original choices – which that there is a common number multiplied between the first and second, and the second and third etc.. That would make the second part of the puzzle more difficult.

So, I modified my list comprehension a bit to add the condition that there was a common ratio from a to b to c:

# Establish a top size to work with
n = 100

# Find all the triples where a,b,c <= n and 1/a + 1/b + 1/c
# divides evenly into 60 and where the factor between a and b,
# is the same as that between b and c

geometric_triples = [(a,b,c) for a in range(1,n+1)
for b in range(1,a)
for c in range(1,b)
if (60/(1/a + 1/b + 1/c)).is_integer()
and a/b == b/c]



This produced just three triples (with all numbers under 100):

>>> geometric_triples
[(28, 14, 7), (56, 28, 14), (84, 42, 21)]


and you can see these are all quite related. So I grabbed the first three numbers to try and keep the puzzle small.

As well as that, the programme team wanted a different focus than an election – they were a bit worried that because it was in the news so much it would be better to have another focus. I considered a computational task divided between processors, but eventually concluded this wouldn’t make a lot of sense to some listeners, so I went with this final configuration of the puzzle.

Part One

A Professor gives her team of three PhD students many calculations to perform. The first student is the most experienced and can complete the job on her own in 7 hours, the next would take 14 hours on his own, and the last would take 28 hours working single handed to complete the task. How long would the task take if they all worked together?

Part Two

If the Professor has more helpers, but which follow the same pattern of numbers to complete the task, what is the absolute minimum time the task can take?

You can probably answer this from the details of the construction above, but if not, you can always cheat here (the BBC programme page) or here.

# Establish a top size to work with n = 100
# Find all the triples where a,b,c <= n and 1/a + 1/b + 1/c
# divides evenly into 60 and where the factor between a and b,
# is the same as that between b and c
geometric_triples = [(a,b,c) for a in range(1,n+1) for b in range(1,a) for c in range(1,b) if (60/(1/a + 1/b + 1/c)).is_integer() and a/b == b/c]

My Puzzle for the Day

In November 2018 the BBC Radio 4 Today Programme was visiting Ulster University for an outside broadcast. I was asked to write the Puzzle for the Day for the broadcast. Here is my puzzle and some discussion about how it can be solved. The puzzle and a very brief solution is on the BBC page, but I restate it below, together with a more full solution.

Part One

A Professor gives her team of three PhD students many calculations to perform. The first student is the most experienced and can complete the job on her own in 7 hours, the next would take 14 hours on his own, and the last would take 28 hours working single handed to complete the task. How long would the task take if they all worked together?

Part Two

If the Professor has more helpers, but which follow the same pattern of numbers to complete the task, what is the absolute minimum time the task can take?

Solving Part One.

Possibly the easiest way to solve the first part is to consider how much work can be done by each team member in a single hour and adding to get the total amount of work done per hour. For instance, the first team member can do the whole job in seven hours, so they can do of the job in one hour etc. So the team together can do the following in one hour:

In other words, one quarter of the job can be done in a single hour by the team of three working together. It follows that to do the whole job, the team needs four hours.

Solving Part Two.

So what about part two of the puzzle? Quite reasonably, some people attempting the puzzle assumed that the more and more team members we would add, the time to complete the task would eventually drop to zero. This seems fairly intuitive – if you have potentially infinite team members then the total time must drop to zero.

But imagine we continue our pattern from above, for far more than three team members. This would be the proportion of work done in one hour by even an infinite team.

If this addition produces an infinite “answer” then an infinite work rate per hour would certainly suggest the task could be done instantly. Surprisingly perhaps this sum of infinitely many numbers does not have an infinite answer. It may be a little easier to see its nature if we take out a factor of .

Then the summation looks like this:

It may be intuitive for some people that the numbers inside the bracket will get over closer to 2 – setting aside the initial 1, each subsequent number added goes half way from the previous sum to adding an additional 1 in total. In other words, this whole sum will be .

Some infinite summations do indeed have finite answers, but it can be quite difficult to prove which are which, or to find the summations if they are finite. However, this example, aside from intuitively having a relatively easy answer falls into a special category of such summations called a geometric progression. These are series of the form:

In other words, each item in the sum is the previous item multiplied by some common ratio . There is a nice formula for the sum of the first terms of such progressions which you could use to solve part one – though it would rather be a sledgehammer to crack a nutshell, but there is a formula for the infinite summation too.

(provided , or in other words that is between -1 and 1 not-inclusive, if not then the summation is infinite).

In this case and and passes the test above so the infinite sum is indeed verified to be .

Finally therefore, if even infinitely many team members can only do of the job in an hour, we need to work out the number to multiply on this to get to the whole job being done, i.e. not “2/7” of the job but the whole “1” of the job.

That number is , so the whole job can be reduced from the four hours of part one to not less than 3.5 hours.

Of course, there are other ways to solve the puzzle. This is just one example pathway. If you are interested in how I went about constructing the puzzle, I detail that in another post.

Incidentally, the fact that summations of infinitely many objects sometimes has finite answers is of vital importance for many real life applications of mathematics. The whole subject of Integral Calculus relies on this, and for instance, this is closely related to why it is possible, with finite energy for a rocket to escape Earth or an electron to escape an atom.

Infinity, A Very Short Introduction, by Ian Stewart

This review was originally written for the London Mathematical Society November 2018 Newsletter. The book can be found here.

The “Very Short Introduction” series by Oxford University Press attempt to take a moderately deep dive into various subjects in a slimline volume. Professor Stuart addresses the apparent paradox of tackling the subject of the infinite in such a small volume right at the start, along with the observation that the topic of infinity has long provided such paradoxes. This particular VSI aims to tackle infinity as found in numbers, geometry, art, theology, philosophy and more, and so it is a tightly packed volume indeed.

Infinity is a concept that is, at least now, embraced in Mathematics, but also reaches into Physics, Philosophy, Theology and Language in significant measure. In this book, Ian Stewart sets off almost immediately into the mathematical interpretations and concepts of infinity, starting with examples that are likely to be accessible to a wide range of readers, but also touching on some that will cause more mathematically advanced readers to consider them carefully and which may be challenging to less mathematically literate readers.

These examples are of the paradoxical issues surrounding infinity; all but one of these is explicitly mathematical, some geometrical, others more algebraic; by the end of the first short chapter we have visited David Hilbert’s famous hotel and explored some of the implications for the arithmetic of the infinite.

The second chapter then moves into a more detailed exploration of the consequences of the infinite in numbers, and in particular explores the infinite, non-repeating decimal representations of irrational numbers and the continuity of the real numbers.

Stewart then explores the history of the infinite in the third chapter, and how it weaved through early Greek philosophy and the classic paradoxes of Zeno, and how for the Greeks issues of infinity were closely tied to their thoughts and theories about motion, and indeed whether motion was in fact possible or an illusion. Some time is spent with Aristotle, and how he dismissed the idea of an “actual” infinity in favour of a “potential” infinity. We then move through with both Locke and Kant to the beginning of more modern philosophical analyses of the infinite. Some time is taken to explore the philosophy of the infinite in Christian theology, particularly through Thomas Aquinas, a philosopher heavily influenced by Aristotle and how he used the infinite in his “proof” of God.

Stewart also explores how, in the modern era, mathematicians take the infinite very much as a normal and integral part of mathematics, with little concern about the distinction of actual and potential infinities that were the great concern of the philosophy of the ancient world.

We dive then, from the infinitely large to the infinitely small in the fourth chapter where the seeds of calculus and analysis are to be seen, and the philosophical objections from Bishop Berkeley to the use of infinitesimals. It is interesting to note that these and other concerns about the theoretical underpinnings of calculus were largely ignored in the face of its obvious utility, until others tried to explore these foundations more deeply. Stewart takes us through this work through Cauchy and eventually to the work of Bolzano and Weierstrass who finally introduced the ? and ? notation that has undoubtedly delighted many undergraduates since and ushered in the start of analysis proper. Stewart than dips into an examination of non-standard analysis, a topic that at least I was never knowingly exposed to in my formal studies; it was intriguing to read of these numbers with “standard” and “infinitesimal” parts.

There follows a chapter on the geometrically infinite, which in particular looks at the role of the infinite in art, but which again after an informal discussion dips into the mathematics of what is going on. The chapter after this focuses on infinities that arise in Physics, particularly in optics, Newtonian and Relativistic gravity, moving on then to discuss the size of the known universe and its curvature. These two chapters are both short and may require some unpacking by readers with less background knowledge.

The final chapter is mostly dedicated to work of Cantor and his systemization of modern mathematical thinking around the concept of the infinite. Here we meet the distinctions between the finite, countably infinite and uncountably infinite, transfinite cardinals and transfinite ordinals. But even here we find the objections of some philosophers, in this case Wittgenstein. This is interesting to read in an era where Cantor’s formulations are considered uncontroversial and part and parcel of the “paradise” of Hilbert’s modern mathematics in the same way that the past controversies of complex numbers are of little interest to modern mathematicians.

The approach taken to infinity in the book, is non-apologetically Pure Mathematical in its spirit, and I suppose this may make the work a little less accessible for some readers, particularly those who are not prepared to think through some of the sections, perhaps with a pen and paper. The Very Short Introduction to Mathematics, from the same series, by Timothy Gowers similarly tackles a cross section of challenging examples from the discipline in a relatively small space.

In September 2016, the BBC aired an interesting series on Radio 4: “The History of the Infinite” (this is still happily available online for those interested, at least for those in the UK). In this series, Adrian Moore began discussing the original Greek antipathy to the idea in early philosophy, and then how the idea emerged through Aristotelian Philosophy, Christian theology. It was after this that Moore decided to tackle the more serious implications of the infinitely small and big in mathematics, before emerging back through Physics into more philosophical territory.

I suspect this route, sandwiching the more complicated mathematical treatment between philosophy more related to human experience could be more palatable to a general reader.

The Very Short Introduction to Infinity is nevertheless a fascinating and joyful exploration of the topic, accessible to the committed and careful novice, but with enough detail and asides to delight formally mathematically trained readers.

Semi Open Book Exams

A few years ago, I switched one of my first year courses to use what I call a semi-open-book approach.

Open-book exams of course allow students to bring whatever materials they wish into them, but they have the disadvantage that students will often bring in materials that they have not studied in detail, or even at all. In such cases, sifting through materials to help them answer a question could be counter productive.

On the other hand, the real world is now an increasingly “open-book” environment, which huge amounts of information available to those in the workplace which is now almost always Internet connected.

So I decided to look at another approach. Students are allowed to bring in a single, personalised, A4 sheet, on which they can write whatever they wish on both sides. There are a few rules:

• the sheet must be written on “by hand”, that is to say, it cannot be printed to from a computer, or typed;
• the sheet must be “original”, that is to say, it cannot be a photocopy of another sheet (though students may of course copy their original for reference);
• the sheet must be the student’s own work, and they must formally declare as much (with a tick box);
• the sheet must be handed in with the exam paper, although it is not marked.

The purpose of these restrictions are to ensure that each student takes a lead in producing an individual sheet, and to inhibit cottage industries of copied sheets.

In terms of what can go on the sheet? Well anything really. It can be sections from notes, important formulae, sample questions or solutions. The main purpose here is to prompt students to work out what they would individually distill down to an A4 page. So they go through all the module notes, tutorial problems and more, and work out the most valuable material that deserves to go on one A4 page. I believe that this process itself is the greatest value of the sheet, its production rather than its existence in the exam. I’m working on some research to test this.

So I email them each an A4 PDF, which they can print out at home, and on whatever colour paper they may desire. The sheet is individual and has their student number on it with a barcode, for automated processing and analysis afterwards for a project I’m working on, but this is anonymised. The student’s name in particular does not appear, since in Ulster University, it does not appear on the exam booklet.

The top of my sheet looks like this:

So, if you would like to do the same, I am enclosing the Python script, and LaTeX that I use to achieve this. You could of course use any other technology, or not individualise the sheet at all.

For convenience the most recent code will also be placed on a GitHub repository here, feel free to clone away.

My script has just been rewritten for Python 3.x, and I’ve added a lot of command line parameters to decouple it from me and Ulster University only use. It opens a CSV file from my University which contains student id numbers, student names, and emails in specific columns. These are the default for the script but can be changed. For each student it uses LaTeX to generate the page. It actually creates inserts for each student of the name and student number, you can then edit open-book.tex to allow the page to be as you wish it. You don’t need to know much LaTeX to achieve this, but ping me if you need help. I am also using a LaTeX package to create the barcodes automatically.

I’ve spent a bit of time adding command line parameters to this script, but you can try using

python3 open-book.py --help

for information. The script has been rewritten for Python 3. If you run it without parameters it will enter interactive mode and prompt you.

I’d strongly recommend running with the –test-only option at first to make sure all looks good, and opening open-book.pdf will show you the last generated page so you can see it’s what you want.

Anyway, feel free to do your own thing, or mutilate the code. Enjoy!

#!/usr/bin/env python

#
#
# Free and Open Source Software under GPL v3
#
import argparse

import csv
import re
import subprocess
import smtplib
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

def process_student(args, row):
"""Takes a line from the CSV file, you will likely need to edit aspects of this."""
'kicks of the processing of a single student'
student_number = row[args.student_id_column]
student_name = row[args.student_name_column]
student_email = row[args.student_email_column]
print('  Processing:', student_name , ':', student_email)
create_latex_inserts(student_number, student_name)
create_pdf()
send_email(args, student_name, student_email)

def create_latex_inserts(student_number, student_name):
"""Write LaTeX inserts for the barcode and student name

For each student this will create two tiny LaTeX files:

* open-book-insert-barcode.tex which contains the LaTeX code for a barcode representing the student number
* open-book-insert-name.tex which will contain simply the student's name

These files can be included/inputted from open-book.tex as desired to personalise that document

student_number is the ID in the students record system for the student
student_name is the name of the student"""

# Open a tiny LaTeX file to put this in
file = open('open-book-insert-barcode.tex', 'w')

# All the file contains is LaTeX to code to create the bar code
string = '\psbarcode{' + student_number + '}{includetext height=0.25}{code39}'
file.write(string)
file.close()

# The same exercise for the second file to contain the student name
file = open('open-book-insert-name.tex', 'w')
string = student_name
file.write(string)
file.close()

def create_pdf():
"""Calls LaTeX and dvipdf to create the personalised PDF with inserts from create_latex_inserts()"""

# Suppress stdout, but we leave stderr enabled.
subprocess.call("latex open-book", stdout=subprocess.DEVNULL, shell=True)
subprocess.call("dvipdf open-book", stdout=subprocess.DEVNULL, shell=True)

def send_email(args, student_name, student_email):
"""Emails a single student with the generated PDF."""
#TODO: Might be useful to improve the to address
#TODO: Allow subject to be tailored.

subject = args.email_subject
# to_address = student_name + ' <' + student_email + '>'

msg = MIMEMultipart()
msg['Subject'] = subject

text = 'Dear Student\nPlease find enclosed your guide sheet template for the exam. Read the following email carefully.\n'
part1 = MIMEText(text, 'plain')
msg.attach(part1)

# Open the files in binary mode.  Let the MIMEImage class automatically
# guess the specific image type.
fp = open('open-book.pdf', 'rb')
fp.close()

msg.attach(img)

# Send the email via our own SMTP server, if we are not testing.
if not args.test_only:
s = smtplib.SMTP(args.smtp_server)
s.quit()

def override_arguments(args):
"""If necessary, prompt for arguments and override them

Takes, as input, args from an ArgumentParser and returns the same after processing or overrides.
"""

# If the user enabled batch mode, we disable interactive mode
if args.batch_mode:
args.interactive_mode = False

if args.interactive_mode:
override = input("CSV filename? default=[{}] :".format(args.input_file))
if len(override):
args.input_file = override

override = input("Student ID Column? default=[{}] :".format(args.student_id_column))
if len(override):
args.student_id_column = int(override)

override = input("Student Name Column? default=[{}] :".format(args.student_name_column))
if len(override):
args.student_name_column = int(override)

override = input("Student Email Column? default=[{}] :".format(args.student_email_column))
if len(override):
args.student_email_column = int(override)

override = input("Student ID Regular Expression? default=[{}] :".format(args.student_id_regexp))
if len(override):
args.student_id_regexp = override

override = input("SMTP Server? default=[{}] :".format(args.smtp_server))
if len(override):
args.smtp_server = override

override = input("Email subject? default=[{}] :".format(args.email_subject))
if len(override):
args.email_subject = override

override = input("Email sender address? default=[{}] :".format(args.email_sender))
if len(override):
args.email_sender = override

return(args)

def parse_arguments():
"""Get all the command line arguments for the file and return the args from an ArgumentParser"""

parser = argparse.ArgumentParser(
description="A script to email students study pages for a semi-open book exam",
epilog="Note that column count arguments start from zero."

)

action='store_true',
dest='batch_mode',
default=False,
help='run automatically with values given')

action='store_true',
dest='interactive_mode',
default=True,
help='prompt the user for details (default)')

dest='input_file',
default='students.csv',
help='the name of the input CSV file with one row per student')

dest='student_id_column',
default=1,
help='the column containing the student id (default 1)')

dest='student_name_column',
default=2,
help='the column containing the student name (default 2)')

dest='student_email_column',
default=9,
help='the column containing the student email (default 9)')

dest='student_id_regexp',
default='B[0-9]+',
help='a regular expression for valid student IDs (default B[0-9]+)')

dest='smtp_server',
default='localhost',
help='the address of an smtp server')

dest='email_subject',
help='the subject of emails that are sent')

dest='email_sender',
help='the sender address from which to send emails')

action='store_true',
dest='test_only',
default=False,
help='do not send any emails')

args = parser.parse_args()

# Allow for any overrides from program logic or interaction with the user
args = override_arguments(args)
return(args)

def main():
"""the main function that kicks everything else off"""

print("Hello")
args = parse_arguments()

print("Starting open-book...")
print(args)

student_count = 0
# Go through each row
student_number = row[args.student_id_column]
# Check if the second cell looks like a student number
if re.match(args.student_id_regexp, row[args.student_id_column]):
student_count = student_count + 1
process_student(args, row)
else:
print('  Skipping: non matching row')

print('Stopping open-book...')

if __name__ == '__main__':
main()


I use a LaTeX template for the base information, this can be easily edited for taste.

\documentclass[12pt,a4paper]{minimal}
\usepackage[latin1]{inputenc}
\usepackage{pst-barcode}
\usepackage[margin=2cm]{geometry}

%
% Does it all have to be Arial now? <sigh>
%
\renewcommand{\familydefault}{\sfdefault}

\author{Professor Colin Turner}
\begin{document}
\begin{centering}
\textbf{EEE122 Examination Guide Sheet}

This sheet, and its contents that you have added, can be brought into
the examination for EEE122. The contents \textbf{must} be compiled
by yourself, be handwritten, and be original (i.e. \textbf{NOT}
photocopied or similar). You may use the
reverse side. You may retain a copy you have made before the examination
but the original must be handed in with your examination scripts at the

%\input{open-book-insert-name.tex}
% D'Oh! Not supposed to put a name on anything going in the exam.
\input{open-book-insert-barcode.tex}
\hfill
\begin{pspicture}(7,1in)
%\psbarcode{
%\input{./open_book_insert.tex}
%B00526636
%}{includetext height=0.25}{code39}
\input{open-book-insert-barcode.tex}
\end{pspicture}
\end{centering}

\vfill
\begin{centering}
Please read the following declaration and tick the box to indicate you agree:

I declare this sheet to have been compiled by myself and not by another, and that the student number above is mine.

%\rule[-1 cm]{10 cm}{1 pt}
\framebox[0.3 cm]{ }

\end{centering}

\end{document}


The Deceptiveness of Coincidence

A friend of mine recently posted about a chain of events – people sharing birthdays – that was so unlikely that a lottery ticket purchase was called for. Most people might make similar comments as the oddity of these events struck them. There followed some discussion about these problems and it made me think of trying to set out the issues more carefully.

I’ve done a lecture, in some variations (for school audiences), almost every year about the deceptiveness of common sense in mathematics. Indeed, it provided the title of this blog.

The Birthday Problem

One of the problems I examined is the famous birthday problem. Let’s look at two aspects of this.

How many people must be in a room before we are certain that two of them share the same birthday?

This can be answered by using the so called pigeon hole principle. In this case, the pigeon holes are all the days of the calendar in a year, 365, or let’s say 366 to allow for the worst case scenario of a leap year. The people in the room are the pigeons. You can place 366 pigeons into the holes and keep them all separate, but any more ensures that at least two must share one of the holes. So, similarly, you need 367 people to be absolutely sure that one pair in the room shares a birthday.

Let’s look at a more subtle question.

How many people must be in a room so that it is more likely than not that two of them share the same birthday?

It turns out this number is deceptively low. We reach a 50% chance (more likely than not) with just 23 people in the room. Perhaps even more surprisingly we reach a 99.9% chance with 70 people in the room. The calculations for the probabilities are set out in the link to the lecture, and the wikipedia article as mentioned above, but I don’t want to focus on that. I want to focus on why the result is so shocking to most people.

The issue is the collision of relatively rare events (a birthday) with numerous combinations. For instance if you want to consider how many pairs one can form in the room we can see this.

If there are three people in the room, A, B and C, there are three possible pairs: AB, AC, and BC. If there are four people in the room, A, B, C and D, there are six possible pairs: AB, AC, AD, BC, BD, and CD. There’s actually a nice formula for this and you can work this out for more examples.

You don’t need to know the formula, but if you want it is

People in Room Possible Pairs
3 3
4 6
10 45
15 105
20 190
23 253
30 435
50 1225
70 2415

You can see just how rapidly the number of pairs increases. It might seem un-obvious that 23 people is as likely as not to produce a duplicate birthday, but it’s perhaps less so when you realise that we are not predicting which pigeon hole has two pigeons in it to go back to our analogy. But given 253 possible pairings, it seems less unlikely even intuitively that there will be “collisions” within one of those pairs.

Coin Tosses

Let me talk about a similar problem, flipping a (fair) coin to get a Head (H) or a Tail (T). Let’s consider that we flip the coin three times. The possible outcomes are:

HHH, HHT, HTH, THH, TTH, THT, TTH, TTT.

These are all absolutely equally likely, and even this is sometime unintuitive. The coin has no memory of how it performed, and no desire to conform to some concept such as a “law of averages“. But we tend to categorise these 8 possible events into 4 categories.

• Three Heads: (one way this can happen, so 1/8 probability)
• Two Heads, One Tail: (three ways this can happen, so 3/8 probability)
• One Head, Two Tails: (three ways this can happen, so 3/8 probability)
• Three Tails: (one way this can happen so 1/8 probability).

In doing so, we can see why the HHH and TTT events look particularly exciting and rare. They are no more rare than any other individual outcome, but it’s the groupings of how one can get two heads that makes that collection of events more unexciting.

To take this to more of an extreme. If we flip a coin ten times, then these outcomes are all exactly equally likely.

1. HHHHHHHHHH
2. HTHTHTHTHT
3. HHTHTTHTTH
4. THTTHHHTHT
5. TTTTTTTTTT

But some will be far more remarked upon that others. But even if we have an experiment that flips a coin 10 times over and over again enough times, we will expect to see all of these (more or less, eventually) equally often, but we will probably not consider these exciting except maybe outcomes 1,5 and maybe 2.

Genealogy

Another example, closer to home. Let’s assume that there have been 7,500 generations of Homo Sapiens since its emergence as a species.

The probability that in each of those 7,500 generations in both your paternal and maternal line that all the pairings took place between the right people at the right time in the right circumstances to give rise to you is astronomical. You have two parents, four grand parents, 8 great grand parents and so on. Just for that collection of people. If we add you into the mix, then the number of pairings involved over these 7500 generations is

That number has 2259 digits, you can see them here on Wolfram Alpha.

That’s the number of people involved to get to you, including you. They all had to survive and meet at the right time, and um, do everything else at exactly the right time in the right way. What are the odds? And yet you are here… You might find that exceptional, and of course in a way it is, but the point is, you are not more likely or unlikely than most other human beings that have been born, or countless potential humans who might have been but were not born because their parents never even met. The fact that you specifically exist is unlikely, but the fact that if you did not someone else would exist instead is highly likely and predictable.

Naturally, however, we tend to think of our own existence rather more than some random person on the other side of the planet. But each one of us is an example of the coin flipping perfectly as needed every single time. Sometimes a Head, sometimes a Tail, but that exact perfect sequence essential to produce you. Naturally we are each quite taken with the outcome that produces us and also our nearest and dearest. But if it had not happened, we wouldn’t be here to wonder about it.

Availability and Psychology

As you can see there is more to this than mathematics and probability, there is also perception and psychology, specifically a concept called the Availability Heuristic. Some things stand out to us as being significant when they are no more significant than other events we ignore.

You might live in a city of a million people. You might personally know only a hundred. You might pass a thousand on your commute to work each day. You do that hundreds of times a year. The number of possible combinations of people you will see over a year is enormous, but you won’t remember it as a special event when you bump into all the people who aren’t dear to you.

The Anthropic Principle

A nice example of this thinking is the question that many people have asked which is essentially: why is the Universe, and our Earth, set up so nicely to allow humans to exist? If certain physical constants were just a bit different then matter as we know it couldn’t form. If we were just a bit closer to the Sun we couldn’t survive and so on.

These things are all true. But in a Universe with inappropriate physical constants there will be no matter by definition, and certainly no sentient matter like us to notice.

If the Earth was closer to the Sun, homo sapiens would not exist as it currently does, but like as not some other species would, and it would also think how perfectly the world was formed for them. This concept, that we tend to think the Universe is so special to have created us, despite the fact that if not we wouldn’t be here to think about it, is often called the Anthropic Principle.

We believe that the improbability of life itself or us as a species is an example of the collision between billions of individually improbable events with the billions of events than could have occurred, and the billions of years in which they might have done so.

We end up having to think about such things with great care because our evolution on the African savannah didn’t really equip us to consider them. So we shouldn’t be surprised that we are surprised, but we still are.

It’s the old cliché: you are unique and special; just like everyone else.

There are always dangers in imagining our special place as a species.

“This is rather as if you imagine a puddle waking up one morning and thinking, ‘This is an interesting world I find myself in — an interesting hole I find myself in — fits me rather neatly, doesn’t it? In fact it fits me staggeringly well, must have been made to have me in it!’ This is such a powerful idea that as the sun rises in the sky and the air heats up and as, gradually, the puddle gets smaller and smaller, frantically hanging on to the notion that everything’s going to be alright, because this world was meant to have him in it, was built to have him in it; so the moment he disappears catches him rather by surprise. I think this may be something we need to be on the watch out for.”

Academic Family Tree, LaTeX and Tikz

A few years ago, I found out some information on my academic genealogy, going through my supervisor, Brian McMaster, back through others to G.H. Hardy, Newton and Galileo and a little further before the records run dry. Of course it is nice that mathematics is an old and well established discipline with great records. And also, the number of scholars back then was much lower, so it’s not surprising that famous names turn up quite quickly, if you just have the full records – just as on a less cerebral level – the clichÃ© goes that Charlemagne got about quite a bit. A bit of work with my mathematical colleagues all show such interesting family trees.

Anyway, I slowly built an SVG file in Inkscape to reflect this family tree, but it was slow and rather a pain to maintain. So I’ve long wondered if it can be done better in LaTeX, with the Tikz graphics packages. Tikz is awesome, and while it has quite a learning curve as for LaTeX itself, I used it extensively in producing the slides for my recent inaugural lecture. This meant mixing the formulae with the graphics was pretty effortless. This is a slightly different problem.

A quick scan, showed that Tikz can be used to build flowcharts rather easily. So I began in this way, building nodes of people and then positioning them relative to each other. A bit tedious but much more pleasing that doing it in a vector graphics program, for me anyway. I rapidly ran into problems in building very large page styles. In particular odd things happened when I tried to include graphics (the image became the whole page, regardless of scaling).

I experimented briefly with the tikzposter package, but couldn’t really get anywhere with it – perhaps because I hadn’t started from the ground up with it. I think I looked at beamerposter but again ran into problems, possibly because I didn’t start that way. In the end it was the simple a0poster package that did it for me, anyway – although I had to force the font throughout to be “\tiny”.

I also discovered the hard way that the wrapfig package doesn’t seem to work within a Tikz node, so I’ve messily improvised by adding another node for the images of people and relating its position to the relevant biographical section.

I harvested some basic biographical information from Wikipedia and one other website.

I managed to get something basic working. The image is big so the version below is blurry. A link to the smaller PDF and the LaTeX source on GitHub are shown below.

FamilyTree

Necessary And Sufficient

This article contains links to materials and extra resources to my Inaugural Professorial Lecture, with the same name, delivered on 17th February 2016 at Ulster University.

• If you have any comments or questions, use the Twitter hashtag #nesssuff and I’ll pick them up later and try to address them. My Twitter ID is @ProfCTurner.
• The Vote of Thanks will be given Sarah Flynn, whose Twitter ID is @sarahjaneflynn.

Synopsis

“Necessary and Sufficient: a look at elegance, efficiency and completeness in Engineering and its Mathematics

Engineers and Pure Mathematicians have a surprising amount in common, despite working at opposite ends of many problems; one at the totally theoretical end and the other at that of practical realisation, sometimes centuries apart. They both use tools created or designed mainly by other members of their own profession; they both enjoy testing things to destruction in order to explore how they work; and they both enjoy finding solutions to problems that cover all the requirements but which tend to do so in an efficient and elegant way.

This lecture explores how basic concepts that began with natural numbers to count livestock in antiquity eventually gave rise to complex numbers, and how techniques to measure buildings and the movement of the stars evolved into techniques to analyse data in totally new ways.

Some modern applications, ranging from every day examples such as photographs taken by smart-phones through to research applications, will also be considered.

Finally, the lecture will examine the implications for how Engineers can be educated to bring the power of some of humanity’s most beautiful abstract ideas to bear on the practical problems that surround us in everyday life.

Lecture Slides

(“Director’s cut” and “Commentary/Video” to be uploaded at a later date).

– Videos not embedded, no pauses (~3 MB)

– Full Size Slides with pauses and embedded Video (~52 MB)

For those interested the slides were produced with PDFLaTeX, Beamer and Tikz. Diagrams with plots and positions of complex numbers are all calculated as the PDF is compiled. The presentation was stored in a git repository and a Makefile was used to produce the various versions.

A GitHub repository with some files missing (due to them being University property) is available here. But this does contain all Tikz diagram source code, cow images, and a LaTeX Beamer template aligned to the Faculty template that was produced. Faculty colleagues can request the required University images for their own presentations. The Makefile shows how to create different versions of the talk, with embedded or linked videos, and with or without pauses.

Introduction

The Evolution of Numbers

Circular Functions and Fourier Series

Event Brite

• The lecture was advertised on EventBrite here.

Tweaking Newton’s Law of Universal Gravitation

I answered a question on Quora about the consequences of Newton’s law of Universal Gravitation being in inverse law and not an inverse square law for 60 seconds. The outcome is not so good, what with all matter acting as a black hole and all.

What would happen if the law of gravity becomes ~1/r instead of ~1/r² for 60 seconds?

Colin Turner’s answer: All matter in the Universe would act as a black hole for 60 seconds. Which could be bad? You may recall that work done against a Force is given by WD = F.s I.e. Force times distance. In any varying force you would have to use the big daddy of multiplication : integratio…

Probability, Top Gear and the Lottery

Top Gear recently got themselves in trouble in Argentina, over an argument about whether one of their registration plates was a reference to the Falklands War.

According to the Mirror, and I realise this may not be the strongest start,

“But bookies William Hill said the odds of coincidentally buying a car with that reg to take to Argentina were about 13 million to one.”

Unfortunately the bookies’ article isn’t directly referenced so far as I can see, nor is the working out shown, but I’m instantly suspicious of such statements – a lot of assumptions (and hindsight) may have gone into this. If my Google-Fu is weak and you spot the direct link, please let me know.

Note that the BBC team strongly denies that the plate was bought specially.

To me, this is a classic potential case of underestimating how numbers stack up. Coincidences happen all the time. There are many plates that people can take offence at, many people buying them, many people travelling to somewhere it may have a different meaning and so on.

But in any case, the 13 million to one odds are presumably presented as a tacit statement that it couldn’t have been a coincidence.

The UK lottery uses 49 balls, of which you have to guess 6 correctly. The number of ways of choosing 6 from 49 is given by a relatively simple formula.

Let’s work that out

That turns out to be 13,983,816.

So, from a naive point of view the odds of winning the lottery are almost 14 million to 1. Yes, that is very unlikely. Famously much more unlikely than lots of other events, but it happens all the time.

“Unlikely” events are more psychologically available, we notice and remember them more, it can mean we assign significance to them which isn’t deserved.

If Jeremy Clarkson, or one of the others in the team had won the lottery that would have made the news too, but it wouldn’t imply a stitch up.

Chess Boards, Exponential Growth and the Ice Bucket Challenge

Yesterday I was finally nominated for the Ice Bucket Challenge, I had actually thought this inevitable for the reasons in this post, but then it all kind of passed by. As it happens, it was my Daughter Aimee’s fault in the end. :-).

So I thought I would use the opportunity to bore people about the arithmetic behind it, in the end, I suspect that wasn’t too coherent since I was being watered at the time by my older Daughter Aimee, while my younger Daughter Matilda generally screamed at both of us.

So here is what I was trying to say. I like to talk to my students about a new version of an old problem. There’s an old story about a chess game where the winner will take away a certain amount of rice. The amount is calculated by having one grain on the first square, two on the next, four on the next, and so on, doubling all the way to the 64th square. My modified version is to consider coins, a UK 10 pence piece to be precise, piling up on the squares as we go along. The question is, how high is the pile of coins on the last square? I encourage you to guess, approximately what sort of size that is.

Really, take a moment and try to write down your guess. Don’t calculate it yet, estimate it. It’ll be more fun this way.

We double each time, so the number of coins on the first eight squares are 1, 2, 4, 8, 16, 32, 64, 128.
Another way to write that is
20, 21, 22, 23, 24, 25, 26, 27.

So, we are going along 64 squares, and start at 0, so the number of coins on the last square will be
263. This is a big number, but just how big? Do we change our guess on this information? If so, go ahead and do that now.

Now 263 = 9,223,000,000,000,000,000 = 9.223 x 1018
and a ten pence piece is 1.85 mm thick, or 0.00185 m, so when we multiply these we get

17,063,000,000,000,000 m = 1.7063 x1016 m.

Wow. That seems like a lot. Just how big is that number as a distance? Last chance to change your guess?

To put it in perspective…

• by the 19th square, the coins are higher than the radio mast on the Empire State building;
• by the 29th square, the pile of coins would have reached the Moon;
• by the 48th square, the pile of coins would have reached the Sun;
• by the 63rd square, one from the end, the coins are a light year high.

This is an example of the staggering power of exponential growth, and just how unintuitive it is.

So what has this got to do with the Ice Bucket Challenge? Well suppose you start with a single individual, who then nominates three people, each of whom nominate three people. Now on the Chess Board we have 1, 3, 9, 27 and so on. This is, again, exponential growth with powers of three rather than two (actually somewhat higher growth).

Mathematically these are often called Geometric Progressions or just G.P.s for short. These are sequences of the type

a, ar, ar2, ar3, ar4, …

There is a formula that can be derived (it’s not hard, the derivation is on the above Wikipedia link) for the Sum of the first terms. (In Mathematics, contrary to popular opinion, a Sum specifically means the result of an addition process).

In the above case we can see that a = 1 because that’s the first number in 1, 3, 9, … and r = 3 because that is the number we are multiplying by each time. So here

In other words, every “generation” each person nominates a further three people, so the number of people added each generation ramps up exponentially, and the total number involved increased rapidly too.

Generation New People Cumulative Total
1 1 1
2 3 4
3 9 13
4 27 40
5 81 121
6 243 364
7 729 1,093
8 2,187 3,280
9 6,561 9,841
10 19,683 29,524
11 59,049 88,573
12 177,147 265,720
13 531,441 797,161
14 1,594,323 2,391,484
15 4,782,969 7,174,453
16 14,348,907 21,523,360
17 43,046,721 64,570,081
18 129,140,163 193,710,244
19 387,420,489 581,130,733
20 1,162,261,467 1,743,392,200
21 3,486,784,401 5,230,176,601
22 10,460,353,203 15,690,529,804

So you can see that after just 22 steps in the nomination process, you have literally more people than you have on the planet. Pyramid selling schemes become untenable for this reason too… you quickly run out of suckers on any given land mass.

So if this really ran its course unimpeded (and I know that the original challenge was money or dowsing, with a requirement to undertake the challenge in 48 hours (some say 24) then the whole planet would have done the challenge in at most six weeks. If each person had used say 4 litres of water then at the time of writing the 7,259,289,122 people alive today would have collectively used 29 billion litres of water. Since an Olympic swimming pool has 2.5 million litres of water, that represents over 11,614 swimming pools filled with water. While it is easy to criticise those who have been uneasy about the water wastage here, to be honest they have a good point. Also one organisation would have billions of charity income rather than it being spread.

Clearly this has not happened[citation needed] so people have run out on enthusiasm here and there. Anyway, have fun, and give some money to something you love, if you want, when you want to.

I am donating to

Since people I care about have been troubled by both, and

since it can’t be denied I live in extraordinary luxury to be able to waste perfectly good water on this kind of thing.