- BetterExplained - https://betterexplained.com -

Learning How to Count (Avoiding The Fencepost Problem)

Learning How to Count (Avoiding The Fencepost Problem)

Counting isn't easy. Suppose your boss wants you to work from 8am to 11am, and mop floors 8 to 11. Simple - it's one floor per hour, right?

Nope! There are 4 floors to mop (8, 9, 10 and 11) but only 3 hours to work (8-9, 9-10, and 10-11).

Whoa -- we count floors and hours differently? You bet. And somehow, if the boss said "Mop floors 8 to 11 on April 8th to 11th" everything would be ok.

Today let's unravel this counting mystery.

Basic Counting

Numbers help us know "how many". Take a numbered list of houses:

counting numbered houses

There's 52 houses there. Don't count each one: the addresses count for us! The numbers label the houses one by one, just as we'd do. We can just read the last item: "1 to 52" is 52 houses.


What Does Subtraction Mean?

We often see numbers as points on a line:

number line

These points can be houses, floors, or plain integers. Whatever they are, they're labeled so we can count them easily. 1 to 10 means ten items.

But what about a range like 8 to 11? How many items are there?

number line distance of 3 but 4 numbers

We'd probably try subtraction: 11 - 8 = 3, right? But here's the key:

The equation 11 - 8 = 3 means there are 3 "spans" between 8 and 11, but four numbers in that range!

A span is a distance measure, like time from 8am and 11am (3 hours) or the distance between 8 and 11 inches (3 inches).

But when counting floors, we aren't asking for the distance between floors 8 to 11 (which is in fact 3 floors or 30 feet, assuming 10 feet per floor). We want a count of how many items the range "8 to 11" includes!

Working With Spans and Counts

Realizing there are two types of counting was a big mental shift. We have two possible choices when "counting" from a to b:

Ok, the formulas work. But why does a count need an extra element?

Well, the shortest span (distance 1) actually touches two numbers:

single span, two items

A span is a line segment with a start and end; a span of distance 1 covers 2 points. As we grow the span, we gobble up more points and are always "one ahead".

additional span

Here's another way to think about it. A span of 3 means we start with an item (#8) and count out 3 more (#9, #10, #11). So, a span of N includes 1 original item and N new items, for a total of N + 1 items.

I like seeing new viewpoints; use what works for you.

The Fencepost Problem

The confusion between spans and counts is commonly called the fencepost problem. Are you counting the posts (points) or the distance between them (fence spans)?

The question goes like this:

You're building a fence 100 feet long, with posts every 10 feet. How many posts do you need?

Here's how to think about it with our new mental model:

Hrm, we want a fence 100 feet long. Ok: that's a span of ten, 10-foot segments. But we want the number of posts: how many posts do those ten segments touch? Well, a span always touches an extra point, so ten segments means 11 posts.

11 fenceposts it is. But the problem isn't natural for me - I have to think about spans vs points. I'd double-check with a smaller example - a fence that is 10 feet long needs 2 posts, so yes, we need an "extra post".

A few more examples:

Interesting, eh? Some units of time are measured with spans (hours, seconds) and others are items to be counted (days).

The measuring type depends on the context. We see shorter units of time as "instants" and want the duration between those instants, not the "number" of instants we touched.

We see days as a large fuzzy blob covering a time period (9am-5am) -- and we want to know how many blobs we covered. Saying you worked April 8 to April 9th implies you worked a timespan of 9am-5pm on two days.

The counting type depends on the context - but at least you know why we count them differently.

Final Thoughts

Counting isn't simple. The fencepost problem and other "off by one" boundary errors are notoriously common. But don't just remember a special trick, like "sometimes I need to add 1". Remember there are two ways to measure something:

It's not easy to recognize the difference - we're used to having one way to measure. Try a simple example (a fence 10 feet long) to test if you've got a count or span.

I've run into the fencepost problem many times, but the articles I read just told me how to fix it. No, no, no - why does it happen?

It turns out we often use the same approach for two different types of counting. And while the right method may not be obvious, at least we know to try both approaches. Happy math.

Other Posts In This Series

  1. Techniques for Adding the Numbers 1 to 100
  2. Rethinking Arithmetic: A Visual Guide
  3. Quick Insight: Intuitive Meaning of Division
  4. Quick Insight: Subtracting Negative Numbers
  5. Surprising Patterns in the Square Numbers (1, 4, 9, 16…)
  6. Fun With Modular Arithmetic
  7. Learning How to Count (Avoiding The Fencepost Problem)
  8. A Quirky Introduction To Number Systems
  9. Another Look at Prime Numbers
  10. Intuition For The Golden Ratio
  11. Different Interpretations for the Number Zero