LibraryQuant puzzles
A shop, and a file somebody kept for one month.
The file has one row per day. Each row carries a date, the day's takings in dollars, and a count of customers. The month has 30 days. The file has 27 rows. The first row is dated the 1st and the last is dated the 30th.
Two of the 27 rows have takings of 0, entered on the two days the shop was shut for a public holiday. The takings across all 27 rows add to 11,250 dollars.
Then somebody mentions, in passing, that for the first half of the month the customers column counted everybody who walked through the door, and for the second half it counted only people who bought something. Nobody changed the heading.
Three questions.
Count the days more than one way before averaging anything, and let the wording of each question pick the count that goes under the line. Then read the remark about the customers column a second time.
A row is one occasion and a column is one fact about every occasion, and both of those can quietly fail. A day nobody wrote down is a hole rather than a shorter month, a zero is a fact about a day rather than the absence of one, and a heading that stayed the same while its meaning moved is the failure nothing catches.
Three different numbers, and each of them answers a different question.
The month is 30 days. The first row is the 1st and the last is the 30th, so the file spans the whole month whatever is inside it.
Twenty seven days were written down. That is the row count, and a row is one occasion: one day, one sale, one customer, whatever the table is built out of.
Three days were never recorded at all. Thirty days spanned, 27 of them written. Those three days are not short days and not zero days. Nothing is known about them from this file, and the file itself is silent about their absence, which is what makes this the most missable of the three numbers. Reading the file as a 27-day month closes the holes and turns three unknown days into days that never happened.
The shop opened on 25 days. Twenty seven rows, two of which record a day when the shop was shut.
So the file describes a 30-day month, holds 27 days of record, and covers 25 days of trading. Any of those three can be the right denominator, and which one is right is decided by the question rather than by the file.
The question asked for an average day that the shop opened, so the denominator is 25.
Eleven thousand two hundred and fifty divided by 25 is 450 dollars.
Look at the two answers that were available and wrong.
Divide by 27 and the answer is about 417 dollars. That is the average across every day somebody wrote down, holidays included, and it answers a question nobody asked: what a day averages if we count two days when the shutters were down.
Divide by 30 and the answer is 375 dollars. That treats the three unrecorded days as days that took nothing, which is an invention. Nothing in the file says the shop was shut on those days, and nothing says it was open either.
The 0 rows and the missing rows look similar and are opposites. A 0 is a recorded fact about a day: the shop was there, it was shut, it took nothing. A missing row is the absence of a record, and a table cannot tell us apart from itself whether the day was quiet, busy or never happened. Any file with both in it needs somebody to say which is which, in words, outside the file.
It is not a column any more. It is two columns sharing a heading.
The first half counts footfall. The second half counts buyers. Those measure different things, they are different sizes, and the heading records neither. Add the whole column up and the total is a footfall count for half a month glued to a buyer count for the other half, which is a number that describes nothing at all. Average it and the average is worse, because it looks perfectly reasonable and it has no meaning to be wrong about.
What can be computed is anything that stays inside one half. Footfall for the first 15 days is a real quantity. Buyers for the last 15 days is a real quantity. Compare those two with each other and the comparison is the definition change, not the shop.
This is the failure worth carrying out of this module, because it is not a mathematical error and no arithmetic check catches it. Every column in a table was somebody's decision about what to count, and the decision can move while the heading stands still. A tidy table is not a correct one: the arrangement makes questions askable and says nothing whatever about the answers.
If a heading were enough to know what a column holds, why would anybody ever ask who built the file?
The same file, and the question is now the average takings across every day the shop was there and open or shut, holidays included but unrecorded days excluded. That is 11,250 over 27, which is about 417 dollars. If the 450 came out again, the thing to notice is that the denominator changed with the question and the total did not.
The month has 30 days and the file has 27 rows, so three days were never written down at all. Of the 27 rows, 2 record days the shop was shut, so it opened on 25. Takings on a day it opened average 11,250 over 25, which is 450 dollars. The customers column is two different columns sharing one heading, so no total taken across the whole of it means anything.
Thuztra Learn teaches the maths of quant finance from zero, in short lessons, for readers who are unsure of it. Three questions in the app build your quant roadmap, free. Membership is a paid subscription. See what Thuztra Learn is and what it costs, or see the whole Core quant curriculum.
Get the app and answer the three questions:
Download on the Microsoft Store Download for Android