Let the initial velocity of the projectile be $u$. The angle of projection is $\theta = 45^\circ$.
Let the ball be at a certain height $h$ at times $t_1=2$s and $t_2=8$s.
The equation for the vertical position of a projectile is $y = (u\sin\theta)t - \frac{1}{2}gt^2$.
For a given height $h$, we have $h = (u\sin\theta)t - \frac{1}{2}gt^2$, which can be rearranged into a quadratic equation in $t$:
$\frac{1}{2}gt^2 - (u\sin\theta)t + h = 0$.
The roots of this equation are the times when the projectile is at height $h$. We are given these times as $t_1=2$s and $t_2=8$s.
From the properties of quadratic equations, the sum of the roots is $t_1 + t_2 = \frac{-(-u\sin\theta)}{g/2} = \frac{2u\sin\theta}{g}$.
We know that the total time of flight of a projectile is $T = \frac{2u\sin\theta}{g}$.
Therefore, the total time of flight is $T = t_1+t_2 = 2+8 = 10$ s.
The horizontal motion of a projectile is uniform motion with velocity $v_x = u\cos\theta$.
The horizontal distance between the two points is the distance traveled horizontally between $t_1=2$s and $t_2=8$s.
Horizontal distance $d = v_x \times (t_2 - t_1) = (u\cos\theta)(8-2) = 6u\cos\theta$.
We need to find $u\cos\theta$. From the time of flight formula:
$T = 10 = \frac{2u\sin(45^\circ)}{10} \implies 100 = 2u(\frac{1}{\sqrt{2}}) \implies u = \frac{100\sqrt{2}}{2} = 50\sqrt{2}$ m/s.
Now, $u\cos\theta = (50\sqrt{2})\cos(45^\circ) = (50\sqrt{2})(\frac{1}{\sqrt{2}}) = 50$ m/s.
Finally, the horizontal distance is $d = 6 \times (u\cos\theta) = 6 \times 50 = 300$ m.