Friday, September 27, 2013

About "about"

It doesn't happen often, but every now and then, an American makes his or her way across the border to Canada.  A small portion of those who do come here notices that we sound a little different from them, and a small portion of those who notice has the audacity to say something about it.  Out loud.  Can you imagine?

Here is the most recent example.

The word that tends to epitomize this difference is usually "about", which they claim we pronounce like "a boot", although some say "a boat" is a better reflection of what the word sounds like to an American.  The most common response from Canadians upon hearing this seems to be denial.

Here is the most recent example.

It's an odd response to me, considering how much energy has been spent here trying to justify the border identify differences between the two countries.  Here we have a distinguishing feature, albeit a very small one, that has been noticed by those that we've been trying to distinguish ourselves from, yet we don't want it.  Will we ever be happy?  Probably not.

Of course, those who deny that the "about" sounds the same as either one of the two supposed phrases are right to do so, because they don't actually sound the same.  But given the persistence of this perception, one can't help but wonder if maybe there's something to it.  The easy explanation is "Stupid Americans", because that's the easy explanation for everything.  Why can't I find decent looking clothes come in my size?  Stupid Americans.  Why is math hard?  Stupid Americans.  Who stole the cookies from the cookie jar?  Stupid Americans.

But surely, even if Americans really are stupid, they can't be so stupid as to be unable to tell "about" from "a boot" and/or "a boat."

Part of the denial, I think is just a case of what seems to be a universal rule that other people are the ones with the accents, and we're (whoever "we" happens to be) the ones who speak normally.  However, the main reason they keep saying we pronounce certain words and phrases the same isn't because do, but because we pronounce them differently from Americans.

The sound that -ou- makes in "about" is what's called a diphthong, which means roughly that our mouth starts in one position and gradually changes to another.  One difference between Canadian and American pronunciation is that when -ou- comes before certain consonants, t and s mostly, we tend to shorten the pronunciation of it.  For example, the -ou- in "bout" is shorter than the -ou- (written with -ow-) in "bowed", the past tense of "bow" as in "take a bow."  For Americans, the sound has the same pronunciation no matter what consonant follows. 

It's the first half of -ou- in particular that gets shortened, so the second part, which sounds more like an -oo- sound, gets emphasized.  The first part doesn't disappear entirely, but it gets shortened enough that unless you're accustomed to hearing it, you won't.  So some Americans will hear an -oo- where we hear an -ou-.

Another difference between Canadian and American English is in the pronunciation of the so called long -o- sound, the one represented by -oa- in boat.  The American pronunciation is also a diphthong, even though it's not written as one.  You'll see this if you look up the word in a dictionary that uses the International Phonetic Alphabet. On the other hand, the Canadian pronunciation of the long o is almost a pure vowel.  The first part of the American -o- is the same as the first part of the Canadian -ou- in words like "about."  The second part of the American -o- is similar to the second part of the Canadian -ou-, so to an American ear, "about" can actually sound very similar to "a boat," even though they don't actually sound the same to a Canadian.

So no, we don't actually pronounce "about" like "a boat" or "a boot".  But yes, the American perception of Canadian pronunciation is based on something real.


Some related comments:

  • I have a Romanian friend who tried to tell me the pronunciation of the Romanian word for Monday.  When he said it, it sounded like "loon" to me.  When I repeated it, he said there was an "ee" sound at the end.  It's spelled "luni." So I tried again, but I was then informed that the "ee" sound was too long.  This, I think, compares to the tendency of Americans to miss that first part of the -ou- diphthong in words like "about" and "house".  A Romanian's ears are tuned to notice that very short "i" at the end just like a Canadian's ears are tuned to hear the full -ou- diphthong, and Canadians will miss the very short "i" just like Americans will miss the very short first part of the "ou."
  • "Eh" is another supposed marker of Canadian English, and something Canadians will object to in chorus when someone points it out.  This is even sillier than objecting to "ou", because "eh" is used worldwide, even in American English.  There is a usage of the word that is unique to Canada, though.  Perhaps this usage is falling into disuse, though.
  • The analysis above is somewhat simplistic, since accents are not uniform across either Canada or the United States, as this map illustrates.  In particular, the phenomenon described above is not as strong on the west coast of Canada as in other parts of the country.
  • The phenomenon is known as Canadian Raising.  It's Wikipedia, so caveat lector, but what's written there is consistent with other, more authoritative sources that I've read on the matter.
  • Although Canadian English is different from American, the "full hoser" accent that's used on American TV shows is a caricature.  We generally don't talk like that unless we're imitating Americans imitating us.  Occasionally, though it's very rare, I do run into someone (usually rural, and many generations Canadian) who sounds remarkably close to it.
  • I don't really know if the most common response is denial.  It could just be a squeaky wheel type phenomenon, where the loudest reactions come from those who don't believe it.
  • The first site that I linked to above, What's Different in Canada, does provide an interesting list of the many, usually small differences between the two countries.  He hasn't got to ketchup and picked flavoured potato chips yet, though.

Monday, August 12, 2013


Another year older, another year in which I had to scramble to renew my licence sticker after the last minute had passed.  It doesn't feel like a priority when I get the notification months before the deadline, which gives ample opportunity for it to be forgotten altogether.  The fact that the deadline is my birthday, which has so far fallen on the same date every year, doesn't seem to help matters.  It wasn't until a phone call with my mother very late on my birthday that I remembered that I had to do it.

Before I could renew my sticker (actually, renew the licence plate, which is signified by a new sticker), I had to get my car tested for emissions.  Having done that, I went to the ServiceOntario to see what hours the nearest locations were open.  There, I saw a message that read like it was tailor made for me,

Left it to the last minute? No problem.
I clicked on the link to read
You can renew a licence plate sticker online...
"Hey Great!" I thought.  Instead of driving with an expired sticker, I could just renew online and wait until it comes in the mail before driving again.  Ah, but there was more!
...from 180 days before the expiry date until 11:59 p.m. on the day the sticker expires. After a sticker expires, you need to renew it in-person at a ServiceOntario centre.
Well, this was the day after it expired, so I was out of luck.

But does this practice even make sense?  Before the expiry date, when you are still legally entitled to drive to the ServiceOntario offices with the existing sticker, you can renew the sticker online.  But once the sticker expires, you are no longer entitled to use the easiest method to renew it without driving your car [1].  You must get there ... somehow.  Without your car.  Unless you want to break the law.

I checked the FAQs, and while they repeat the fact that online renewals are only possible before expiry is repeated, no explanation is given as to why.  Here are some possibilities.
  1. It's part of a secret pilot project to marginally increase the number of people riding bikes.
  2. They're supporting the taxi industry by enacting measures that would increase use rather than cutting cheques to all the taxi drivers.  There's no money left for that because they gave it all to Ontario's craft brewers.
  3. It's punishment for being a slacker or just plain absentminded.  Also, no dessert and you have extra chores for week, and wipe that smirk off your face young man!
  4. Concerns about the productivity levels of ServiceOntario staff.  If you don't take an hour out of your day to go to renew in person, the staff there will have an extra 20 seconds that they won't know what to do with.  Also, the line-up will be maybe 19 people long instead of 20, and they might feel lonely with so few people in there.
Maybe it's something else, but that's all I could come up with.

Oh, there's a quote at the bottom of the FAQs page from the Premier herself,
We are working to bring people together and find common ground - because that’s what we do in Ontario. When we find fair, creative solutions to the challenges we face, we all succeed together.
Hmm.  So maybe this is part of her plan to bring people together.  I didn't find any common ground with anyone, though, but nor was I looking.  I wish I had read that quote sooner, so I would have known the real reason I was there.  I could have said something like "Sucks that we have to wait in line when we could be doing better things with our time, eh?" and the person I said that to would respond "Yep."  Common ground would have been found and our purpose fulfilled!  Because that's what we do is Ontario!

Might I offer a creative solution that, based on the last quote, the premier is keen on?  Unless you can come up with a really good reason why you can't, let people renew online regardless of whether or not their birthday has passed.  And if you have a really good reason why you must cut off the online option once the sticker is expired, do us the courtesy of telling us what it is.  Otherwise, it just looks like an arbitrary exercise of power.

Better yet, instead of sending us multiple reminders in the mail, give us the option of having the stickers sent to us automatically, at least in those years where no emissions test is required.  You're already sending us mail to remind us anyway.  Why not put the thing we need in the envelope instead of a reminder to get the thing?

Even betterrer, could we do the licence plate renewals without the stickers?  It seems like a throwback, and not even a quaint one, to days of yore, before police cars came equipped with laptops into which bored police officers waiting at stoplights could enter licence plates in order to determine whether or not a licence plate is valid (or whether the car was connected to other crimes).

Possibly even betterrerer, could cruisers be equipped some version of the licence plate recognition technology that's used on the 407?  Police officers wouldn't even need to do anything.  They wouldn't need to enter anything into a laptop.  They wouldn't even need to get out of the car.  The driver would simply get a notification in the mail (or maybe through some other newfangled technology, like email), which, maybe, if the the government is feeling nice, could then be paid online.  Maybe.  If you eat your Brussels sprouts and clean your room.

Sunday, August 11, 2013

Parity Pooper

If you listen to the CFL commissioner long enough, the probability of hearing the word "parity" approaches 100%.  As far as the media is concerned, just searching for "CFL parity" in my browser history yields 3 results for articles with those words in the title.  There are probably even more articles whose body contains the word, even though it doesn't appear in the title.  In these contexts, the word means that teams are roughly equal in ability, that any given match could be won by either team (or, rarely, end in a tie), and it's almost always considered a good thing.  Other leagues and the journalists that cover them do it too, though possibly using different terms such as "competitive balance".

This article on parity gives some history to the concept and some explanation to why it might not be all that it has been cracked up to be (although it doesn't mention the CFL at all).  While I was reading it, a couple of other reasons crossed my mind.

First of all, it is hard to know with certainty whether or not parity really exists in a particular season.  Ignoring the possibility of a tie, we can run some simulations to show that even when every team is exactly as good as every other team, there still is a roughly 23% chance that the team with the worst record will have only 5 wins.  It should be emphasized that, despite the dismal record, this does not mean that it's the worst team.  We are assuming that all teams are equally good, so there is no best team and there is no worst team.  It is simply the team that won the fewest games.

Of course, it is possible that a team that wins only 5 out of 18 games is just bad.  But the fact that a team could be exactly as good as every other team yet still have a relatively high probability of finishing the season with the same record makes it hard to tell whether team is bad or just unlucky.

We could run a similar analysis for the other teams.  The numbers would be different, of course, but similar results would hold.  A league with parity would have some teams with poor records even if they are just as good as those with winning records.  So there's reason to be skeptical when the commissioner of your favourite league talks about it.

Secondly, there is a psychological reasons why we might not even want parity.  Surely, if your favourite team posts losing records year after year or hasn't won a championship in more than a decade, parity would be an improvement.  But is it still desirable if your team is the one that won the championship?  Under parity, each team is as good as every other team, so each team has an equal probability of coming away with the win.  Thus, the outcome of the game is essentially just the result of a physically demanding coin toss.  Each victory earned by your team, from the first regular season game, all the way through to the final playoff game, was not due to skill, but to chance.  Your team won the championship not because it was better than other teams but because of a 20 or 21 game lucky streak (well, a luckier streak than all of the other teams).

Thus, parity essentially does away with one of the things that keeps people invested in their team: the belief that it's better than all of the other teams (or the hope that it one day will be) [1].

At best, parity could give consolation to fans of those teams with losing records.  Rather than being forced to admit that their teams are no good, they can simply claim that the teams were the hapless victims of probability.  Then again, parity is often billed as the thing that gets your team wins, not the thing that causes losses, so it's not really much consolation at all.


You might be wondering why I ignored ties in my analysis.  It was because it's not clear how to account for ties.  We would expect more when there is parity, but it's not obvious how frequent they would be.  Some seasons have none at all, and those that do tend to have only one, so we might guess that the probability is at most 1 in 72 (the total number of games played in the regular season -- playoff games cannot end in a tie).   In any case, they seem to be rare events, so ignoring them probably doesn't change the analysis by much.

[1] That being said, I'm sure there are people who could simultaneously believe that there is parity and that their championship winning team is better than the others without seeing the contradiction even after being told.

Wednesday, July 31, 2013


To the best of my recollection, it was approximately a year ago, or maybe two, that I first read the word "welp".  I didn't record the date, because it seemed like an isolated event and not something I would want to come back to.  It was fairly recent in the history of the English language, in any case.  I had to look the word up to make sure I knew what it meant.  I knew the word "whelp", but it didn't fit in the context.

According to the entry for "welp" in Wiktionary, it is an alternate form for "well" as in interjection, as in "Well, I was going to go to the store....", in the same way as "yep" and "nope" are alternate forms "yeah" and "no".   Wiktionary comes with the same set of caveats that come with Wikpedia, but their definition made perfect sense in context, and it might even be a more accurate representation of the pronunciation when people use the word that way. 

Since the first time I saw it, especially in the last few months, I've seen the word used all the time.  I've yet to see any language-y types take note of the phenomenon.  Even the good folks at Language Log, who often comment on trends in language, don't seem to have noticed yet.  A search for the word on their website only gives two results.  In one result, it is an acronym unrelated to this usage.  In the other result, the word doesn't even appear.

It's not a word in my browser's dictionary either.

Why the sudden proliferation?

Thursday, April 04, 2013

Partial Hoarder

A couple of years ago, one of the strings on my guitar broke.  New strings mixed with old don't sound great, so I bought a new set.  Or, I thought I did.  I never got around to putting the strings on, or possibly never got around to buying them.  I can't remember.  Recently, I decided it was time to put strings back on my guitar and start playing again.  I've searched high and low, but I haven't found the strings yet, suggesting that perhaps I never bought them.

Many of my things are stored away in boxes, and in looking for the strings, I managed to consolidate the contents into fewer boxes than I started out with.  But what to do with the extra boxes?  Throw them out? Never!

In my search, I also happened across a book that I had been looking for since last year.  As I tried to find space for the book on my shelf, I had to face the reality that I have let my books get out of order.

The newly emptied boxes and the disordered bookshelf got me thinking about the following two problems.

The Russian Box Problem

Suppose you move a lot, on average once a year, say.  After you've moved enough times, you tire of having to hunt down boxes for the next move, so you start hoarding boxes.  I've got some pretty sweet tomato boxes that I've had for so long that they might be considered antiques by now.  There are trade offs to keeping all of these boxes, though.  You save yourself the trouble of having to find new ones, but create the problem of storing them.  Space is limited, so you want to store them in the most efficient way possible.  One way to save space is by nesting boxes, putting boxes inside boxes inside boxes, etc.  Call a set of nested boxes a Russian Box, after the famous Russian dolls.

How can you sort your boxes into the smallest possible number of Russian boxes?  That is, what is the minimum number of Russian boxes needed so that each box in the given set is in exactly one Russian box.

The answer gives one possible way to minimize the amount of space needed to store the boxes.

(There may still some way to divide the boxes into more Russian boxes than the minimum number, but uses less space.  Also, if the small boxes are significantly smaller than the large ones, then it might be possible to save even more space by putting multiple un-nested small boxes inside the large box.)

The Russian Books Problem

This is not about books in the Russian language, but rather about arranging books like the boxes in the previous section.

When arranging books on a bookshelf one may place aesthetics over alphabet and decide to sort books according to size.  It might be desirable, then, to place books so that they are decreasing (or at least non-increasing) in size from one end to the other.  We'll assume that the thickness of the book, i.e. number of pages, doesn't matter, but the height and width of the covers do, because it is only the covers that are making contact when they are on the bookshelf.

Thus, what we want to do is organize the books so that one book is smaller in both height and width than the book before it.  Unfortunately for people who want to sort their books this way, publishers publish books in a range of sizes and shapes, so that one book may be taller but narrower than another book.  In that case, it is impossible to have the desired arrangement.

If it is impossible, one might ask for the next best thing.  What is the next best thing?  That is subjective, I suppose.  One possible answer is to ask for an ordering of the books with the smallest number of violations.  By violations here, I mean the number of places in which a book is larger in either dimension (or both dimensions) than the book preceding it.

Perhaps to some people, it would seem unnecessary to insist that books be ordered by both their height and width, since you mainly see the front of the book when it's on the shelf.  But when it comes time to move again and put those books back into the boxes that were the subject of the first section, I find it handy to arrange the books in decreasing order of size (or increasing, if you turn the box around).

The Russian box problem and the Russian book problem have a similar flavour (thus the chosen similarity in the names).  Boxes are placed inside larger boxes, and books are placed beside (and to the right, say) larger books.  The problems are not exactly the same, though.  For one thing, we are ordering the boxes according to 3 different dimensions, length, width, and height, while books are ordered according to only 2, height and width.  For another thing, you cannot put one box inside the other if both have the same size, but you can put two books side by side even if they have the same height and width.  Thirdly, there is more freedom when trying to fit one box into another.  If a box doesn't fit upright, it might still fit it is rotated onto one of its sides.  A book on the other hand, will always be placed so that its binding at the front of the bookshelf.

Despite these differences, however, both problems are essentially just different versions of the same type of problem.  Both of the desired relations can be used to define what is called a partial order. 

Everyone is familiar with the concept of order for numbers.  We say that 2 is bigger than 3, for example, or 1 is smaller than 100.  More generally, given any pair of distinct numbers, one of them will be smaller than the other.

Less familiar is the notion of a partial order, though it's not too hard to find examples from common experiences.  For example, ancestry defines a partial order.  Your parents are your ancestors, and you are your children's ancestor.  On the other hand, you are (probably) not your cousin's ancestor nor are they yours, even though you have at least one common ancestor.  People who are not related to you at all don't even enter the picture.  So some pairs of people can be ordered by ancestry, but some cannot.  Thus we say that ordering people by ancestry is a partial order, because it only partially orders (possibly perished) people.  You may have some foods that you prefer over others, whereas you like some other foods just as much.  Thus, your food preferences might also define a partial order.

Being able to nest one box inside another defines a partial ordering on the boxes.  A book being smaller in both height and width than another defines a partial ordering on the books.

Partially ordered sets have been studied in depth by mathematicians.  In fact, it's a subject of ongoing research.  Although the research is not done in the language of boxes and books, one of the topics of interest for the people who study these things is essentially the same as solving the box and book problems stated above.  It's been a while since I've studied the topic in any depth myself, so I don't know offhand how hard it would be in general to find a solution.

What's remarkable (to me) is that I never set out to find a ``real life'' application for these mathematical ideas.  The problems that I laid out earlier were simply problems that I wanted to solve.  The box problem was new, but I had thought about the book problem a few times in the past.  I felt there was a mathematical aspect to them, which is why I eventually decided to write them down in the first place.  But I didn't know exactly how mathematics would enter the picture.  It was only after I started writing that I realized I had seen problems in this area before.

Monday, March 25, 2013

Matters of Size

Someone with more resources than me has tackled a problem related to the subject of an earlier post about Tim Hortons' Roll Up the Rim contest.  Do the odds of success increase with cup size?

The analysis done by the authors is incomplete, in my opinion.  The findings of their experiment are consistent with popular suspicions.  The largest cup has the highest success rate.  The smallest cup has the lowest success rate.  The two middle sizes have a success rate of exactly 1 in 6.  So success is roughly ordered in terms of cup sizes.  Does their experiment actually prove that the game is rigged in favour of larger cups, though?

This is after all a relatively small number of cups.  There are millions of cups distributed during the contest, but they didn't even check 100.  How well does the data on this particular sample reflect the distribution of cups across the country (and the small portion of the US with Tim Hortons)?

Again, as in my earlier post, we can consider the likelihood that one of these would actually happen.  If something extremely unlikely happened, it's fair to accuse Tim Hortons of skulduggery (something we should do as often as we can, if only because of the greatness of the word).  If we can expect these events to happen fairly often, we should reserve our judgment.

How likely is it, then, for you to win only 4 times in 38 tries, as in the case of the small cups in the article?  Without getting into details, that number is 11.6% (rounded to 1 decimal place).  Compare this with the 1/6=16.7% chance of winning on a single cup.  So your chance of winning on a single cup is only about 50% greater than winning only 4 times out of 38.  You're on the wrong side of the odds, but not so far that it proves the likelihood of conspiracy.  Roughly 1 in 10 people will have the same experience as you.

What about at the upper end?  What is the probability that you would win 5 times with a mere 18 cups?  10.3%.  This is also close to 1 in 10, nearly the same probability as winning only 4 times in 38 tries.  Again, it's not an extremely unlikely event, and not enough to prove foul play.

My own analysis, of course, is not sufficient to prove that there is no conspiracy either.  My only complaint here is that nor is the Huffington Post's analysis sufficient to prove that there is.  Unfortunately, in my opinion, the manner in which their findings were presented might serve to suggest that they have proven the popular perception.

There are better ways of discerning how reliable our inferences from Huffington Post data are.  This is where my expertise runs out.  The math professors in the article might have been more knowledgeable.  If they weren't, one of them most certainly could have found someone who was.  It's a shame that this wasn't done, or if it was done, that it was left out.  It may leave the readers with the wrong impression.

One of the main responsibilities of the media, whether print or electronic, should be to properly inform the public.  In my opinion, the Huffington Post only did half a job in that regard, and in this case, to the extent that the odds winning free stuff from a coffee cup matters, it might be worse than doing nothing at all.


As an addendum, we could ask why it would be wrong if large sizes gave more prizes.  Presumably people object on the grounds of fairness.  But is it fair to give the same odds of winning to people who pay more for a higher price for their extra large as the people who pay the lower price for a small, especially when you know that if people win a free coffee off the small, they're likely to opt for a larger size when they collect than what they would normally get?  In what other context would we think it fair for someone who paid more to have the same chance of winning?

For public relations reasons, Tim Horton's is probably right to make it even.  But I think they'd be justified if it weren't, as long as they only adjusted the odds to compensate for the different prices paid.

Saturday, March 23, 2013

The Price of Good Parenting

I saw Kinder eggs at the grocery store the other day.  I see them every week, actually, but the ones I saw last week stood out because they came in a box of three and had a Hot Wheels label on it (Hot Wheels being one of my favourite childhood toys).  The printing on the box explained that there are six different Hot Wheels toys in and each box of three Kinder eggs contains exactly one with a hot wheels toy in it.  Kinder obviously wants you to collect all 6, and just in case you weren't sure of that, it also says "collect all 6" on the box.

Suppose you set out to collect them all (or rather, your child convinced you to let him set out to collect all 6).   How many boxes would you have to buy, on average, before you collected all 6?

Before we answer this question, let's consider a different question.  What is the probability of getting all 6 different cars in the first 6 boxes?  To figure this out, we need to know two things, the number of different ways of getting all 6 in 6 boxes and the number of possible outcomes from getting 6 copies of the exact same car to getting all 6 different cars.  Dividing the first number by the second gives the probability.

Let's assume that you open the boxes one at a time and that the cars are distributed evenly across the boxes.  Suppose that the different cars are numbered 1 to 6 and that as you open the car-containing kinder egg, you write down the number of the car.

If you win all 6 in the first 6, then you have written down the numbers 1 through 6 in some order.  How many different ways are there for this to happen?  Well, there are 6 possibilities for the first number you write down.  Having written down one number already, there are only 5 possibilities for the second number.  Similarly, there are only 4 for the third number, 3 for the fourth, 2 for the fifth and 1 for the 6th.  If we multiply these numbers together, we get the total number of ways that we could win 6 cars.  So the number of ways to win is 6 x 5 x 4 x 3 x 2 x 1 = 720 ways.

Now let's consider the total number of possible outcomes, whether or not you got all 6.  There are 6 possibilities for the first box, 6 for the second box, and so forth.  To get the total number, then, we just multiply 6 by itself 6 times (or, equivalently, take 6 to the power of 6), to get 6 x 6 x 6 x 6 x 6 x 6 = 46656 possibilities.

The probability of getting all 6 cars in the first 6 boxes is then 720/46656=0.01543=1.5%.  Those are better odds than Lotto 6/49, but still not very high.  That doesn't help us answer the question of how many boxes you will have to buy, but it does tell us that you most likely will not have all 6 cars from your first six boxes and so  you will have to buy more.

Since the cars are distributed evenly across the boxes, the probability of getting any one car is 1 in 6. Thus, if you have already won k cars, then the chance of getting a car you already have in the next box is k/6 and the chance of getting a car you don't have is (6-k)/6. 

To determine the average number of boxes needed, we'll start from the end, assuming you only need one more car to complete the set, and work backwards to the case where you only have one car.

If you have already got 5 cars, then there is a 5 in 6 chance that complete the set and 1 in 6 chance that you have to buy another box.  This is essentially the same situation is the Roll Up the Rim where there is a 5 in 6 chance of losing and a 1 in 6 chance of winning.  There, we concluded that it took an average of 6 tries before the first win.  Using the same argument, we conclude that it will take an average of 6 more boxes before getting that last car to complete the set.

If you've got 4, there is a 4 in 6 chance of getting one you already have and 2 in six chance of getting one you don't.  By the same reasoning we used above for when you have 5, we can argue that it will take an average of 6/2=3 more boxes before you get the next new car.  Then, according to the previous paragraph, it will take 6 more boxes until the set is complete.  Thus, if you have 4 cars, it will take an average of 3+6=9 more boxes to complete the set.

Similar arguments can be used if you've got 3, 2, or 1 distinct cars, the only difference being in the probabilities of finding a car you have already or one you don't.  If you add up all the numbers from each case, you get 14.7.  This is the average number of boxes you need to buy before you get all 6 cars, answering the original question.

Each box costs $3.49.  So on average, you are spending 14.7 x $3.49=$51.3.  If you are in Ontario, you are paying 13% tax, so the total cost would be $57.97.  You are probably better off if you just go out and buy a set of 6 Hot Wheels and a chocolate bar.  Both the the cars and the chocolate will be higher quality, and you don't have to worry about dealing with kids who are hopped up on the sugar from 44 Kinder Eggs.

Thursday, March 14, 2013

Progress to Keys

A friend of mine once told me this joke.  A woman was cooking a ham.  Before she put it in the pan, she cut off the ends.  She had always done it that way.  Her husband noticed and asked why she had always done this.  She had no reason other than that's what her mother did.  So she called up her mother and asked why.  She didn't know either, because she simply copied the practice from her own mother.  So she called up her grandma who explained that she only did that because her pan was too small.

I thought of this joke one day not too long ago when I looked down at my keyboard and noticed how the keys on the keyboard were arranged, not the letters on the keys, but the actual physical keys.  I've seen keyboards almost every day for a long time, but I never noticed the oddness of the layout.  First of all, they are arranged on a downward slant, going left to right.  Secondly, the slant is only sort of a slant.  The offset between the keys in the home row (the middle row of letter keys) and the keys in the row above it is greater than the offsets between the keys in the top two rows and between the keys in the bottom two rows.  Why this asymmetry?  Why the inconsistent offset?

There must be an ergonomic reason for the odd, asymmetrical arrangement, right?

If you learned touch typing you were taught to have your fingers resting on the home row, with the fingers on your left hand occupying the a, s, d, and f keys and the fingers on the right hand occupying the j,k,l, and semi-colon keys.  Each finger is responsible for the keys in the slanted column containing the key on which it rests, with the index fingers doing double duty as they cover the columns between the f and j keys.

Because of the slant, I find that the index finger on my left hand rubs slightly against the middle finger, while on my right hand the index finger is drawn away from the middle finger.  At least it does if I follow the instructions of my typing teacher (do they still have those?  I would guess not.).  I also find that because of the slope, the Q is easier to type than the P, even though they are reflections of each other across the centre of the keyboard, both typed with the pinkie finger on the key above their "home" key.

I guess it's win-some/lose-some, with some stuff easier on one hand and other stuff easier on the other hand.  But it would be hard to believe that this was intentional, especially if you consider that P occurs more frequently than Q in a typical English text.  If it had been done intentionally, the designers would have reversed the two letters (assuming it had been decided that both were to be typed with the pinkie on the row above the home row).

 Of course, it wasn't done intentionally.  This is where the ham comes in.  The modern electronic computer keyboard was based on the old fashioned mechanical typewriter.  We had a couple of these in the house when I was growing up, before the advent of the affordable desktop computers, and long before brand new laptops could be had for less than a fifth of a graduate student's monthly salary.  I'm sure electric typewriters had been invented by that time, but those were for people in higher echelons of society than ours.

On these old mechanical non-eletronic beasts, the keys were attached to long metal arms.  Arms attached to keys in the same column were placed as closely to each other as possible, but obviously could not occupy the same space.  This forced the arrangement of the keys at the time, and that old arrangement is roughly the one that we use to this day.  Despite the fact that it has not been necessary for a long time, the oddly offset, asymmetrical arrangement still persists.

It survived electronic typewriters and computer  keyboards.  It survived the jostling of key positions in order to fit the most important keys of a typical computer keyboard into the constrained spaces of laptop computers.   Perhaps most surprisingly, it survived various attempts by aftermarket computer keyboard manufacturers to sell keyboards that were more ergonomic.  The keyboard was rounded to better fit the shape of the hand.  The left and right hand sides were severed from each other and laid out in an attempt to produce a more natural angle.  Yet, like cutting the ends off of the ham in the joke, the downward slant and irregular offset remained through all of these changes.  One would think that at some point, those people who were tinkering with other aspects would have noticed this and realized there was no point to it.

With the dawn of tablets and smart phones, whose space constraints are even tighter than laptops, some keyboard designers finally have been forced to quit old habit.  Touch screen keyboards are mostly grid-like, and smart phones with qwerty keyboards tend to arrange their keys without slant or offset.  This practice does not seem to have influenced makers of full sized keyboards yet.

Of course, this is probably not a huge issue.  After all, it took me more than 20 years of typing before I even noticed.  But still, given that it's not necessary to type this way, given that it doesn't treat both hands equally, I think it would make some sense if we had something more... even handed to type on.


Although it is less significant, the legacy of the mechanical keyboards reminds me of this.

Wednesday, February 20, 2013

Hortons Hazards

Each year around this time, Tim Hortons simplifies life for those who are enthusiasts of both coffee and gambling with their Roll Up the Rim to Win contest.  The premise of the contest is more or less evident from its title.  Each cup of size small or larger has a message printed under the rim of the cup.  When you're done your coffee (or tea or hot chocolate), you roll up the rim at a certain section, helpfully indicated by an arrow, to reveal the message.  Tim's either politely asks you to continue buying their products play again or delights you by giving you something for free, such as another coffee (or tea or hot chocolate) which you could probably have made two of for significantly less than the price of what you paid for the single cup [1]. This year, the chance of being delighted is 1 in 6.  Thus, the chance of a polite request is 5 in 6.

Each year around this time, there are also people who feel like the game is rigged, because they rolled up the rim 6 times but had yet to win.  One such person complained to me last year.  I nodded and agreed, though I thought to myself that his experience was not enough to prove conspiracy.

I had a worse losing run a few years back.  That year, the probability of winning was 1 in 9.  Over the course of about 2 weeks, I had bought something like 15 cups without winning once.  It seemed improbable.  Frustrated, I sent an email complaining to a friend who, though not a mathematician, is better versed in the probabilistic arts than I am.  In his reply, he stated that there was a 17% chance of run of losses that long.

I had been beaten by the odds, sure, but that probability was a lot higher than I was expecting.  Certainly it wasn't enough to prove that anything was amiss.  If just half of the country had bought as many cups of coffee as I had, I'd still be in the company of more than 2,500,000 people, enough to replace the population of the city of Toronto with perpetual losers [2].  Thus, although the sequence of events was quite a bit less probable than it was probable, it wasn't extremely unlikely.  It certainly wasn't unlikely enough to prove the prizes are distributed unfairly. And sure enough, a couple of cups of coffee later after, I won two in a row, resulting in a win-to-cup ratio that was pretty close to 1 to 9, the stated chance of winning.

Sometime after I got home, I decided to investigate the matter more in depth.  Since the probability of winning is 1 in 6, I decided look at the possible outcomes of buying 6 cups of coffee from Tim Hortons during their Roll Up the Rim promotion.  There are 7 possible outcomes, from winning 0 times to winning all 6 times (disregarding the order in which the prizes was won).  The calculations are pretty simple, but the explanation takes a bit more time, so I'll leave it out for now.  Here are the different possible outcomes, along with their probabilities.

  • 0 times: 33.49%
  • 1 time: 40.19%
  • 2 times: 20.09%
  • 3 times: 5.358%
  • 4 times: 0.8037%
  • 5 times: 0.0643%
  • 6 times: 0.002143%
Here are the probabilities from the olden days, when the chances of winning were 1 in 9.
  • 0 times: 34.64%
  • 1 time: 38.97%
  • 2 times: 19.49%
  • 3 times: 5.68%
  • 4 times: 1.06%
  • 5 times: 0.1332%
  • 6 times: 0.01110%
  • 7 times: 0.0005947%
  • 8 times: 0.00001858%
  • 9 times: 0.0000002581%
Remarkably, in the olden days, the probability of winning nothing wasn't much lower than the probability of winning exactly once.  If half the country bought 9 cups of coffee that year, there would have been been enough people who didn't win a thing to replace the population of the whole Greater Toronto Area. It's also close to twice the probability of winning exactly twice.  Even under the current rules, with a higher chance of winning, you're still quite a bit more likely to get nothing at all than win twice.  I suspect there are far fewer people who win something twice in short succession and feel like Tim Hortons is conspiring to favour them (or their local location, their city, their province, etc.).  In fact, I suspect the number of people who would feel that way is approximately zero.

This might seem surprising, as it was at first to me, because I only looked at my record and never thought to consider how unexpected my record was.  A few few moments of reflection, though, reveals that it shouldn't be surprisng.  The chance of winning something is only 1 in 6 anyway, which means that after 6 tries, you should only expect to win once.  Indeed, the most likely event is, unsurprisingly, exactly one win.  Winning 0 times is only one win different from one win.  So is winning twice, but since losing is 5 times more probable than winning, it's reasonable to expect that winning once less than expected is more likely than winning once more than expected.

Another question that might come up is, "How many cups of coffees should a person expect to buy before their first win?"  Again, I'll leave out the explanation for now, but the answer turns out to be exactly 6.  In the olden days it was 9.  In fact, if one out of every n cups is a winner, then it will take n cups on average before you win.  So if you don't win once in 6 tries, you're not that special.  It's not even enough to show that you're much different from the average.

Unfortunately, these arguments alone are not enough to prove decisively that there is no conspiracy.  It's only enough to prove that you don't have enough evidence to prove that there is a conspiracy.  For that, you'd need to collect a random sample of your rim-rolling compatriots who bought exactly 6 cups of coffee.  If the percentages of people who won 0 times, 1 time, 2 times, etc. are significantly different from those given above, then you might have a case.  If the percentages are similar, you should probably give up on your conspiracy theory and satisfy yourself with consuming the exact quantity of Tim Horton's product that you paid for [3].



How do we calculate the percentages given above?

Consider the rules for the current year.  The probabilities of winning or losing are 1/6 and 5/6 respectively.  Assuming the winning and losing cups are distributed evenly, whether or not you win from one cup has no bearing on whether or not you win from the next one.  The two events, winning from the first and winning from the second, are said to be independent.  The probabilities of losing on the first and second cup are 5/6 in both cases, and since the events are independent, the probability of losing two in a row is 5/69 x 5/6.  The probability of losing three times in a row is 5/6 x 5/6 x 5/6, and so forth.  Thus the probability of losing 6 times straight is 5/6 multiplied by itself 6 times, or 5/6 to the power of 6, which is the number given above for the probability of 0 wins, expressed as a percentage and rounded to two decimal places

The probability of winning exactly once is 5/6 to the power of 5 (for the eight losses) times 1/6 (for the one win).  But there are 6 different ways that the one win could have happened: on the first cup, on the second cup, etc.  So we multiply this probability by 6 to get the probability given above for 1 win.

The probability of winning twice is 5/6 to the power of 4 (for the four losses) times 1/6 to the power of 2 (for the two wins).  There are 15 different ways that the two wins could have happened: on the first and second cup, on the first and third, ...,  on the second and third, on the second and fourth, ..., etc.  So we multiply this probability by 15 to get the probability given above for 2 wins.

The remaining probabilities under both the old rules and new rules are obtained similarly.  For the interested reader, and the already initiated, the probabilities follow a binomial distribution.

How do we calculate the average number of tries needed for a win?

There is a mathematical way to calculate this exactly, but an intuitive justification will suffice.  On average, one will win 1 prize for every 6 cups.  This means that in the long run, there is an average gap of 6 cups between wins.  But since whether or not you win on the next cup does not depend on whether or not you won on the last cup nor even whether you bought a cup at all, the gap between wins is the same as the gap between the last cup and the next win.  In particular, the gap between having bought zero cups and the first win is 6.

[1] In fact, you could probably spring for the expensive beans for your home brew and still come out ahead financially, while enjoying a better cup of coffee.

[2] Which currently only occupy the arena at the Air Canada Centre.

[3] I should point out that the big prizes are not distributed evenly.  Any Tim's customer living outside of Ontario has a better chance of winning a Rav4 than an Ontarian does.  Even though Tim Hortons is open about this, and claims that the smaller prizes, such as coffee and doughnuts, are distributed evenly, I suspect that some would see their favouritism for the big prizes and conclude, despite the chain's claims, that it extends to all prizes.

Tuesday, February 05, 2013

The Phase Out and the Stunned

Now that it's penny is being phased out, I offer the following get rich quick scheme. Every time you go shopping, bring a calculator (or use the one in your phone). Before you check out, calculate how much the total purchase will cost. Determine whether the price will be rounded up or down with chart below from the Canadian Mint. If it will be rounded up, pay with your credit card to avoid paying the extra 1 or 2 cents. If it will be rounded down, use cash to save 1 or 2 cents. At the end of the year, go out and buy yourself a coffee, a doughnut, and maybe, if you're some kind of shopaholic, a Timbit, with all the money you saved.