<em>[see the attached figure for a better understanding of my notations]
</em><span>
All the angles below are in radians unless written otherwise
</span><span>

: mass of the ball
</span><span>

: angle by which the ground is inclined (here

)
</span><span>

: initial angle of the throw
</span><span>

: acceleration due to gravity,

</span><span>

: vertical unit vector, pointing upwards
</span><span>

: horizontal unit vector, pointing to the right
</span><span>

: x,y-position of the ball
</span><span>

: ball's acceleration
</span><span>

: ball's speed
</span><span>

: ball's position
</span><span>

: initial ball's speed
</span><span>
I don't now how much you know in physics, so I'll try to break this down as much as possible.
</span><span>
The only force that is applied on the ball when it's falling is gravity

.</span><span> By Newton's second law,

hence by integrating with respect to time,

which by integrating once more yields

</span><span>
Thus

. That last one gives

hence

</span><span>
The ball stops when it intersects with the slope defined by

hence if we call

the abscissa of the the intersection point,

hence

where

.
</span><span>
To find the maximum of

, we derive the function and solve

which is equivalent to

. Using the well known formula

we get

. The discriminant of this equation is

hence the unique positive solution is

thus

<span>
In our case

hence

, which is the optimum angle to get a maximum range.</span></span>