# Why do you add +1 in counting test questions?

Here's an example question from the SAT question of the day:

On the last day of a one-week sale, customers numbered 149 through 201 were waited on. How many customers were waited on that day? Possible answers: 51, 52, 53, 152, 153.

The correct answer here is 53, which is the result of (201-149) + 1 = 53.

What's the reasoning in adding the +1?

• Consider the case in which customers 0-1 were waited on. 1-0 = 1, because you're "not counting" one of the ends. 1-0 + 1 = 2, the correct answer. – vroomfondel Sep 4 '13 at 23:06
• Use smaller numbers. How many numbers are there from $7$ to $10$ inclusive? There are $4$, you can list them. This is $1$ more than $10-7$. – André Nicolas Sep 4 '13 at 23:07
• Because if you don't add 1, you are left with 52, which is not the correct answer. – Kaz Sep 5 '13 at 4:10
• In my country, we learn this at elementary school. – sawa Sep 5 '13 at 6:52
• It's sad to see "add 1 to counting test problems" being taught as one of those "rules"... – ithisa Sep 5 '13 at 13:49

If you don't add 1, then you're saying "take the first 201 customers, but then exclude the first 149 ones." That would give you the number of customers in the list from 150-201.

The way I think of it is this: The number of customers from #149 to #201 is $201-148=53$, because it's the first 148 customers we're trying to exclude.

Does that help?

• I'd like to add that this is one of the reasons that in programming we almost exclusively work with up to exclusive bounds. – orlp Sep 5 '13 at 2:51
• (And down to inclusive - AKA half-open intervals) – Matteo Italia Sep 5 '13 at 10:40
• @nightcracker Also the reason why most programming languages start indices from 0 and why programming languages indexing from 1 are so terrible to use. – Sulthan Sep 5 '13 at 10:41
• @Sulthan and why "Foreach" constructs are normally a godsend. – WernerCD Sep 5 '13 at 16:06

http://en.wikipedia.org/wiki/Off-by-one_error#Fencepost_error

• I first noticed this phenomenon in elementary school, where the baseball field's backstop had three sections of netting between four poles. I never knew this idea actually had a name, and was related to fences. – cobaltduck Sep 5 '13 at 11:16

Here's one way of thinking about it.

The numbering of customers is pretty inconvenient. It would be much better if the first customer was customer number $1$, the second customer was customer number $2$, and so on. That way, the total number of customers would be the customer number of the last customer. So I am going to change the numbering of customers to suit my needs. How am I going to do this? Well, to change the first customer's number from $149$ to $1$, I subtract $148$. Likewise, for each customer, their new customer number is their old one minus $148$. This gives the desired numbering and the final customer's new customer number is $201 - 148 = 53$. Therefore $53$ people were waited on.

Note $201 - 148 = 201 - (149 - 1) = 201 - 149 + 1$; that's where the one comes from. If you didn't add the one, the first customer's number would be zero, not one.

Look at an example at a smaller scale, say we have three people: $$1,2,3$$

Then $$3-1=2$$

is the number of commas, but there is one more person than commas.

You can see that adding another number $$1,2,3,4$$ adds both another person and another commas and so this difference of one remains.

This gap was created with the first person $$1$$

there is $0$ commas but one person.

• I find the explanation using gaps the most interesting :) – Prism Sep 5 '13 at 23:29
• @Prism - it's nice to hear that, thanks :) – Belgi Sep 5 '13 at 23:40

A.) In sets:
| (149 , 201] | = 52
| [149 , 201] | = 53

B.) Using a property of summation,
if we shift the index of expression below so that $\left(n=149\right)$ will become $\left(n=1\right)$ \begin{align} Y & = \sum_{n=149}^{201}{n} \\ & = \sum_{n=149-148}^{201-148}{n+148} \\ & = \sum_{n=1}^{53}{n+148} \end{align}

The upper bound is 53.

C.) Counting the customers from 149th to 201:

1.) 149th customer
2.) 150th customer
3.) 151st customer
4.) 152nd customer
5.) 153rd customer
6.) 154th customer
7.) 155th customer
8.) 156th customer
9.) 157th customer
10.) 158th customer
11.) 159th customer
12.) 160th customer
13.) 161st customer
14.) 162nd customer
15.) 163rd customer
16.) 164th customer
17.) 165th customer
18.) 166th customer
19.) 167th customer
20.) 168th customer
21.) 169th customer
22.) 170th customer
23.) 171st customer
24.) 172nd customer
25.) 173rd customer
26.) 174th customer
27.) 175th customer
28.) 176th customer
29.) 177th customer
30.) 178th customer
31.) 179th customer
32.) 180th customer
33.) 181st customer
34.) 182nd customer
35.) 183rd customer
36.) 184th customer
37.) 185th customer
38.) 186th customer
39.) 187th customer
40.) 188th customer
41.) 189th customer
42.) 190th customer
43.) 191st customer
44.) 192nd customer
45.) 193rd customer
46.) 194th customer
47.) 195th customer
48.) 196th customer
49.) 197th customer
50.) 198th customer
51.) 199th customer
52.) 200th customer
53.) 201st customer

They are all 53 :)

Hold up your hand with your fingers splayed. The subtraction 201 - 149 counts the gaps between the customers, just as calculating 5 - 1 counts the gaps between your fingers.

To count the customers you must then add 1, just as to get the correct finger count you must add 1 to the result of 5 - 1..

## With algebra

Arithmetic sequence has a relation as follows,

$$a_n=a_1+d(n-1)$$

where:

1. $a_n$ is the $n$th item.
2. $a_1$ is the first item.
3. $d$ is the difference between two consecutive items.

In your case, the sequence has $d=1$. Applying this to the equation above, we have,

\begin{gather} a_n =a_1 + 1\times (n-1)\\ a_n=a_1 + n-1\\ n=a_n-a_1+1 \end{gather}

This is trivial to explain by using some small numbers.

On the last day of a one-week sale, customers numbered 1 through 2 were waited on. How many customers were waited on that day?

We know that customers 1 and 2 were waited on. That's 2. Without the +1, your answer is 2 - 1 = 1. Wrong! This equation excludes the first person (customer #1). We need the plus one to include the first person.

We can even make it simpler:

On the last day of a one-week sale, customers numbered 1 through 1 were waited on. How many customers were waited on that day?

The right answer is obviously 1. But 1 - 1 = 0. Again, we need the +1 to include the first (and only) person.

I'm sure several of these answers are technically 'more' correct but, really, this is very simple. The calculation 201-149 will not include customer 149. You want to include customer 149 in your count so what you really want is to subtract the last numbered customer which is not in your included customers from the total. Questions like this are designed to show us that it is very easy to forget zero when counting items.

To prove: there are M - N + 1 customers in the numbered range M through N.

Firstly, in the range 1 to M, there are M customers, and similarly in the range 1 to N, there are N customers. This is because the numbering follows simple enumeration: customers are assigned the natural numbers, and thereby they are counted, meaning that the number assigned to the last customer in the range also represents the count of the customers.

Now when we consider the range M through N, there are two cases: M = 1 and M > 1.

If M = 1, then the range M through N is just 1 through N, and so there are N customers. In this case, M - N + 1 is 1 - N + 1 whose terms can be rearranged to N + 1 - 1 and canceled down to N, confirming that the formula to be proven works for this case.

If M > 1, then we can consider the range M through N as if it were the range 1 through N, but with the customers from 1 to M-1 removed. There are M - 1 customers in the range 1 through M - 1. These must be subtracted from the N customers in the range 1 through N, hence the count is N - (M - 1).

But the formula N - (M - 1) is equal to N + -1(M - 1) which reduces to N - M + 1 when we distribute the -1 factor into the binomial (M - 1).

Let $C_n$ be the customer numbered $n$. List the customers in question:

$$C_{149},C_{150},C_{151},\ldots,C_{200},C_{201}\;.$$

Now write their numbers in the form $148+\text{something}$:

$$C_{148+\underline1},C_{148+\underline2},C_{148+\underline3},\ldots,C_{148+\underline{52}},C_{148+\underline{53}}\;.$$

In this form it’s clear that if you ignore the $148$, you’re just counting from $1$ through $53$, so there are $53$ customers. Now think back to see where the $53$ came from: it was what had to be added to the base-point $148$ to get $201$, the last customer number, so it was $201-148$.

A little thought will show you that the same idea works in general, and that the base-point number will always be that of the last customer not being counted, so it will be one less than the number of the first customer that you want to count. If you’re counting the customers from $C_{\text{first}}$ through $C_{\text{last}}$, your base-point number will be $\text{base}=\text{first}-1$, and your counted customers will be

$$C_{\text{base}+1},C_{\text{base}+2},C_{\text{base}+3},\ldots,C_{\text{base}+?}\;,$$

where $\text{base}+?=\text{last}$. Thus, the question mark must be

$$?=\text{last}-\text{base}=\text{last}-(\text{first}-1)=\text{last}-\text{first}+1\;.$$

Always take in mind that subtracting number $b$ from $a$ means that how much should be added to $b$ to reach a?
Therefore, there is an obvious different between subtraction and counting. Your problem is about counting from 149 to 201, so that you must include 149 in your counting (but subtraction exclude 149 [see the italic sentence at the first line!] and it is the reason to add +1). Subtraction means that How many numbers (or distance -Real nubmers case) are between two numbers.

You have to think, is it inclusive or exclusive. If inclusive then it includes 149 AND 201. Therefore the answer is 201 minus (1 less than 149) == 201 - 148.

Using algebra:

a ... b inclusive

== b - (a-1) == b - a + 1


So there you have your +1

Just use the following formula:

The Number of Waiting Customers = Total Number of Customer - The Customers who are not waiting

Hence,

Counting starts always with 1 (except you are a C programmer)

How many customers do we have:
let's count them
1,2,3,...,201
so we have 201 customers

How many customers are waited on
let's count them
149, 150, ..., 201
this is not counting because counting starts alway sith 1
so we do not know how many customers are waited on

therefore let's try to count the opposite:
How many customers are not waited on
1,2,3,...,148
this is counting because
counting starts always with 1

we have 148 customers that are not waited on

so how many customers are waited on?
it is the difference
201 -148

There are 3 cases:

• include either the start or the end but not both

• include both the start and end number

• include neither the start nor the end number

Since the second case obviously has more numbers than the first, and the third case obviously has less, and you know the answer is close to "end minus start", you have the first one is "end minus start", the second is "end minus start plus 1" and the third is "end minus start minus 1".

In other words, the middle case (include one but not both) has the "expected" answer: end minus start.

## protected by Zev ChonolesSep 6 '13 at 13:11

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).