I am working through a problem where the vector has a Cartesian term and want to convert it to spherical::

(Sorry, I couldn't figure out how to use the equation editor)

sqrt(x^2+y^2)/sqrt(X^2+y^2+z^2) (x component of vector)

I know:

r=sqrt(x^2+y^2+z^2)

x=rsin\theta cos\phi

y=rsin\theta sin\phi

z=rcos\theta

I also know the answer is:

(rsin\phi )/r = sin\phi

I can't figure out how rsin\phi = sqrt(x^2=y^2) in the answer.