Cylindrical coordinates allow points to be specified using two linear distances
and one angle. These three coordinates are shown on the diagram as:
 r = radius (distance from axis of cylinder)
 h = height (distance along axis of cylinder)
 θ = (sometimes a) = angle around axis.


Cylinder aligned with the z axis
Cylindrical coordinates to Cartesian coordinates
Cartesian coordinates to Cylindrical coordinates

= 
atan2(Cx,Cy) 
√(Cx^{2} + Cy^{2}) 
Cz 

Cylinder aligned with the arbitrary axis
Cylindrical coordinates to Cartesian coordinates
We want to rotate the above so that the h axis is aligned with the arbitrary
axis (Ax, Ay, Az) in other words we want to lookat the point (Ax, Ay, Az) see
lookat

= 
√(Az^{2} + Ay^{2}) 
0 
Ax 
0 
√(Az^{2} + Ax^{2}) 
Ay 
Ax 
Ay 
Az 


Multiplying gives:

= 
√(Az^{2} + Ay^{2}) *
r sin(θ)
+ h*Ax 
√(Az^{2} + Ax^{2}) * r cos(θ)
+ h*Ay 
Ax * r sin(θ)Ay
* r cos(θ)
+ h*Az 

Cartesian coordinates to Cylindrical coordinates
In order to do this we need to invert the above matrix, since this is orthogonal
we can invert by transposing as follows:

= 
√(Az^{2} + Ay^{2}) 
0 
Ax 
0 
√(Az^{2} + Ax^{2}) 
Ay 
Ax 
Ay 
Az 


Multiplying gives,

= 
Cx * √(Az^{2} + Ay^{2})
 Ax * Cz 
Cy * √(Az^{2} + Ax^{2}) Ay * Cz 
Cx * Ax + Cy * Ay +Cz * Az 

So in terms of θ,
r , h

= 
atan2(Cx * √(Az^{2} + Ay^{2})
 Ax * Cz,Cy * √(Az^{2} + Ax^{2}) Ay * Cz) 
√((Cx * √(Az^{2} + Ay^{2})  Ax
* Cz)^{2} + (Cy * √(Az^{2} + Ax^{2}) Ay
* Cz)^{2}) 
Cx * Ax + Cy * Ay +Cz * Az 

Using Tensors
This is more advanced stuff and only really needed if you need to do physics or advanced geometry in curvilinear coordinates.
On the curvilinear coordinates page we saw that the expression of coordinates as a linear equation:
e_{i} A^{i} = e_{1} A^{1} + e_{2} A^{2} + e_{3} A^{3}
can be modified for curvilinear coordinates where either the basis or the components depend on the location:
e(x,y,z)_{i} A^{i} = e(x,y,z)_{1} A^{1} + e(x,y,z)_{2} A^{2} + e(x,y,z)_{3} A^{3}…
or
e_{i} A(x,y,z)^{i} = e_{1} A(x,y,z)^{1} + e_{2} A(x,y,z)^{2} + e_{3} A(x,y,z)^{3}…
where:
 e(x,y,z) is a basis which is a function of position.
 A(x,y,z) are terms which are functions of position.
We have already looked at the situation where the terms are expressed as a function of a global linear coordinate system. Now lets look at the situation where the linear basis is a function of position. There are two ways to do this:
 they can be built along the coordinate axes (axiscolinear) then the basis vectors
transform like covariant vectors.
 they can be built to be perpendicular (normal) to the
coordinate surfaces then the basis vectors transform like contravariant vectors.
Covariant Axis
e_{1} A^{1} + e_{2} A^{2} + e_{3} A^{3} = 
∂x 
e_{1} 
∂θ 
A^{1} + 
∂y 
e_{2} 
∂r^{} 
A^{2} + 
∂z 
e_{3} 
∂h^{} 
A^{3} 
∂θ 
∂x 
∂r 
∂y 
∂h 
∂z 
where:
∂θ 
= 
∂atan2(x,y) 
= 
y 
= 
y 
∂x 
∂x 
1 +(x/y)^{2} 
x^{2}+ y ^{2} 
∂r 
= 
√((x)^{2}) + (y)^{2}) 

= 1 


∂y 
∂y 

∂h 

= 1 




∂z 

where:
∂ 
= cosθ 
∂ 
r^{1}sinθ 
∂ 


∂x 
∂r 
∂θ 


∂ 
= sinθ 
∂ 
+r^{1}cosθ 
∂ 


∂y 
∂r 
∂θ 


∂^{} 
= 
∂ 




∂z 
∂h 




Jacobean
J = 

= 

= 
cosθ 
sinθ 
0 
r^{1}sinθ 
r^{1}cosθ 
0 
0 
0 
1 

Inverse Jacobean
J^{1} = 

= 

= 
cosθ 
sinθ 
0 
r sinθ 
r cosθ 
0 
0 
0 
1 

Contravariant Axis
e_{1} A^{1} + e_{2} A^{2} + e_{3} A^{3} = 
∂θ 
e_{1} 
∂x^{1} 
A^{1} + 
∂r^{} 
e_{2} 
∂x^{2} 
A^{2} + 
∂h^{} 
e_{3} 
∂x^{3} 
A^{3} 
∂x^{1} 
∂θ 
∂x^{2} 
∂r 
∂x^{3} 
∂h 