# Category Archives: Applications

Real world applications of mathematics

## Percentages for sceptics: part III

I wanted to do some self-criticism of my previous two posts in this series:

1. You can calculate the minimum of responses from a single percentage by hand (no need for computer programmes or look-up tables).
2. I’ve made a very rough model to estimate how many people the program typically returns when fed six percentages (as I did several times here).
In between, I’ve collected some links to demonstrate how great continued fractions can be.

Handy calculations

There are many ways of writing real numbers (fractions and irrationals) apart from in decimal notation. You can represent them in binary, for instance $\pi = 11.001001000011\ldots$, or in other bases. These have their uses: there is a formula to calculate the $n$th binary digit of $\pi$ without calculating all the preceding digits.

For our purposes we will use continued fractions. People write $\pi$ as $[3; 7, 15, 1, 292, 1, 1, 1, 2, 1, ...]$: this notation means that 3 is a good first approximation to $\pi$, the well-known $3+\frac{1}{7}=\frac{22}{7}$ is the closest you can be with any fraction $\frac{p}{q}$ with $q \leq 7$. Then $3+\frac{1}{ 7 + \frac{1}{15}}=\frac{333}{106}$ is the best with $q\leq 106$, and the fourth term

$3+\frac{1}{7+\frac{1}{15+\frac{1}{1}}}=\frac{335}{113}$

is a very good approximation, as the next number in the square brackets, 292, is very large (I’ll motivate this observation at the end of the section). The golden ratio is sometimes called the ‘most irrational’ number because it has a continued fraction expansion with all ones, so the sequence converges slowly.

Filed under Accessible, Applications

## Percentages for Sceptics: Part II

In the first percentages for sceptics post, I showed that, if you are given a percentage, you can work out the minimum number of people to whom you would have to pose a yes-or-no question to be able to get that percentage. Ideally, I hope to add to your scepticism of percentages that are unaccompanied by the number of respondents. It’s easy to be suspicious of nice, round percentages like 10%, 20%, 50% etc., but in fact all but 14 of the whole number percentages can come from polls with 20 or fewer people.

The aim of this post is to take this approach to the next level. After a quick quiz, I’ll go through two examples, the second where I reverse-engineer a pie chart is the cleaner of the two. Don’t get hung up on any of the particulars of the numbers, especially in the dating example, what they are isn’t important, it’s more the fact that we can get them: most of the post functions as a demonstration of the principle.

Warm-up puzzle: A special case

In some survey 22% of people answered “yes”, 79% answered “no” (both to zero decimal places). Each person interviewed chose exactly one of the two options. What is the least number of people that could have been interviewed to get this result? Answer at the end of this post. It’s an on-topic mathematical question, not involving any silly tricks.

Dating data

Let’s take a horrible press release reported as news by the Daily Mail, (commented on by the Neurobonkers blog) under the succinct headline: The dating rule book is being rewritten with one in four single girls dating three men at a time and a third happy to propose.

Given the trivial nature of the survey, alarm bells should be ringing; and the fact that it is ”according to the study by restaurant chain T.G.I. Friday’s” means, like their food, this ‘research’ might best be taken with a pinch of salt.

Filed under Applications, Maths in Life, Puzzle

## Oil tanks and dipsticks

[If you're looking for the partial volume equations of a horizontal oil-tank, this article by Dan Jones has a nice write-up. Of course, you could just get someone to make a dipstick for you. My article only gives an overview of the problem, and how to approach it, from the perspective of a pure mathematician.]

This is the second post about real-life enquiries sent to my maths department, this one from a local engineer. Again, here’s the relevant section of the e-mail, partly to illustrate that, what might not at first seem an engaging problem for a pure mathematician, can turn out to be.

I need to calculate the capacity of a cylindrical tank laid horizontally with domed ends, in order to make an accurate dipstick. I would need to do the calculation several times in order to obtain capacities at varying levels.

This post is about how I went about finding a solution to this problem, and checking how good a solution it was. So now, if you happen to need a dipstick that fits these requirements (or just of a simple cylindrical tank), you can have one precision engineered to order. To continue the barge theme from the previous enquiry, you can also get a dipstick made for your barge’s diesel tank.

Filed under Accessible, Applications, Maths in Life

## All for one and none for all! Diversification, regulation and the tragedy of the commons.

Some proverbs come in contradictory pairs, for instance “Too many cooks spoil the broth” and “Many hands make light work”. I’d like to present an example that I feel illustrates two of these simultaneously. Everyone knows “Don’t put all your eggs in one basket”, including banks, which diversify by holding many different investments of different types. But while it may be in banks’ best interests to lower their levels of risk through diversification, it may plausibly raise the risk of a system-wide failure: if all banks follow that same advice, the rest of us may be “In for a penny, in for a pound”.

This is the argument given by Beale et al. in their paper Individual versus systemic risk and the Regulator’s Dilemma. Here’s a simple example that illustrates the main idea, adapted from a related comment in the earlier paper Systemic risk: the dynamics of model banking system.

Some people are playing a dice game. Each of them rolls a single fair die once and receives £1 for rolling a 1, £2 for a 2, and so on, up to £6 for a 6. However, afterwards they each have to pay £1.50 for the privilege of playing this rewarding game. Each of them starts out with no money, and so if they roll a 1, they go bankrupt.

If you play this game, there’s a $\frac{1}{6}$ chance that you’d go bankrupt on your roll. Let’s say ten people play the game: the chance of all of them going bankrupt on their single throw is $(1/6)^{10}$, which is about one in sixty million.

Filed under Accessible, Applications, Economics

## Cut the rope!

This is a real problem that was sent around my former maths department. The inquirer had a boat, and he wanted ropes of various lengths to knot together to moor his canal barge (I think each rope may have somehow used an eye splice for knotting). This is more or less the e-mail as I received it:

“I have 5 pieces of rope of length:

• 1 x 10 metres
• 2 x 12 metres
• 2 x 40 metres

I want to be able to cut the ropes into pieces of different lengths and to be able to tie combinations of these together to make longer lengths.

Is there a formula to obtain the optimum number and lengths of pieces ropes (i.e. the minimum number of pieces of ropes to give the most possible combinations of lengths of rope!). The minimum length of rope I need is 6m.”

Being more or less a combinatorial problem, I doubted whether any nice formula existed (or that it would be any more useful than a specific solution!). So, wanting to help, I cheated slightly, and chatted to the guy to get a bit more info. After our discussion, he decided that he wanted ropes with at most two knots (ie. three pieces), and to be able to make lengths at intervals of one or two metres. He also was quite keen on having a 20m rope.

I’ve given some additional assumptions and my solution below. But please have a go first: you may come up with a better way of doing it!

Filed under Accessible, Applications

## An inequality for the Consumer and Retail Price Indices

Since 1996, Britain has had two major ways of measuring inflation: but, when explaining the difference between the Retail Price Index (RPI) and Consumer Price Index (CPI), British newspapers typically mention that CPI is (generally) lower because it excludes housing costs, whereas RPI includes them. However, in 2013, the CPI is due to be updated, and may then also take these housing costs into account. This would cause CPI to rise closer to the level of RPI, but you would still expect inflation rates as given by RPI to be higher—why would this remain the case?

Let’s begin with some background. Both indices try to measure the rise in cost of an ‘average’ basket of goods bought by households or consumers across a year, and neither is an attempt to measure the cost of maintaining a minimum standard of living, which depends on how those minimum standards are set. Other methods exist: The Economist uses its partially tongue-in-cheek Big Mac index to double-check consumer inflation measures around the world—here the Big Mac burger is the physical basket of goods.

The Retail Price Index has the longer history—its predecessor is associated with price increases suffered by workers in World War 1—RPI officially began in 1956 (though an interim version started in 1947, after WW2). RPI tries to reflect the spending of the ‘average’ private household: it excludes the top 4% of households by income, and pensioners whose state pensions and benefits make up more than 3/4 of their incomes. It also excludes spending by overseas visitors (for instance university tuition fees paid by foreigners) and those living in institutions such as university accommodation or nursing homes. It also excludes, for instance, stockbroker fees.

The Consumer Price Index, on the other hand, was introduced in 1996 to harmonise inflationary measures across the European Union. For now, it excludes many housing costs such as mortgages, estate agent fees, council tax, as well as costs such as TV licences and trade union subscriptions. It also differs from its sister index in how it deals with car costs: whereas RPI imputes new car prices from those of second hand cars, CPI is obliged to use real data.

However, the most significant difference between the two, known as the formula effect, arises during the early stages of the calculation. The formula effect has contributed at least 0.4 percentage points difference each year since its inception (measured by recalculating each index with the other’s variables). In 2010, it contributed to a difference of 0.8 percentage points, compared with the 0.6 percentage point difference associated with housing costs.

The inequality

Essentially, this difference arises because the CPI uses a geometric mean, while RPI uses the more well-known average, the arithmetic mean. A famous inequality that links these two means, the AMGM inequality, tells us that the arithmetic mean is always greater than the geometric mean (but they will be equal if, and only if, all the numbers averaged are the same).

For a collection of non-negative numbers $x_1, x_2, \ldots, x_n$ we have:

$\frac{1}{n}(x_1 + x_2 + \cdots + x_n) \geq \sqrt[n]{x_1 \cdot x_2 \cdot \cdots \cdot x_n}$ ,

or in more succinct notation:

$\frac{1}{n} \sum_{i=1}^n x_i \geq (\prod_{i=1}^n x_i)^{1/n}$.