# "Off by One" errors in counting music intervals

Many people count intervals incorrectly and get an "off-by-one" error. Off-by-one errors are a classic issue in computer programming. They also happen in music and appear in everyday life when casual logic leads us to the wrong answer.

Here's an example that trips most people.

Let's say a music composer wrote a collection of sonatas numbered 7 through 12. How many sonatas are in the collection? Most people subtract 7 from 12, which yields an answer of 5. But that's incorrect. The correct answer is 6. The easiest way to reveal this truth is to label each sonata:

Sonata Number:        7     8     9     10    11    12  <-- here you can see there are six sonatas
Position in collection: 1st   2nd  3rd  4th   5th   6th

Now let's say the composer wrote a collection of Sonatas 1 through 6. In this case we immediately recognize that the collection contains 6 sonatas. That's kinda easy, because the title tells there are 6. Yet again we'd get the wrong answer if we subtract 1 from 6.

We're less prone to off-by-one errors when confronted with a shorter list. For instance, let's say the composer wrote a collection of sonatas 7 through 8, we know the answer is 2 and we don't even resort to subtraction. Of course, if we did, we get the wrong answer of 1.

Here's one last test. Mozart wrote a collection of sonatas for keyboard, and the Kochel catalogue number are K. 10–15. Once again the answer seems quites obvious. It's really easy to conclude there are 5. But it's 6, same as before.

## The difference between removing and labeling

So why doesn't subtraction work? Subtraction is an operation of removing a number of objects from a collection. This is very different from labeling the objects in a collection. We don't want to remove anything. Our goal is simply to determine how many items are in a collection.

Ordinal numbering provides the correct way of counting itesm. With ordinal counting each item is labeled by its order in the collection. And this means we're counting inclusively, that means we include the first item ... rather than counting exclusively ny not counting the initial item.

When counting ordinally (ordinal means "ordering" things) we say: 1st, 2nd, 3rd. There is no zeroeth item! Your starting point is never 0 or 0th. The first item is always 1st. There simply is no 0 in this type of linquistic ordinal counting.

## Confusion with ages and centuries

Here's another area where we encounter off by one issues.

When you're 3 years old you're beginning to live your 4th year. When you turned 1 year old, you already lived one year so at age 1 you're starting your 2nd year. When you finish your 2nd year you're age 2, and starting your 3rd year.

Here's another common point of confusion. People come to learn that century number differ from the range of years they refer to, and off by one and correctly so. But for some it's hard to remember the directions in which they're off. So sometimes they're trying to recall if the 17th century refers to the 1800s or the 1600s.

The 17th century refers to the 1600s. That because the first century went from a particular year to a hundred years from that date. So the first century spans from the year 1 to through the end of the 100th year. The year 101 began the second century. The year 1601 began the 17th century. The year 1700 is the final year of the 17th century

Look at this article to see how to count music intervals correctly.