Tag Archives: maths

Competitive Edge at Christmas – the mathematical way to beat the family

Toilet Trouble is the must-have family game this festive season. Determined not to be flushed away by their families, our Mathematics lecturers, Dr Andrew Baggaley and Dr Nick Parker got ahead of the game to analyse the seemingly random sequence of flushes and squirts.

On Christmas morning many families will wake up to a rather unexpected gift from Santa Claus: “Toilet Trouble”.  This does not involve an emergency call to your local plumber or your GP, but is rather a family game devised by Santa’s most mischievous elves.

Each player nervously awaits their fate as they place their face over the toilet bowl and flush the handle.  If they are lucky, they breathe a sigh of relief at staying dry and the suspense moves to the next player; if they are unlucky, a jet of toilet water comes to greet them.  Is this squirting truly random or is there some hidden order?  Can the occurrence of the next tinkle be predicted?  And can you beat the odds to stay dry, while soaking your nearest and dearest?  Here we self-proclaimed wizz kids combine scientific experimentation and mathematical analysis to give you the edge in this festive problem.

We put the game to the test by flushing the toilet over 1000 times and noting whether the jet squirted or not.   The data was conveniently recorded in binary format as a series of zeros ( = no squirt, dry) or ones (= squirt, wet).  The dataset, shown below, appears random with no evident pattern.  However, just because it looks random, is it random?  A large area of mathematics is devoted to analysing such patterns, seeking out hidden order and the information that this may carry, from identifying the trends in stock markets to deciphering information embodied in secret communications.  On the flip side of this latter example is the branch of mathematics which creates the codes in the first place; cryptography designs tricks to hide information in a jumble of numbers.  Central to this are the “pseudo-random-number generators”, mathematical functions which produce a seemingly random series of numbers but which are nonetheless orderly mathematical functions – if we start the function from the same number we will always get the same random-looking series of numbers being produced.  In this sense, the numbers only appear random.  An everyday example of pseudo-random-number generation is when we play our music tracks on shuffle.  Interestingly, however, a good generator would mean that there was a chance that the same number (music track) would be produced twice in a row, or within a short interval. For example if you create a random playlist from a 10 track album, there is a 10% chance that you would have to listen to the same track twice in a row. To avoid this unwanted effect, the original number generators used for shuffling had to be tweaked to prevent the same track arising in close succession.

We return to the matter at hand – the “random” squirting of the toilet.  As is typical of scientific analyses, we begin our analysis at the most basic level, before drilling down to increasing detail until we reach a required level of understanding of the problem.  From the data (see image) it is evident that the squirts (ones) are relatively spaced out.  In other words, at each flush there is not an equal 50:50 chance between squirt or no squirt – the chance is biased towards not being squirted, which is some good news for the players.  Our 1000 flushes produce 196 squirts, informing us that, on average, there are 5.1 flushes between squirts.  This doesn’t help us to identify whether or not there is a pattern to the squirts, and so next we look at the number of flushes between squirts, shown below.  Several important features now become evident.  There is not an equal chance of a squirt for all number of flushes, and this allows us to ascribe a confidence/concern scale. If it is your turn to flush immediately after a squirt has taken place, you can give your most cocky grin at the toilet bowl and your fellow players – no squirts arise on this turn.  If you flush on the second, sixth or eighth flush after the previous squirt, you can smile with a confidence at the bowl – these turns have less than 5% chance of squirting.  If you take the fourth flush, then have your towel handy – this leads to the highest chance of squirting, over 30%.  Finally, if you are about the take the tenth flush then brace yourself for a guaranteed soaking since all squirts happen within ten flushes.

If the squirting were entirely random, then the distribution in the histogram would be flat; the fact that it varies indicates that there is some hidden order which, for example, favours the fourth flush and suppresses the first, second, sixth and eighth flushes.  Closer examination of the squirting reveals a pattern in which the squirting fires around the 10th, 3rd, 4th, 8th, 4th, 4th and 5th flushes.  This pattern then repeats.  So the squirting is orderly after all, it is just the irregularity of this pattern that creates an illusion of randomness.

So how random is our game? In order to understand this we can compute the entropy of the squirt signal, a single number which will quantify this.  If you have met the idea of entropy before then it was probably in the context of disorder.  Indeed one of the most important laws of physics tells us that the natural tendency of any isolated system is to become more disordered. Leave a young child in a tidy bedroom and they will soon provide a definitive proof of this.

However we can also apply this idea to a random signal. Imagine flipping a fair coin lots of times and noting down a 1 if it is heads and 0 if it is tails. This would build up a signal of 1’s and 0’s which is completely random. If we computed the entropy of this signal we would find it is one. On the other hand imagine a coin which is completely biased, it always landed showing the head. This signal would be completely predictable, it would always be a 1, and the entropy would be zero. From our data we expect a squirt roughly with a probability of around 1 in 5, a truly random signal of 1s and 0s with this probability has an entropy of 0.72. What about our game? We find the entropy of our signal is a little lower, almost exactly 0.7, expressing the fact that our data has some intrinsic pattern.

Will this understanding allow us to stay dry on Christmas morning?  Well no.  The number of flushes that a player must make is random, decided by spinning a wheel numbered from 1 to 3.  This serves to ensure that each player has no control over their own destiny.  You can predict when the squirts will fire but you can’t control whether they will fire on you!

International Girls in ICT Day 2017

There is a huge shortfall of ICT professionals worldwide, with many companies looking to increase the number of women working for them. However, many girls don’t even consider a career in ICT. We decided to celebrate some influential women in ICT from the times computers were invented to now.

Ada Lovelace

Ada Lovelace

Ada was an English Mathematician who worked on the ‘Analytical Engine’, one of the first designs for modern computers.  She recognised that computers could do a lot more than was previously thought and designed the first algorithm that could be carried out by computers. She is often called the first computer programmer for designing this.

Joan Elisabeth Lowther Murray

joan-clarke1

 

Joan was an English cryptanalyst (analysing information systems to breach cryptographic security systems) who is best known for her work as a code breaker at Bletchley Park during World War II. She worked on the Enigma project, which cracked the German system of encoding their messages and led to WWII being much shorter and saving thousands of lives. The Enigma project was a very early form of ICT.

Grace Hopper

grace-hopper

Grace was an American Computer Scientist and a United States Navy Rear Admiral. She was the first person to develop a compiler, despite being told by many people that it would never work. A compiler is a programme that changes what you write on a computer into a language that can be understood by the computer. This allows computers to work with words rather than just numbers as was previously done. There is now a yearly Grace Hopper Celebration of Women in Computing, giving women in computer science a chance to share their research.

Anita Borg

anita

Working as a computer scientist  she developed ways to analyse high speed memory systems in computers. She founded Systers, a network for women in technology, and the Grace Hopper Celebration of Women in Computing. In 1997, she founded the Institute for Women and Technology (now the Anita Borg Institute), to increase the number of women in technology and their impact on the world.

Marissa Mayer

marissa

She joined Google as employee number 20 and as their first female engineer after studying computer science at university. She oversaw the layout of Google’s home page and became Vice President of search products and user experience. In 2012 she became president and CEO of Yahoo! and led them to buy Tumblr in 2013.

#TryThisTuesday: Skipping Stones

During our time as STEM Ambassadors, we’ve visited several beaches together. From Newcastle in Northern Ireland to Clear Water Bay in Hong Kong and even beaches closer to home in Whitley Bay and Tynemouth, we always ended up skipping rocks somewhere!

But how do we do it!? Why don’t the rocks just fall into the water?

Skipping rocks in Whitley Bay

The key is to get a nice flat rock and throw it quickly at the right angle. The large surface area allows the stone to bounce off the water’s surface.

You need to throw it fairly hard to give it enough speed to gain momentum before it hits the water. When the rock hits the surface of the water it pushes the water down whilst the water pushes the rock up. If the force pushing the stone up from the water is greater than or balances the weight of the stone then it will bounce on for another skip rather than sinking. This is why it helps to have a nice small stone.

20170401_161404

It is also important to get the right velocity. Velocity is the speed of something in a give direction. So we have the speed covered, now for the direction. Scientists have discovered that the optimal angle at which the stone should hit the water should be around 20 degrees. As you probably won’t be able to measure this on a causal day trip to the beach, just aim to throw the stone sideways rather than up or down.

Hopefully you’ll manage more than my measly two skips. Try beating the world record of 88 skips in a row!

Will skipping rocks in Northern Ireland
Will skipping rocks in Northern Ireland

#TryThisTuesday: The Peg Game

This week we will show you how to play a game that you will never lose! For this you will need 12 pegs and a piece of material. Clip all 12 of these pegs in a line along the material.

try-this-tuesday-pegs

The rules of the game are simple:

  • There may only be 2 players.
  • Each player takes it in turns to remove 1, 2 or 3 pegs from the material.
  • The winner is person who removes the last peg.

If you follow 2 key steps then you can ensure victory every time. Firstly always let your opponent go first. The second step is to remove enough pegs so that the combined total of the pegs you remove and the pegs your opponent removed on their last turn adds up to 4.

For example if your opponent removes 1 peg then you will remove 3 but if your opponent removes 3 pegs then you should only remove 1 peg.

If you do this then no matter what happens the most pegs you will ever have on your last go will be 3 so you will always win!

pegs-end

The Science

This game is actually based on good old times tables and more specifically the 4 times table. If each round adds up to 4 then the 12th peg will always be removed by the person finishing the round as 12 is a multiple of 4.

This means the game could be played with even more pegs as long as the total number of pegs is a multiple of 4.

Engineering Education Scheme

This week we’ve been helping out with the Engineering Education Scheme. Lots of year 12 students from the local area have been working with industry to come up with a project based on real scientific, engineering and technological problems. The students have come in and had a chance to work in the engineering laboratories and workshops that university students and researchers would use. After lots of problem solving and hard work, they presented what they had done so far. These are just a selection of some of the projects.

Mechanical Engineering – Lifting

This group was working on creating a lifting mechanism for a heavy item/box. The current method of lifting isn’t very good as its centre of gravity is in the middle so it wobbles when they lift it. They created a design with a cradle for the box which spreads out the centre of gravity. It is more stable and quicker to lift, saving the company time. The use of shackles mean the box can attached by hand, no tools are needed, again saving time.

img_4247

Mechanical Engineering – Shield

A mechanical engineering group created an extendable shield. This is important for keeping people safe in war. In general all shields appeared to be really big or small, but there were none that could adapt to the situation. Use of cogs allowed the shield to be extended or retracted, solving the problem.

img_4243

Electrical and Civil Engineering – Solar Power

The brief from WSP Global was to provide renewable energy through use of solar panels to the 350 people who work in the office. The students made a to scale model of the office based on blueprints and used a fixed angle light (as the sun) to look at the shading on the roof of the building. They also ran computer simulations to look at which areas would capture the most sun.

img_4242

Civil Engineering – Leisure Centre

The brief was to design a leisure centre on land near to St James Football Park. There were lots of problems to be overcome in the design. The centre was to be built on top of an old mine shaft, which might mean the building would fall into the ground. They calculated that it was too expensive to fill the land underneath with concrete, so calculations had to be made for how heavy each part of the leisure centre would be.

img_4249

Marine Engineering – Underwater vehicles

This marine engineering group was helped by engineers from BAE systems. They looked at making an underwater unmanned vehicle. They had to do some problem solving with getting the submarine to sink, working out the exact amount of weight required to make it neutrally buoyant. They used electromagnets to power the vehicle.

img_4240

Marine Engineering – Underwater pipes

This group worked with GE oil and gas looking at using flexible pipes underneath the seabed. They compared two different materials; thermoplastic and thermoset.  They did lots of tests, looking at things such as compression (squashing) and torsion (twisting) to find out its properties. They also looked at factors such as the price. Testing found that it was really important that there were no faults in the thermoplastic as it broke a lot easier. Underwater pipes are really important for transporting things like oil and gas.

img_4245

 

#TryThisTuesday: Birthday Binary

Here’s a little trick you can play on your friends, or someone you don’t know well enough to already know their birthday…

With the five cards below, you can “guess” anyone’s birthday. Just go through each of the cards in turn and ask them if their birthday (as in the date they were born, not the month, so if they were born on the 17th January, their number is 17) is on the card. Discount the cards their birthday is not on.

binarycards

With the remaining cards, the cards their birthday is on, add up the numbers in the top left corner and the number you get should be their birthday!

For example, my birthday is the 30th April so 30 in my number. Its on card 1,2,3,4 and not card 0 so you would add up 2+4+8+16=30.

Is it science or is it magic?

Of course it’s science! This actually works on a system called binary, which is the language computers use. Binary is written in 0s and 1s and these together look just like 101001010010010101010 to us but to a computer that might actually mean something.

In this case, when you discount a card, that becomes a 0 and the remaining cards are a 1. So going back to the example of my birthday the cards would read 11110 (reading it backwards) and in binary this means 30.

Our top STEM jokes!

It’s nearly Christmas and that means it’s time for awful Christmas cracker jokes. Hopefully our favourite STEM jokes will be a bit more funny! Scientific explanations are underneath each one.

joke7

Neutrons make up the middle (nucleus) of atoms and don’t have any electric charge, unlike protons (positively charged) and electrons (negatively charged).

joke5

Light is made up of small particles, these are called photons. Therefore, a photon is travelling light.

joke6

The chemical symbol for oxygen is O and potassium is K.

joke4

H2O is water, but H202 is hydrogen peroxide. Hydrogen peroxide would cause chemical burns and choking if it was drunk.

joke3

Atoms are very small and make up everything, including us.

joke9

Schrodinger’s Cat is a thought experiment in physics, where a cat is kept in a box with a radioactive source and poison. Until the box is opened, the cat can be assumed to be both dead and alive.

joke1

Helium is a noble gas, this means it is doesn’t react with other elements so is inert.

joke10

Extrapolation is when you estimate what the result may be beyond what you measured. The joke is that some people can’t extrapolate from data so can’t work out the end of the joke

joke2

Binary is a way of using two different symbols, 0 and 1, to represent any number, this is often used to create code for computers. 10 in binary is the same as writing 2. Therefore, there are two types of people, those who understand binary and those who don’t.

joke12

If an atom loses an electron (a negatively charged particle) it will become positively charged.

joke11

If time travel is ever invented, it doesn’t matter when as you can just travel back in time with the time machine.

jokes8

Anti gravity is a place or object that is free from the force of gravity, so would float around.                       joke13

This is a play on words, as the atmosphere in a restaurant is how you feel when you are there, but in science terms the atmosphere is a mixture of gases that surrounds the Earth. The moon has a much thinner atmosphere than the Earth and was originally thought not to have one.