Header tag

Tuesday, 12 March 2019

Maths Puzzle: 1/a + 1/b + 1/c = 1

Another quick puzzle from Math E Magic (by Raymond Blum, Adam Hart-Davis, Bob Longe and Derrick Niederman).

"Find three distinct integers, a, b and c, such that 1/a + 1/b + 1/c = 1".


Firstly:  does one of 1/a, 1/b or 1/c have to be 1/2?


Yes.  Without 1/2, the largest number we can obtain is 1/3 + 1/4 + 1/5 = 47/60 (0.78333).  So the first number has to be 2.


Now, what do we obtain by trying 1/2 + 1/3 + 1/4 (the next simplest solution)?

Answer:  13/12.  So we're going to need something a little smaller.  1/2 + 1/4 plus anything else is going to be too small, so we'll progress with 1/2 + 1/3.


1/2 + 1/3 = 5/6, which immediately highlights the simple solution, that 1/2 + 1/3 + 1/6 = 1, since 1/2 = 3/6 and 1/3 = 2/6.

Other answers (if the integers don't have to be distinct) is 1/2 + 1/4 + 1/4 = 1, or the almost trivial 1/3  + 1/3 + 1/3 = 1.  Yes, I know.  Boring :-)

This was in the trickier section of the Mathemagic book, and it appealed to me as it can be solved by logic and reason, instead of pure trial and error (which, in my view, is what "hard" sometimes means in maths puzzle books :-) )

A few other articles in the Mathemagic Series:

Arrange nine coins into ten straight lines
Solve 1/a + 1/b + 1/c = 1  for unique a, b, c
Solving Magic Triangles
and the slightly more complex Magic Hexagons

If you've found this puzzle interesting, can I recommend some of my other posts which have a similar theme?

Snakes and Ladders (the Collatz Conjecture)
Crafty Calculator Calculations (finding numerical anagrams with five digits)
More Multiplications (finding numerical anagrams, four digits)
Over and Out (reduce large numbers to zero as quickly as possible)
Calculator Games: Front to Back
Calculator Games: Up, up and away with Ulam sequences
Calculator Games: The Kaprekar Constant

Sunday, 10 March 2019

Maths Puzzle: Square Inheritance: a2-b2 = b2-c2

Here's the next question in the Math-E-Magic series of puzzles and problems.  This question is taken from the harder section towards the back of the book (I was breaking us all in gently with my previous posts).  I'll paraphrase the problem text, which is taken from "A Square Deal," on page 190.

A man has a piece of land he wants to leave to his three children.  To his first child, he leaves an L-shaped piece of land, comprising the whole plot except a square that has been cut out of the north-east (top-right) corner.  To his second child, he leaves this middle section, except for a smaller square that is taken from the corner of the plot - this smaller square goes to his third child.

The first child gets the area shown in yellow; the second child gets the area shown in pink, and the third child gets the area shown in blue.  The squares have sides a, b and c, as shown.  The diagram is not to scale.
The one constraint is that the first two children must receive land which has the same total area.  There are many solutions to this problem, but the question is: can you identify the simplest solution with the smallest numbers for the sides a, b and c?

Firstly, let's express the question mathematically:

The first child receives the area a2 - b2.  The second child receives the area b2-c2.  These two areas are the same, hence a2 - b=  b2-cand we must exclude the obvious b=0 and a = -c.

Trial and error will work here, but there are a number of tips that you can use to find one solution.  Notice that Pythagorean triples (a2 + b=  c2) are no help; we're solving a different puzzle here.

Tip:  a and b are going to be closer together than b and c.  Rearranging our puzzle expression a2 - b=  b2-c2  gives us a2  =  2b2-cand if a2 > 2b2 then there is no solution; b must be greater than a/2.

Starting with the simplest numbers (as suggested in the question), I found a solution:  a = 7, b = 5 and c =1, which has the convenient feature of probably being the simplest since c=1.

7*7 - 5*5 = 49 - 25 = 24
5*5 - 1*1 = 25 - 1 = 24

QED

With these values, the two children get an area equal to 24 square units,while the third child gets the remaining one square unit.  Total = 24 + 24 + 1 = 49.

Having found my own solution, I checked the answers in the book.  Interestingly (and controversially) the Math-E-Magic answers section has this to say:

"The proper dimensions are as shown [a = 14, b= 10, c=2].  There is no solution if the smallest square is only one mile on each side.  There is however, a solution where the smallest square has a side of two.  THe plots of the second and third child each measure 96 square miles, and the total are of the father's plot was 196 square miles."


Interestingly, the authors overlooked the simplest solution I found, in the same way as I overlooked theirs.  I'll get in touch with them and let them know :-)  Also, it's worth noting that my solution (a=7,b=5,c=1) is obtained by halving their solution (a=14,b=10, c=2) - this applies to all integer multiples (a=21, b=15, c=3 is another solution, as is a=28, b=20, c=4, and so on).

Here's a list of the solutions that I identified - it's not exhaustive, but it's what I could find in about 30 minutes of trial and improvement:


a=7, b=5, c=1 (the simplest), and all other multiples of these (14,10,2;  21,15,3; 28,20,4, etc.).
a=17,b=13,c=7
a=23,b=17,c=7


Two final notes on my solutions:

- In their simplest form, all of the variables are prime numbers.  This could be just coincidence, but I've not found a solution which contains non-prime numbers (in the simplest form).
- I was very surprised (although I probably shouldn't be) to find two solutions with c=7.






Wednesday, 6 March 2019

Analysis is Easy, Interpretation Less So

Every time we open a spreadsheet, or start tapping a calculator (yes, I still do), or plot a graph, we start analysing data.  As analysts, it is probably most of what we do all day.  It's not necessarily difficult - we just need to know which data points to analyse, which metrics we divide by each other (do you count exit rate per page view, or per visit?) and we then churn out columns and columns of spreadsheet data.  As online or website analysts, we plot the trends over time, or we compare pages A, B and C, and we write the result (so we do some reporting at the end as well).
Analysis. Apparently.

As business analysts, it's not even like we have complicated formulae for our metrics - we typically divide X by Y to give Z, expressed to two decimal places, or possibly as a percentage.  We're not 
calculating acceleration due to gravity by measuring the period of a pendulum (although it can be done), with square roots, fractions, and square roots of fractions.

Analysis - dare I say it - is easy.

What follows is the interpretation of the data, and this can be a potential minefield, especially when you're presenting to stakeholders. If analysis is easy, then sometimes interpretation can really be difficult.

For example, let's suppose revenue per visit went up by 3.75% in the last month.  This is almost certainly a good thing - unless it went up by 4% in the previous month, and 5% in the same month last year.  And what about the other metrics that we track?  Just because revenue per visit went up, there are other metrics to consider as well.  In fact, in the world of online analysis, we have so many metrics that it's scary - and so accurate interpretation becomes even more important.


Okay, so the average-time-spent-on-page went up by 30 seconds (up from 50 seconds to 1 minute 20).  Is that good?  Is that a lot?  Well, more people scrolled further down the page (is that a good thing - is it content consumption or is it people getting well and truly lost trying to find the 'Next page' button?) and the exit rate went down.  

Are people going back and forth trying to find something you're unintentionally hiding?  Or are they happily consuming your content and reading multiple pages of product blurb (or news articles, or whatever)?  Are you facilitating multiple page consumption (page views per visit is up), or are you sending your website visitors on an online wild goose chase (page views per visit is up)?  Whichever metrics you look at, there's almost always a negative and positive interpretation that you can introduce.


This comes back, in part, to the article I wrote last month - sometimes two KPIs is one too many.  It's unlikely that everything on your site will improve during a test.  If it does, pat yourself on the back, learn and make it even better!  But sometimes - usually - there will be a slight tension between metrics that "improved" (revenue went up), metrics that "worsened" (bounce rate went up) and metrics that are just open to anybody's interpretation (time on page; scroll rate; pages viewed per visit; usage of search; the list goes on).  In these situations, the metrics which are open to interpretation need to be viewed together, so that they tell the same story, viewed from the perspective of the main KPIs.  For example, if your overall revenue figures went down, while time on page went up, and scroll rate went up, then you would propose a causal relationship between the page-level metrics and the revenue data:  people had to search harder for the content, but many couldn't find it so gave up.


On the other hand, if your overall revenue figures went up, and time on page increased and exit rate increased (for example), then you would conclude that a smaller group of people were spending more time on the page, consuming content and then completing their purchase - so the increased time on page is a good thing, although the exit rate needs to be remedied in some way.  The interpretation of the page level data has to be in the light of the overall picture - or certainly with reference to multiple data points.  


I've discussed average time on page before.  A note that I will have to expand on sometime:  we can't track time on page for people who exit the page.  It's just not possible with standard tags. It comes up a lot, and unless we state it, our stakeholders assume that we can track it:  we simply can't.  


So:  analysis is easy, but interpretation is hard and is open to subjective viewpoints.  Our task as experienced, professional analysts is to make sure that our interpretation is in line with the analysis, and is as close to all the data points as possible, so that we tell the right story.

In my next posts in this series, I go on to write about how long to run a test for and explain statistical significance, confidence and when to call a test winner.

Other articles I've written on Website Analytics that you may find relevant:

Web Analytics - Gathering Requirements from Stakeholders

Monday, 4 March 2019

Maths Puzzle: Sugar Cubes (orders of magnitude)

Continuing the current series of puzzles taken from Math-E-Magic, here's one which tests understanding of orders of magnitude.

Sugar Cubes
The Big Sugar Corporation wants to persude people to use lumps of sugar, or sugar cubes; so they run a puzzle competition and the first person to achieve correct answers to all three questions wins a lifetime supply of sugar.  It's not the healthiest competition, but here we go.

You have been sent one million cubes of sugar; each cube is just half an inch long, wide and high.

1.  Suppose the 1,000,000 sugar cubes arrive packed into one giant cube.  Where would you store it?  Garage? Warehouse? Under the table?

2.  Suppose you lay the 1,000,000 sugar cubes out on the ground in a single square layer.  How much area would you need?  A tennis court?  A football field?  An entire car park?



3.  Suppose you stacked the sugar cubes (if you were able to play this sweet Jenga) into a single tower 1,000,000 cubes high.  How far would it reach?  As high as a house? Skyscraper? Mountain?  To the Moon?

Let's do some maths.

1.  If we form a cube from the little sugar cubes, then each side of the cube will need to be the cube-root of 1,000,000 cubes long.  The cube root of a million is 100, since 100 cubed = 100 x 100 x 100 = 1000000

Each cube is a quarter of an inch long (we started in imperial measurements, so we'll stay there for now), and since 100 x 0.25 = 25, then the cube will be 25 inches long, wide and high.  Under the kitchen table will do fine.  (25 inches is approx. 60 cm.).

2.  To form a square from the sugar cubes, each side will have a length equal to the square root of 1,000,000 and that's 1,000.  1,000 x 0.25 inches = 250 inches, or nearly 21 feet.  A square with sides of 21 feet would fit into a medium-sized garden, or about six car park spaces.  A tennis court is 27 feet wide (for singles) and 63 feet long, so it would fit comfortably in half of a tennis court (from the baseline to the net).  In fact, the service line (the area which marks the two service boxes) is exactly 21 feet from the net and parallel to it.

3.  One million sugar cubes, eventually stacked one on top of the other, would be 250,000 inches (a quarter inch multiplied by a million).  250,000 inches is 20,800 feet, or 6,944 yards, which is just under four miles.  That won't reach the moon (250,000 miles away), it's more like a small mountain.

Gobally, the top 100 mountains are all above 23,000 feet, but we are still talking around the scale of a mountain.

The highest mountain in the UK is Ben Nevis, which stands at 4,411 feet.
The tallest in Europe is Mount Korab in Albania, which is 9,068 feet.
Sugarloaf Mountain in Brazil is 15,000 feet (396 metres).
Our sugar mountain, at 20,800 feet, is certainly a respectable mountain.


--

Incidentally, if you were (in some way) able to stack the sugar cubes at the rate of one a second for a million seconds, that would be 277 hours, or 11.5 days.  If you stacked them at the rate of one a minute (which it may be as you start climbing an adjacent mountain), then you'd be going for almost two years.

Other articles in the 'A Puzzle A Day' series:

Three Horse Race
How Old is Aunt Tabitha
Big Ben Strikes Twelve

Thursday, 28 February 2019

Maths Puzzle: Cookie Jars

These puzzles are the second batch I'm taking from Math-E-Magic by Raymond Blum, Adam Hart-Davis, Bob Longe and Derrick Niedermann.  The first was a geometric question; these are based on algebra.
These puzzles are entitled Cookie Jar and Fleabags, but they are very similar to a wide range of puzzles (typically related to the relationships between people's ages).

Cookie Jar
Joe and Ken each held a cookie jar and had a look inside them to see how many cookies were left.  

Joe said, "If you gave me one of yours, we'd both have the same number of cookies."
Ken replied, "Yes, but you've eaten all of yours - you have none left!"
How many cookies does Ken have?

This is a relatively straightforward puzzle, helped by the fact that Joe has zero cookies, and there's only one other constraint - if Ken gives Joe a cookie, they'll have the same number (one).  So, if Joe will have one cookie after the transaction, then so will Ken.

But that isn't the answer.  We have to remember that Ken has one cookie after the transaction, but that he also had the one he would give to Joe - so he has two.


Fleabags

Two shaggy old dogs were walking down the street.
Captain sits down and says to Champ, "If one of your fleas jumped onto me, we'd have the same number."
Champ replies, "But if one of yours jumped onto me, I'd have five times as many as you!"
How many fleas are there on Champ?


This one is going to take a little more work - and we can use algebra to help solve it.


Let's have the number of fleas on Captain as A, and the number of fleas on Champ as H (taking the second letter of the two dogs' names).

If one flea jumps onto Captain, he will have A+1.  And if that flea has come from Champ, then he will have H-1.  And these numbers are the same, so A+1 = H-1  (1)


Now, if one flea jumps from Captain, he will have A-1.  And this number is five times greater than Champ's new total H+1.  So 5(A-1) = H+1    (2)

If A+1 = H-1 then A+2 = H (from 1)


And we can use this new value of H in (2), to give us 5(A-1) = (A+2) + 1

Expanding and simplifying:
5A - 5 = A + 3
4A = 8

A = 2

Captain has two fleas.

And since A+2 = H, Champ has four fleas.

A few other articles in the Mathemagic Series:

Arrange nine coins into ten straight lines
Solve 1/a + 1/b + 1/c = 1  for unique a, b, c
Solving Magic Triangles
and the slightly more complex Magic Hexagons

Wednesday, 27 February 2019

Maths Puzzle: Arrange Nine Coins into Ten Straight Lines

This puzzle is taken from Math-E-Magic by Raymond Blum, Adam Hart-Davis, Bob Longe and Derrick Niedermann.  I've owned my copy of this book for a number of years and have referered to it in the past top help with problems I've been working on separately.  More recently, during a few idle moments (when there's not been enough time, energy or enthusiasm to do anything bigger) I've started solving some of the the puzzles it poses.  I've even (horror of horrors) started writing IN the book (but only in pencil).

Here's the first puzzle I looked at:

Nine Coins (page 29)

Wendy got into trouble in her math class.  She was sorting out money she planned to spend after school, and accidentally dropped nine coins onto the floor. The teacher was so upset that she told Wendy to stay at school until she could arrange the nine coins into at least six lines with three coins in each line.  Can you do it?  Wendy did, and in fact she arranged her nine coins into ten lines, with three in each line.  How?
The first question - can you get nine coins into six straight lines, is fairly straightforward, especially if you realise that nine is a square number.  If you arrange the nine coins into a 3x3 rectangle you can achieve six lines (three horizontal and three vertical).  

If you're more careful, you can arrange them into a symmetrical rectangle, or even a square, so that the diagonals form two extra lines, bringing the total to eight.  It's not ten, but it's getting us closer.

Working on the principle of increasing diagonal lines, in order to reach ten straight lines, we need to adapt the central row (or column) of coins so that they can provide the extra lines we need.  By moving the two coins at the end of the central row, we can achieve the addition more diagonal lines - see below...

The new diagonal lines are shown in the paler grey colour. We have lost the vertical lines at the edges of the square, but we have gained four diagonal lines, bring our total up from eight to ten.  The diagram below shows the solution with all ten lines shown:  three horizontal, one vertical, two long diagonals and four short diagonals.



Thursday, 21 February 2019

One KPI too many


Three hypothetical car sales representatives are asked to focus on increasing their sales of hybrid cars for a month. They are a good cross-section of the whole sales team (which is almost 40 sales reps), and they each have their own approach. The sales advisor with the best sales figures for hybrid cars at the end of the month will receive a bonus, so there's a clear incentive to sell well.  At the end of the month, the sales representatives get together with management to compare their results and confirm the winner.


Albert


Albert made no real changes to his sales style, confident that his normal sales techniques would be enough to get him through top sales spot. 

Albert is, basically, our "control", which the others will be compared against. Albert is a fairly steady member of the team, and his performance is ideal for judging the performance of the other individuals.  Albert sold 100 cars, of which 20 were hybrids.


Britney 

Britney embraces change well, and when this incentive was introduced, she immediately made significant changes to her sales tactics.  Throughout the incentive period, she went to great lengths to highlight the features and benefits of the hybrid cars.  In some cases, she missed out on sales because she was pushing the hybrids so enthusiastically.

While she doesn't sell as many cars as Albert, she achieves 90 sales, of which 30 are hybrids.


Charles

Finally, Charles is the team's strongest salesman, and throughout the sales incentive month, he just sells more cars.  He does this by generally pushing, chasing and selling harder to all customers, using his experience and sales skills.  He doesn't really focus on selling the hybrids in particular.

Consequently, he achieves an enormous 145 sales, which includes 35 hybrid sales.   


Let's summarise, and add some more metrics and KPIs (because you can never have too many, apparently...).

Albert Britney Charles
Total car sales 100 90 145
Hybrid car sales 20 30 35
% Hybrid 20% 33.3% 24.1%
Total revenue $915,000 $911,700 $913,500
Revenue per car $9,150 $10,130 $6,300



Who did best?

1. Albert achieved the highest revenue, but only sold 20% hybrid cars.
2. Britney achieved 33% hybrid sales, but only sold 90 cars in total.  She did, however, achieve the highest revenue per car (largely due to sales of the new, more expensive hybrids).
3. Charles sold 35 hybrids - the most- but only at a rate of 24.1%.  He also sold generally cheaper cars (he sold 110 non-hybrid cards, and many of them were either discounted or used cars)

So which Key Performance Indicator is actually Key?

This one is often a commercial decision, based on what's more important to the business targets. Is it the volume of hybrid cars, or the percentage of them? How far could Britney's drop in overall sales be accepted before it is detrimental to overall performance? And how far could Charles's increase in overall sales be overlooked?

Sometimes, your recommendation for implementing an optimisation recipe will run into a similar dilemma. In situations like these, it pays to know which KPI is actually Key! Is it conversion? Is it volumes of PDF downloads, or is it telephone calls, chat sessions, number of pages viewed per visit or is it revenue? And how much latitude is there in calling a winner? In some situations, you won't know until you suddenly realise that your considered recommendation is not getting the warm reception you expected (but you'll start to get a feel for the Key KPIs, even if they're never actually provided by your partners).