Solving 538's Free Throw Riddler

The question is was posted in early Septermber, 2017, here and is a undergraduate level probabilty problem:

You’re hanging out with some friends, shooting the breeze and talking sports. One of them brags to the group that he once made 17 free throws in a row after years of not having touched a basketball. You think the claim sounds unlikely, but plausible. Another friend scoffs, thinking it completely impossible. Let’s give your bragging friend the benefit of the doubt and say he’s a 70-percent free-throw shooter.

So, who’s right? What is the number of free throws that a 70-percent shooter would be expected to take before having a streak of 17 makes in a row? And what if his accuracy was a bit worse?

This lends itself to a binomial probability distribution. The shooter has a 70% chance of making and a 30% chance of missing any given free throw. It should be immediate that for the shooter to make 17/17 the probability would be \underbrace{(0.7)*(0.7)...*(0.7)}_{17 \text{ times}} = 0.0023 This is roughly a 0.2% chance that the shooter will make 17 in a row while taking 17 shots.

But that's not the question...

We want the expected number of attempts until the shooter hits a streak of 17 in a row.

Expected Values

Let's look at a similar problem that is a bit easier to wrap our heads around. I could ask how many times would I need to flip a coin before I got a streak of two heads. Clearly the probability of getting two heads in a row is (0.5)*(0.5) = 0.25, or 25%.

The event we are concerned with is the event that we get two heads in a row. This is unknown so let's represent it with a variable, X. Let's say the first flip is a tails, which happens with a probability of 1/2, and is one wasted flip, so now we need X + 1 flips to get a streak of two heads.

Suppose that the first flip was heads but the second flip was tails. This happens with proabbility 1/4 and we have two wasted flips so we now need X + 2 further flips.

The only other possibility is that the two flips were both heads, which happens with probability 1/4 and took 2 flips. Summing these up we have

X = (1/2)(X+1) + (1/4)(X + 2) + (1/4)2

Or X = 6. That is, on average, you should expect to get a streak of 2 heads every 6 flips.

Generalizing this, for the k-th flip to be tails the number of flips would be \frac{1}{2^k}(x + k), and one can deduce the expected number of flips to get a streak of N heads would be X = 2^{N+1} - 2

What if it's not a fair coin?

Let's start with two flips again and let's assume the head comes up with a 70% chance and tails only 30%. Let X be the number of flips needed to get a streak of two heads.

If the first flip is a tail, that happens with a probability of 0.3 and we have wasted a flip so now we need X + 1 flips. If the first flip is a head, but the second flip is a tail, that happens with a probability of (0.7)(0.3) and we need X + 2 flips. If two consecutive flips are heads, which happen with probabilty (0.7)(0.7) we acheived success in two flips. Now our equation looks like:

X = (0.3)(X+1) + (0.7)(0.3)(X + 2) + (0.7)(0.7)2

Solving for X we get X \approx 3.469

If let X now be 3 heads in a row, we go through the same analysis and end up with an equation that looks like

X = (0.3)(X+1) + (0.7)(0.3)(X + 2) + (0.7)(0.7)(0.3)(X + 3) + (0.7)(0.7)(0.7)3

and solving for X we get that it takes approximately 6.38 flips.

In general, if we let a = probability of heads, then (1 - a) = probability of tails and if we look for a streak of X = 3 heads the equation above becomes,

X = (1-a)(X+1) + (1-a)(a)(X + 2) + (1-a)(a^2)(X + 3) + a^33

More generally, the expected number of flips to get N heads is
 X = (1-a)\sum_{k=1}^Na^{k-1}(X + k) + a^NN

and solving for X we have a nice tidy formula,

X = \frac{(1-a)\sum_{k=1}^Nka^{k-1} + a^NN}{1 - (1 - a)\sum_{k=1}^Na^{k-1}}

We want to explore a 70% free throw shooter. The answer lies below and we use Python to develop the general case. Let's keep in mind there are free throw shooter's in the NBA much worse that 70%.In fact, Andre Drummnd of the Detroit Pistons once was shooting around 35%. How long would it take him to hit 17 in a row? The result is astoundingly funny.

Solving Using Python

In [9]:
import numpy as np
import pandas as pd

import matplotlib.pyplot as plt
%matplotlib inline

def get_expected_value(a,N):
    # this method returns the expected number 
    # of flips, free throws or whatever
    num = (1 - a)*np.sum([k*a**(k-1) for k in range(1,N+1)]) + a**N*N
    den = 1 - (1-a)*np.sum([a**(k-1) for k in range(1,N+1)])
    return num/den

def hours_and_minutes_to_acieve(attempts):
    s = 11.0 # assume 11 seconds per free throw
    return s*attempts/60.0/60.0
In [14]:
# test it

print(get_expected_value(0.5,2)) # should be 6
print(get_expected_value(0.7,2)) # should be 3.469
In [3]:
# Free throws:
print("The expected number of free throws \n\
for a 70% free throw shooter to hit 17 in a row is ...\n")
The expected number of free throws 
for a 70% free throw shooter to hit 17 in a row is ...

1429 attempts

How long was he in the gym?

So, let's say, on average it takes 11 seconds to take a free throw and recover your miss/make. Your buddy would, on average, spent 11$\times$1429 seconds or about 4 hours and 22 minutes to acieve this.

In [17]:
print("The length, in hours, to hit 17 in a row:",hours_and_minutes_to_acieve(1429))
The length, in hours, to hit 17 in a row: 4.366388888888889
In [18]:
# for fun let's see how long it would take varous free throw shooters
percentage = [40 + i for i in range(54)] # reasonable range

shooting_info = pd.DataFrame(columns=['expected attempts','time'],index=percentage)
In [19]:
atts = []
times = []
for val in shooting_info.index:
    attempts = get_expected_value(val*.01,17)
shooting_info['time'] = times
shooting_info['expected attempts'] = atts
In [20]:
fig = plt.figure(figsize=(11,8))
plt.grid(zorder=0)['expected attempts'][20:].index,shooting_info['expected attempts'][20:],
       align='center', color='skyblue', zorder=3)
plt.title('Expected attempts for shooters of different \n FT percentages to hit 17 in a row')
plt.xlabel('shooting percentage')
plt.ylabel('expected attempts');
In [8]:
fig = plt.figure(figsize=(11,8))
       align='center', color='skyblue', zorder=3)
plt.title('Expected time for shooters of different \n percentages to hit 17 in a row')
plt.xlabel('shooting percentage')
plt.ylabel('time (hours)');


What about Drummond? It would take him approximately 86,682,190 attempts, and if we assume 11 seconds between attempts it would take him 264,862 hours, or about 30 years of non-stop, 24 hours a day free throw shooting.

So, quite a fun little problem!

Join over 5 people that are waiting day and night for latest from THE HOLY MATH.
We hate spam. Your email address will not be sold or shared with anyone else.
This entry was posted in Mathematics, Sports Statistics, Uncategorized. Bookmark the permalink.