In cylindrical coordinates, positions are defined using three parameters: the radial distance \rho, the azimuthal angle \phi, and the height z. These coordinates offer a way to locate any point in three-dimensional space based on its distance from a reference axis (usually the z-axis), an angle around that axis, and a height along the axis. The conversion from cylindrical to Cartesian coordinates involves expressing the Cartesian coordinates (x, y, z) in terms of \rho, \phi, and z.
The Cartesian coordinate x is obtained by projecting the radial distance \rho onto the x-axis, modulated by the cosine of the azimuthal angle \phi, leading to:
x = \rho \cos(\phi).
Similarly, the y coordinate is obtained by projecting \rho onto the y-axis, modulated by the sine of \phi, resulting in:
y = \rho \sin(\phi).
The z coordinate remains the same in both coordinate systems:
z = z.
The azimuthal angle \phi represents the angle in the xy-plane from the positive x-axis to the projection of the point onto the xy-plane.
The transformations from cylindrical to Cartesian coordinates are expressed as:
\begin{aligned} & x = \rho \cos(\phi), \\ & y = \rho \sin(\phi), \\ & z = z. \end{aligned}
The inverse transformation from Cartesian to cylindrical coordinates involves converting the Cartesian coordinates (x, y, z) to the cylindrical coordinates (\rho, \phi, z). The equations for this conversion are:
\begin{aligned} & \rho = \sqrt{x^2 + y^2}, \\ & \phi = \begin{cases} \arctan\left(\frac{y}{x}\right) & \text{if } x > 0, \\ \arctan\left(\frac{y}{x}\right) + \pi & \text{if } x < 0 \text{ and } y \geq 0, \\ \arctan\left(\frac{y}{x}\right) - \pi & \text{if } x < 0 \text{ and } y < 0, \\ +\frac{\pi}{2} & \text{if } x = 0 \text{ and } y > 0, \\ -\frac{\pi}{2} & \text{if } x = 0 \text{ and } y < 0, \\ \text{undefined} & \text{if } x = 0 \text{ and } y = 0, \end{cases} \\ & z = z. \end{aligned}
These formulas accurately represent points in cylindrical coordinates regardless of their position in 3D space, taking into account the full range of possible spatial relationships between a point and the coordinate axes.