**R – Cartesian Faith**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Math puzzles always tickle the brain, and this one has tickled quite a few on LinkedIn. Why are these puzzles so popular, and what’s the right answer? I sampled 610 responses to find out.

Of the 610 responses I sampled, the range of answers was surprisingly large, although there were two clear candidates 98 and 99, followed by a less likely third, 101. The full table of counts looks like

x 2 27 40 71 81 82 88 97 98 99 100 101 107 108 113 119 263 1 1 1 1 1 1 1 4 268 293 1 17 1 4 1 10 4

According to the data, 48.1% of respondents said the answer is 99, while 43.9% said it was 98. If we trust the wisdom of the crowds, 99 is the correct answer, yes? Not so fast. This is what makes puzzles like this so popular because multiple plausible answers seem to exist. If there was a clear majority for a particular answer, the puzzle wouldn’t stoke the embers of our emotions. (Other puzzle constructions exist that use different strategies to draw people in.)

Why is 99 incorrect? People used a few different approaches to arrive at this answer. Let’s define a matrix that represents the table, with columns , , . One common solution is to multiply the elements in each row and notice that the answer is that product less the value in the previous row, . This yields , so the answer is 99. What’s wrong with this approach? There are two main problems that all quantitative people should be wary of. First is the dependency across rows, which relies on poor assumptions. Notice that for this approach to work, the first row needs an initial value of 1. This fits the sequence of the column, so why not? What about the other columns in this initial row? According to the pattern, , which presents problems for . Furthermore, when we get to the last row, the entries don’t follow the sequence, which invalidates the model. And yet, more people chose this answer than any other! I suspect that it is due to Daniel Kahneman’s System 1 rearing its ugly head.

What about 98 then? Is this the correct answer? I saw two main approaches taken to arrive at this solution. The first defines the relationship . This results in the sequence . What’s nice about this solution is that there are no row dependencies, so there is no assumption about initial values nor issues with the pattern of the sequence changing. However, there’s an even more concise solution, which is simply , which also results in . Why is this a better solution? From a statistics perspective, we might say that we can explain the response variable with one instead of two variables. This is essentially Occam’s Razor. Anecdotally, this latter approach was less popular than the former. Again, I suspect that this is a consequence of System 1 attempting to fit rules to data sub-optimally. By this I mean that since two columns of data are provided, our brains look for a solution that uses both variables. Once this is satisfied, we essentially stop looking, even if there is a better solution.

So the lesson is that model builders and quantitative folks need to be ever vigilant of our own biases. Even if we come up with a solution that seems to fit the data, we need to think critically about the assumptions we are making and whether better, simpler models are out there.

*Brian Lee Yung Rowe is Founder and Chief Pez Head of Pez.AI // Zato Novo, a conversational AI platform for guided data analysis and automated customer service. Learn more at Pez.AI.*

### R Code

x <- read.table('linkedin_math.txt')[,1] table(x) a <- matrix(c(3,2,7, 5,4,23, 7,6,47, 9,8,79, 10,9,NA), ncol=3, byrow=TRUE) colnames(a) <- c('x','y','z') # Yields 99 as final answer sapply(2:nrow(a), function(i) a[i,1] * a[i,2] + a[i-1,1]) # Yields 98 as final answer sapply(1:nrow(a), function(i) a[i,1] * a[i,2] + a[i,2] - 1) # Yields 98 as final answer sapply(1:nrow(a), function(i) a[i,1]^2 - 2)

**leave a comment**for the author, please follow the link and comment on their blog:

**R – Cartesian Faith**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.