We can derive that the range of a ball is:
x=\frac{V^2 \sin 2\theta}{g}
The maximum range occurs at 45 degrees (can be shown mathematically)
x_{max}=\frac{V^2}{10}
We are going to assume g=10.
Now to calculate V, we know that he can throw vertically upwards a ball for 40m, lets find the...