Real MATHEMATICS – LIfe vs. Maths #7

Game of H&G

I selected this name for the game as it reminds me of the story of Hansel and Gretel. (If you haven’t already, pretty please with sugar on top, read it!)

In H&G there is only one goal: Finding the shortest path. Though this game is not a board game; you have got to participate physically. You can find the answer if and only if you analyze your experience.

I have to mention it now: We learned this game from bugs, ants in particular. I will get back to that inside the article.

What is H&G? How can you play it?

  • Players walk between two places.
  • Start and finish are the same locations for all players.
  • There is more than one path for the walk.
  • Goal is to find the shortest one among those paths.
  • During the game it is forbidden to use any technological device. Yes, including watches and phones.
  • Only tool allowed is a pen.
  • Each player draws a line every time he/she hits the starting and finishing ends of the path.
  • In order to maintain same (or at least similar) speed for all players, it is forbidden to run.

Game #1

Assume that there are two paths for H&G as follows:

20190425_134042.jpg

In the beginning players on paths A and B walk the same distance. But as walks progress players using the path A arrives to the finishing point way before than the players on path B:

20190425_134109.jpg

When the players on path B arrive to the finishing point, they see a mark that is left from the players who use path A. This means that the path A is shorter than the path B. Most of the players from B would prefer path A for return. Some of them (stubborn ones) would follow B and see that they were behind of everyone else.

After some time everyone chooses the path A.

Game #2

Let’s say that we add obstacle on the path A:

20190425_134136.jpg

After a decent amount of time some of the players will try the path B in order to see if it is the shortest path now:

20190425_134159.jpg
There is a small but significant difference between B and A.

Careful players will realize that the numbers of lines on path B are increasing faster than the path A which would only mean that path B had become the shortest path.

In time all of the players will realize the fact that path B became the shortest path after the obstacle.

Game #3

Let’s add a third path; we’ll call it path C, to the existing game:

20190425_134223.jpg

At least one player will be curious and try the path C. Just like the previous games, within time players will realize that the lines from path C increase faster than the other two. Hence players slowly understand that the path C is the shortest one among those three.

Best H&G Players: Ants

In the beginning I mentioned that ants taught us how to find the shortest paths. Back in 1992 a scientist named Marco Dorigo was researching the behaviors of ants. Dorigo soon discovered that ants choose particular paths from their nests to the food supplies.

Assume the map of a nest and a food supply looks like the following:

20190425_134722.jpg

And assume that ants start using the following path:

20190425_134732.jpg

Pheromone: A chemical secreted by an animal that shapes its social behavior. For instance ants leave this chemical with their footprints which can be traced by other ants.

Ants are in the search of pheromone when they decide their paths between their nest and food supply. If there are more ants on a path, there will be more pheromone. This will cause more ants to use that particular path. Here, pheromones are just like our pen marks:

20190425_134741.jpg

Let’s add an obstacle to the path:

20190425_134803.jpg

At first some of the ants will use the path I as others use the path II:

20190425_134821.jpg

Since path I is shorter than the path II, after some time there will be more pheromone on path I. This is why ants will abondone path II will choose to use path I in the long run:

20190425_134832.jpg

Ant Colony Optimization Algorithm (ACOA)

Modern people are impatient: They need to run their things in the fastest way, in the shortest time. Ant Colony Optimization Algorithms help people a lot for this cause. And this algorithm’s logic comes from the method ants use in order to find the shortest path.

Quicktron-Alibaba-warehouse
A warehouse of Alibaba where robots share a workspace.

For instance ACOA is crucial for robotic moves. Robots imitate ants when they learn how to move from one place to another. If there are a decent number of robots in a workspace, ACOA helps robots to avoid collisions.

M. Serkan Kalaycıoğlu

Real Mathematics – Life vs. Maths #2

Matches

For thousands of years people tried find a precise value for the number π (3,1415192…). At first this special number was thought to be seen only when there is a circle around. Within time π started to appear in places where scientist didn’t expect it to be. One of them was an 18th century scientist Georges Buffon.

Buffon came up with a probability problem named “Buffon’s needle problem” in 1777 when he came across with the number π. As I didn’t possess that many needles, I modified the problem as “Serkan’s matches problem”.

Buffon’s Needle Problem: Take a piece of paper and draw perpendicular lines on it with specific amount of space between them. Buffon wondered if one can calculate the probability of a needle that will land on one of the lines.

To start Serkan’s matches problem you need at least 100 matches, a piece of empty paper, a ruler, pen/pencil and a calculator.

First of all, draw perpendicular lines with 2 matches-length spaces between them.

Then just throw the matches on the paper randomly.

img_4648

Start collecting the matches which land on a line. At last you should use your calculator to divide the total number of matches to the number of matches landed on a line.

In my experiment out of 100 matches, 32 of them landed on a line. That gave me 3,125 which is close to the magical number π.

img_4651

In fact, 100 matches are not enough for this experiment. In my second try 34 matches landed on one of the lines which gave 100/34=2,9411… Obviously this is not close to π. More matches we use, closer we will get to π.

In an experiment back in 1980 2000 needles were used to analyze Buffon’s needle problem. Result was 3,1430… which is seriously close to the number π.

pi1000-e1536927416822

You could go to https://mste.illinois.edu/activity/buffon/ and use this simulator which uses 1000 needle. In my first try I got 3,1496… You should try and see the result yourself.

In the future I will be talking about why a needle (or a match) is connected to the number π.

One wonders…

Try to do your own experiment and repeat Buffon’s needle problem for five times. Take the arithmetic average of your solutions and see how close you are to π?

M. Serkan Kalaycıoğlu

Real Mathematics – Life vs. Maths #1

Circle-Match Relationship

Mathematics is a language we use to explain the event that occur in nature. Mathematicians (good ones though) are in a way masters of this language. They possess crucial abilities such as seeing things others can’t see and finding connections between things that seem unrelated with one another.

Contrary to popular belief “knowing mathematics” doesn’t only mean knowing how to make calculations or being good with numbers. A mathematician ought to point out and explain the relationship, symmetry and pattern… In places you wouldn’t even imagine mathematics could exist!

For instance it is possible to use mathematics and find a connection between a circle and a match.

Circle

Let me start with circle. Any straight line segment that passes through the center of the circle with its endpoints lie on the circle is called a diameter of the circle. And in any circle the shortest distance between its center and boundary is called a radius of the circle. A radius is half the length of a diameter.

To draw a circle with a compass is not that hard. Distance of the openness of the compass gives the radius. If one opens a compass with 3 cm, he/she will draw a center that has radius 3.

Circumference of the circle above is roughly 18,85 cm. Let’s use a calculator to find the relationship between the diameter and circumference of this circle.

img_4642

18,85/6=3,141666666…

Now let me use a cup. This cup’s mouth is in a circle shape and its circumference is about 25,8 cm.

Its diameter is about 8,2 cm. Now let’s divide the circumference with its diameter:

img_4639

25,8/8,2=3,14634146…

In both examples ratio of circumference of a circle to its diameter is roughly 3,14. This is not a coincidence; humans realized this connection more than 4000 years ago.

Brief History of the Mysterious Number

2000 BC: Humans thought that this ratio as 3. According to the Rhind papyrus from ancient Egypt it was 3,16045.

250 BC: Ancient Greek Archimedes calculated this ratio’s average as 3,1418.

800 BC: Al-Khwarizmi calculated the ratio as 3,1416 which was a better approximation than Archimedes’.

Mathematicians didn’t stop attempts for thousands of years. In 1874 William Shanks found the first 707 digits of this ratio. Unfortunately he made a mistake on the 528th digit. Nevertheless it was a huge accomplishment to find this ratio’s first 527 digits correctly.

In 1949 computers took over the mission. A computer found this ratio’s first 2000 digits correctly.

pi2000

I tried it find if I could find the number “1907” (the year when my favorite team was founded) inside those 2000 digits. It was a success.

In the 18th century Leonhard Euler who is known as one of the greatest mathematicians of all times gave this ratio its name and symbol: π.

Transcendental

In 1882 a German scientist named Ferdinand von Lindemann proved that the number π is transcendental.

According to great German philosopher Immanuel Kant a transcendental knowledge is not real; it exists only in our minds. Majority of the mathematicians agree that this word defines the number π perfectly.

In other words the number π can’t be shown as the ratio of any two rational numbers.

Also in the decimal presentation of the number π continues without any repetition… Forever!

This means that every number combination can be found inside the number π. From your birthday to your elementary school number, everything is inside the number π. All you need to do is to continue calculating its digits.

Find Your π Day

This website is created by Wolfram. Using its searching engine you can find at what digit your birthday sits inside the number π.

I checked Leonhard Euler’s birthday and found the following:

eulerpi

Try and see yourself. It is astonishing to see your birthday inside the number π.

M. Serkan Kalaycıoğlu

Real Mathematics – Life vs. Maths #6

Chemotaxis

The word itself sounds like a taxi application for smart phones, and that is not a bad metaphor for its true meaning: Chemotaxis is the movement of cells (or organisms) towards a source of a chemical gradient. This chemical gradient could either be good for the organism or bad for it.

If there is a chemical gradient in an environment that is good for the organism, it would move towards that environment. If the chemical gradient is bad for the organism’s life, it would move away from that environment. These movements are called Chemotaxis.

According to the illustrations red matter is bad, blue is good for the organism.

Random Path

In the previous article I talked about one-dimensional biased random walks. Now let’s use all our knowledge to create a two-dimensional biased random walk.

There were four possible outcomes for two-dimensional random walk: Up, down, right and left. Each and every one of these outcomes has the same probability that is ¼. That means taking one step in any of those directions have the same probability. In order to create a two-dimensional biased random walk let us keep the probabilities same but change the number of steps taken for right and upward directions.

Up: ¼ probability, 2 steps.

Down: ¼ probability, 1 step.

Right: ¼ probability, 2 steps.

Left: ¼ probability, 1 step.

This change will give biased results. If one would take N random steps under these conditions, that person will likely end up at a point which is located up-right hand side of the origin:

To illustrate a two-dimensional biased random walk I rolled a 12-sided dice 10 times (1-2-3 upwards, 4-5-6 downwards, 7-8-9 right, 10-11-12 left).

As seen in the pictures a two-dimensional biased random walk and Chemotaxis are essentially same with one another. If there was a food source for an organism on the up-right hand side of the origin, that organism would make movements as shown in the picture.

Now let’s analyze these illustrations:

On left we are looking at a random walk of an organism without any chemical presence in the environment. On right blue dots are food sources for the organism, which is why the organism is moving randomly towards where those blue dots are dense. If the food source is denser on the up-right, organism will make random movements towards that area.

This is a real life example for the biased random walk. Let’s get more real though.

Dive and Tumble

E. coli is a type of bacteria that could be fatal in some cases. Sugar is one of its main nutritional sources. This is why E. coli bacteria choose to move randomly towards areas where there is sugar. This makes E. coli a biased random walker.

shutterstock_487315975

There are organelles that look like whips on E. coli bacterium. These organelles (or propellers) help E. coli to move in two ways. Whenever these propellers are lined in the clockwise direction, they make bacteria to move forward, like swimming or diving. And whenever the propellers rotate counter-clockwise direction the bacteria makes a tumble that helps to change direction. Hence we call the two fundamental movements of E. coli dive and tumble.

E. coli uses dive and tumble in order to survive, and these movements are in fact biased random walks.

E. coli bacteria will always make random movements toward the sugar if there is some in an environment.

Conclusion

Even one-cell organisms that have no brains use mathematics for their survival.

Then, how is it still possible to see the smartest known creatures (humans) claim that they don’t need mathematics in their lives?

Human beings must use mathematics in order to understand the events that are occurring around them. Because mathematics is the only language we use for to explain those events.

Now that you are aware of this fact, try to find the mathematics behind the things that are happening around you. (Mighty Google at work!) Don’t hesitate to contact me in case you have questions. I’ll be glad to assist you.

For Those Interested In Random Walks: Random Walks in Nature

Brownian Motion: It is the random movement of particles in a fluid that are colliding with other atoms/molecules inside the very same fluid.

Robert Brown is the first person whom observed this sort of movement. In 1827, he was working with pollens and he observed that they are constantly and randomly moving inside the water. But he was not able to explain the reason behind the movement. It was Albert Einstein whom explained this phenomenon in one of his 1905 papers. (Click here to see Brownian movement.)

dust-particles-air-conditioner-depth-footage-011895151_prevstill

One of the easiest and most observable real life examples for Brownian motion is the movements of dust particles. Try it with some light in a dark room; you will be mesmerized with their random dance. The reason behind this movement is that the dust particles are actually colliding with invisible air atom&/molecules. You could imagine dust particles as ping pong and air molecules as racket. As you can see Brownian motion can be observed both in liquid and in gas.

M. Serkan Kalaycıoğlu

Real Mathematics – Life vs. Maths #5

Drunkard’s Way Back Home

Finally we are back with Steve the accountant. So far I’ve talked about one dimensional random walk in order to understand drunkard’s walk. Although we are all aware of the fact that right and left are not the only options when we take a walk.

That is why Steve’s walk should be thought in two dimensions.

There are four choices of movement in a two-dimensional plane: Right, left, up and down. They all have same probability (just like in one dimension). It is ¼. These four directions are familiar to us as we already learned about Cartesian coordinates. In the end Steve’s walk turned out to be a walk in Cartesian coordinates. Let me choose origin of the coordinate system as Steve’s starting point. For the first random step there will be these four options:

To facilitate Steve the accountant’s walk, one could use a 12-sided dice. When it is thrown:

Take your step upwards for 1-2-3,

take your step downwards for 4-5-6,

take your step to right for 7-8-9,

and take your step to left for 10-11-12.

IMG_6524

Q: How far from the starting point one would be after taking N random steps in a two-dimensional plane?

Answer to this question is same with one-dimensional random walk: After N random steps in two dimensions, one would be √N steps away from the starting point. That is same as imagining a circle that has its center at the origin (starting point) and has the radius √N. A two-dimensional random walk would likely end in this circle.

çember
After taking 20 steps, one would be in this area. (I took √20 as 5.)

Recall that for one-dimensional random walks we found three conclusions. Third one was saying that we are likely to be back to the starting point if N is large enough of a number. Same conclusion can be made for two-dimensional random walks too; the more steps we take, the most likely we would be close to the starting point.

“A drunkard will find his way home, but a drunken bird may get lost forever.”

Shizou Kakutani

This result shows that Steve the accountant will likely make circles and return to his starting point. But he will eventually reach his home.

Let me take this one step further: If Steve the accountant’s walk is long enough he would have visited all the streets in his neighborhood. This is why we say two-dimensional random walks are recurrent just like one-dimensional ones. But if we go into three dimensions, things change. A three-dimensional random walk is not recurrent which is why it is possible to get lost in 3-D.

güzergah
If Steve was taking his walk in this district, he would visit each and every street if his walk is long enough.

Biased Random Walk

We already know that in one-dimensional random walk there are two choices with equal probabilities: Right (1/2) and left (1/2).

Q: How can we find a one-dimensional random walk that is biased?

For such a random walk I can keep the probabilities of right or left unchanged. But I’ll arrange the number of steps taken. What I mean is that whenever we get a right; let’s take two steps instead of one but for a left we continue to take one step. Outcome used to be +1 or -1 for a step. Now it is either +2 or -1.

This is how a biased one-dimensional random walk can be created.

The reason this random walk is biased is that after taking N random steps, one will most likely be on the right side of the starting point. We can test that with a coin toss like we did in previous articles: Tails are +2, heads are -1.

After 10 coin tosses my path turned out to be as follows:

One wonders…

You make your own experiment with a coin and compare your results.

Ps. It is not over yet. To be continued…

M. Serkan Kalaycıoğlu

Real Mathematics – Life vs. Maths #4

Where am I?

Mathematicians love to make generalizations. Personally I don’t enjoy that either, but generalizations are very useful in case you’d like to make some mathematical magic. Is there anything cooler than magic?!

Let’s assume (beware of the generalization that is coming towards you) that we had taken N random steps in one dimension. Even though it is very small there still is a possibility that those steps could well be taken into the right hand side (or left). That would have meant that after N random steps, we are standing at +N (or –N). In this case we understand that we are N steps away from the starting point.

 

If we take half of the N random steps to the right, and other half to the left hand side we would be standing right on the starting point. In that case we would be 0 steps away from the starting point.

IMG_6504

These two scenarios are the furthest (N steps) and closest (0 steps) destinations to the starting point after N random steps are taken. Thus, we are finally aware of the fact that after N random steps in one dimension, we have to stop at 0 to N steps away from the starting point.

Q: Is there an algorithm to find out how far we would be to our starting point even before we take a certain number of random steps in one dimension?

For N random steps the answer is the square root of N. For instance if we take 100 random steps in one dimension, we would be √100 = +/- 10 steps away from the starting point.

Click here to learn why it is so.

Now you are wondering: Where and how can we use this information in life?

Place of The Basketball Team

There are 16 teams participating in the Euroleague, which is the most prestigious tournament of Europe. In the regular season of the Euroleague teams get to play with one another twice. In the end of the regular season top 8 teams advance into the playoffs where champion of the season is decided.

yuro
2018-19 regular season is still underway.

Let’s assume that you are supporting a team that is average which means your team would like to fight for the top 8 positions. Just before the season starts you look at the calendar and try to guess how many games your team could win in order to stay in this fight: “If we beat Barcelona at home, and Darüşşafaka on both games…”

You really don’t have to do that. Obviously I will show you how you can use mathematics in order to guess how many wins your team should get.

There are two possible outcomes for a basketball game: Win or lose. It doesn’t matter how strong your opponent is, a game will have two outcomes whatsoever.

Similarities with Random Walks

In one dimension we know that there are two outcomes for a random walk: Right or left. And this is why basketball games can be treated as a random one dimensional walk.

In the regular season each team will play 15×2=30 games. This is same as taking 30 random steps in one dimension.

Then the difference between win and loss column after 30 games can be calculated with taking square root of 30.

√30 = 5,47…

We will call it 6 games. Outcome of these 6 games depend on luck. Your team can win or lose each and every one of them. It proves that after 30 games you either won 6 games more than you lost, or you lost 6 games more than you won:

IMG_6506

Conclusion

This information we found using one dimensional random walks tells us that if a team wins between 18 to 12 games in the regular season, that team will be fighting for the playoff positions.

 

These pictures show how two previous regular seasons ended in the Euroleague. As you can see teams that won between 18 to 12 games fought for a playoff spot.

One Wonders…

Try to apply what you learned for one dimensional random walks to a football team that is participating among 18 teams. If it is an average team, what kinds of predictions can you make for the team?

Don’t forget to include the third possibility: Win, lose or draw.

Ps. I didn’t forget about Steve the accountant. We are slowly heading towards the answer.

M. Serkan Kalaycıoğlu

Real Mathematics – Life vs. Maths #4 (Extra)

Q: Is there an algorithm for us to use in order to guess where a one dimensional random walk could end?

Let’s say we took N random steps in one dimension. I have to assign something for these steps so that we can distinguish each and every one of the steps. I’ll call the first step a1. In this case I can call;

second step: a2,

third step: a3,

forth step: a4,

Nth step: aN.

In the previous article I’ve mentioned that there are two possible values for every step: +1 or -1. I’ve also said that probabilities of these values are equal to each other and precisely ½. Now I can use all this information to calculate the average value each random step has.

In order to do that I can use arithmetic mean: Add both numbers together and divide the total into two. Let me show the arithmetic mean of a1 as <a1>. Then we get the following result:

IMG_6511

Average value of a random step in one dimension is 0.

<a1> = 0

<a2> = 0

<a3> = 0

<aN> = 0

Summation of all the average values of N random steps would show us how far we are from the starting point. Let u be the distance from the starting point after N random steps. Then:

u = <a1> + <a2> + <a3> + … + <aN> = 0 + 0 + 0 + … + 0 = 0.

This result says that after taking N random steps in one dimension we should expect to stop at the starting point. This is a paradox because even if it is very small there is a possibility that all N steps could have the value (for instance) +1. In that case u would be +N. But our math shows us that if we increase the number of steps we would eventually end up at the starting point.

More Beautiful Mathematics Needed

This answer is not pleasing to neither to us nor to the mathematicians whom are dealing with this problem. Because 0 is only one of the many possibilities: Not the only possibility.

It would be better if we found an interval for the answer. We can use mathematical manipulations to achieve that.

Two possible outcomes for each step is either +1 or -1 and we just assigned a1 to the value of first step. Let me take the square of a1: It will be +1 in both cases. If I take the square of every one of them:

a12 = 1

a22 = 1

a32 = 1

aN2 = 1

Distance from the starting point was assigned to u. Now let’s square u. It will be a relatively long equation as follows:

u2 = (<a12> + <a22> + <a32> + … + <aN2>) + 2 (<a1a2> + <a1a3> + <a1a3> + … + <a1aN> + <a2a3> + … + <a2aN> + … )

First part of the equation makes N.

All the terms in the second part of the equation are equal to each other. That is why it will be enough if I calculate only one of the terms. Let me first calculate a1a2 so that I can take its average and find <a1a2>:

As you can see from the picture second part of the equation makes 0. Then square of the distance from the starting point is u2 = N. Take square root of both sides and we get our answer: +√N and -√N.

This result means that after taking N random steps in one dimension, one would stand at any point between +√N and -√N. For instance if one takes 100 random steps in one dimension, that person would be √100 = +/- 10 steps away from the starting point.

M. Serkan Kalaycıoğlu

Real Mathematics – Life vs. Maths #3

Drunkard’s Walk Back Home

Steve the accountant finished another working week. He usually spends his weekends in peace. But this specific weekend was different: He was supposed to meet his old college mates whom he hasn’t seen for ages. That night they talked about old days, laughed and drank until morning. Steve the accountant has never been a heavy drinker. At the end of the meeting even though he was barely standing he insisted that he can walk back to his home by himself.

indir (11)

Steve the accountant started walking in random directions: “This street looks familiar… Oh that building looks just like mine…”

Q: Can a drunkard make his way home using a random walk?

Random Walk in One Dimension

I have to talk about random walk in one dimension before I answer the fate of Steve the accountant. In one dimension walking path is something we are familiar since we are kids: The number line.

There are two directions on the number line: Right and left.

Rules:

  • In one dimension one step to right means +1, one step to left means -1.
  • Let’s assume that the probability of choosing right and left is same.
  • Because of the previous assumption taking a step towards right or left has the probability of ½.

IMG_6486

Now let’s draw a number line and choose zero as the starting point. First step can be taken towards +1 or -1. Their probabilities are equal: ½.

Taking two steps at once will be a little bit more complicated than taking one step. After taking only one step we concluded that there can be only two possibilities: +1 and -1. But when we try to take two steps at once, there will be four possibilities:

0 -> +1 -> +2

0 -> +1 -> 0

0 -> -1 -> -2

0 -> -1 -> 0.

IMG_6488

In every possibility, probability will be equal: ¼.

After the second step, we may be standing on either one of +2, 0 or -2 with probabilities ¼, 2/4 and ¼ in order.

How about three steps?

We already know what the probabilities are after two steps. According to our findings third step can start either at +2, 0 or -2.

  • If we take our step from +2, we can go to +3 or +1. Their probabilities will be half of the probability of +2. Hence it will be 1/8 each.
  • If we take our step from -2, we can go to -3 or -1. Their probabilities will be half of the probability of -2. Hence it will be 1/8 each.
  • If we take our step from 0, we can go to +1 or -1. Their probabilities will be half of the probability of 0. Hence it will be 2/8 each.

IMG_6489

Our calculations show that after the third step we could stand on:

+3 with the probability of 1/8.

-3 with the probability of 1/8.

+1 with the probability of 1/8 + 2/8 = 3/8.

-1 with the probability of 1/8 + 2/8 = 3/8.

In case we continue using the same logic, fourth and fifth steps would look like the following:

After 100 steps, final position and its probability is shown as follows:

image002-e1545564192978.png
Coming back to your starting point (which is zero) has the highest probability.

So far we can make these conclusions about a random walk in one dimension:

  1. When we take even number of steps, we stop on an even number. When we take odd number of steps, we stop on an odd number.
  2. As we increase the number of steps probability of stopping around the starting point gets higher.
  3. Previous argument indicates that if we take more steps, probability of returning to the starting point will increase as well.

Game of Random Walk in One Dimension

So far we understood that a random walk in one dimension has two possible outcomes. In order to simulate a one dimensional random walk we can use coin toss since there are only two possible outcomes for a coin toss: Heads or tails.

502907-3-4-24aa2

If we have a fair coin, probability of getting heads or tails will be equal to each other: 1/2. Then let’s assign tails to -1 and heads to +1.

  1. Toss a coin 10 times. Where did you finish your random walk?
  2. Do the same thing for 30 times and compare your result with the previous one.

I could hear you saying: “What about Steve the accountant?”

A little bit of a patience. We’ll get there in the upcoming articles.

M. Serkan Kalaycıoğlu