I am going to start with the equation where x represents distance, a is acceleration and t is time and is initial velocity
So the total horizontal distance the ball will travel is as there is no air resistance so there is no acceleration in the horizontal direction and 95cos(42) is initial velocity in the horizontal direction. So x=95cos(42)t and we need to find what t is by finding out how long the ball will be in the air.
So for the vertical distance and time, we want the ball to end up on the ground, so height = 0... so using the same distance equation
and solving this we find that t=13.059 (we ignore the negative value for t, it arises because this function is a parabola)
So now that we have t=13.059, x=95cos(42)*13.059=921.942
Using a bit of physical intuition, if a ball travels over 900 feet, then it must be higher than 5 feet off the ground when it has travelled 310 feet (under any type of normal baseball conditions anyway), still to prove it...
We know need to find how long it takes the ball to reach 310 feet, so using the horizontal equation, and t=4.391
And so now we need to find how high the ball is at time t=4.391
and we get y=190, so when the ball is 310 feet from home plate, it is 190 feet in the air, so it clears the fence and the hitter is probably on steroids...
45 degrees maximizes horizontal distance because at 45 degrees, the initial velocities in both the x and y directions are equal. This leads to maximizing horizontal distance