My friend Alex and I determined that a cup has to be 8.7" in order for our NXT robot to shoot a ball into it with a 95% accuracy. However, We made some updates to the robot and determined that our new target size requirement is 5.8"

To start we programmed our robot to shoot a ball at a pre-determined
angle above 45 degrees. The angle is not important, because we're
trying to determine its constancy for an angle. We need it to be
above 45 degrees because, we need it to shoot into the cup. Note,
the farthest distance that a ball can travel is at 45 degree angle.
In the landing area of the ball, we placed a
standard graphing paper
and some
carbon paper on top of it. This enables us to see where the ball lands after every shot.

We took a sample of over 30 times because it is a good rule of thumb in statistics. Our robot is able to shoot the ball at four different speeds. But, for simplicity, we measured it for only one of the shooting speeds.

First, we have to let the robot shoot its ball a number of times to get our samples. The landing locations will be considered the shot samples. We used Cartesian coordinates on our graph paper, where the length of the paper is our X-axis and the width of the paper is the Y-axis. We also considered the bottom left corner of the graph paper as our origin for X=0 and Y=0. On the graph paper, the distance between each grid was 5 millimetres. This made it convenient in writing down the X and Y value for each point (landing mark) on the paper.

Next we found the
average of our X
values and Y values separately. We did this by
adding all the X-coordinate values and divided the sum by the
number of our samples. We did the same for the Y values.

In our experiment we had total of 57 samples (shots).
The respective sum of our x and y values were 4458 and 3573.
The average was obtained by dividing the sum of the values by 57, that is:
$$
\sum X = 4458
, \ \ \bar{X} = \frac{4458}{57} = 78.21
\\
\sum Y = 3573
, \ \ \bar{Y} = \frac{3573}{57} = 62.68
$$
We used
Google Sheets
to help us with these calculations. Then, we calculated the
standard deviation using the formula:

In Google Sheets, we started by recording our values of the
X-coordinates in column A, labeled **Samples**. Next, we subtracted the previously
calculated average (78.21) from each sample and stored these
values in column B with the heading **x - xbar**.
In the third column C (labeled **x - xbar squared**), the values in column B
are squared. We calculated a new average by adding up all the values
in column C, and divided the total by the number of samples there
were minus one (57-1) to get the variance . In order to get the standard
deviation, we took the square root of the variance.
The standard deviation is a measure of how far a part numbers are
from each other.

Our range for one standard deviation is the mean plus or minus the standard deviation. This range gives the size of the target required for a 68 percent accuracy; however, my goal is to shoot the ball into the cup with a 95% accuracy. This would require two standard deviations from the average. In another words, two standard deviations below and two standard deviations above the mean.

$$ \begin{align*} range &= (\bar X + 2s)-(\bar X - 2s) \\ &=(78.21 mm +2 \times 29.49 mm)-(78.21-2 mm \times 29.49 mm)=117.96 mm \\ &=117.96 mm \times 0.0393701 \frac{inch}{mm} \\ &= 5.02 \ inch \end{align*} $$Since I have a X-axis standard deviation and a Y-axis standard deviation, I must take the larger of the two standard deviations. The respective results for the X-axis and the Y-axis were about 5.0" and 5.8". This would mean that the cup would require a diameter of about 6 inches, taking the larger of the two standard deviations.