Answer
a) $0\leq \phi \leq \pi$
b) $0\leq \theta \leq 2 \pi, 0\leq \phi \leq \pi/2$
Work Step by Step
Conversion of rectangular to spherical coordinates is as follows:
$x=\rho \sin \phi \cos \theta; y=\rho \sin \phi \sin \theta;z=\rho \cos \phi$
and
$\rho=\sqrt {x^2+y^2+z^2}$;
$\cos \phi =\dfrac{z}{\rho}$; $\cos \theta=\dfrac{x}{\rho \sin \phi}$
a) when the ball is in the xy direction, we have $0\leq \theta \leq 2 \pi$
when the entire ball is in the z-direction, then we have $0\leq \phi \leq \pi$ because if we count $2 \pi$ this would count the whole area twice.
b) when the ball is in the xy direction, then we have $0\leq \theta \leq 2 \pi$
when the entire ball is in the z-direction, then we have $0\leq \phi \leq \pi$ because if we count $2 pi$ this would count the whole area twice.
Further, when we consider the top half of the circle as opposite to a side half, then we have:
$0\leq \theta \leq 2 \pi, 0\leq \phi \leq \pi/2$