Spherical coordinates uses two angles to specify the direction of a 3d vector and its length to locate a point in space.

The relationship between the spherical coordinates and the 3D Cartesian coordinates is the following:

conventions of spherical coordinates

Note that there are two set of convention for spherical coordinates, “physics convention” or “mathematical convention”:

physics conventionmathematics convention
Spherical coordinates 1.svg3D_Spherical_2.svg
polar angle and azimuthal angle The meanings of and is swapped
Link to original

This note uses the physics convention.