In general orthogonal curvilinear coordinate system, general position in 3 dimension is given by, →s=→s(u1,u2,u3)
For cartesian coordinate system, hi=1
→
→ds=dx^ex+dy^ey+dz^ez
But there is no unique choice of coordinate system, we can also choose spherical coordinate system as,
→ds=dr^er+rdθ^eθ+rsinθdϕ^eϕ
To go from one coordinate system to another, we use the relations, x=x(r,θ,ϕ) y=y(r,θ,ϕ) z=z(r,θ,ϕ)
The only relation we know from our conventional assumption is that, x=rsinθcosϕ y=rsinθsinϕ z=rcosθ
Using the chain rule, dx=∂x∂rdr+∂x∂θdθ+∂x∂ϕdϕ
→ dx=sinθcosϕdr+rcosθcosϕdθ−rsinθsinϕdϕ
Similarly, dy=sinθsinϕdr+rcosθsinϕdθ+rsinθcosϕdϕ
Applying it in our Cartesian equation for "ds", we get, ds=(sinθcosϕdr+rcosθcosϕdθ−rsinθsinϕdϕ)^ex +(sinθsinϕdr+rcosθsinϕdθ+rsinθcosϕdϕ)^ey +(cosθdr−rsinθdθ)^ez
Thus we expressed the infinitesimal displacement in cartesian system using spherical measurements such r,θ,ϕ. Now, from our definition of unit vector, ^er=∂→s∂r|∂→s∂r|
Using the above, equation, we can write the unit vectors along r,θ,ϕ directions as follows, ^er=sinθcosϕ^ex+sinθsinϕ^ey+cosθ^ez
Solving the first two,
sinθ^er+cosθ^eθ=cosϕ^ex+sinϕ^ey
and small displacement "ds" is can be written as, →ds=3∑i∂→s∂uidui
where ∂→s∂ui=hi^ei and ^ei is the unit vector along the 'i'th direction. Rewriting it in simple form, we have, →ds=3∑ihidui^ei
For cartesian coordinate system, hi=1
→
→ds=dx^ex+dy^ey+dz^ez
But there is no unique choice of coordinate system, we can also choose spherical coordinate system as,
→ds=dr^er+rdθ^eθ+rsinθdϕ^eϕ
with corresponding scaling factors.
To go from one coordinate system to another, we use the relations, x=x(r,θ,ϕ) y=y(r,θ,ϕ) z=z(r,θ,ϕ)
The only relation we know from our conventional assumption is that, x=rsinθcosϕ y=rsinθsinϕ z=rcosθ
Using the chain rule, dx=∂x∂rdr+∂x∂θdθ+∂x∂ϕdϕ
→ dx=sinθcosϕdr+rcosθcosϕdθ−rsinθsinϕdϕ
Similarly, dy=sinθsinϕdr+rcosθsinϕdθ+rsinθcosϕdϕ
and dz=cosθdr−rsinθdθ
Applying it in our Cartesian equation for "ds", we get, ds=(sinθcosϕdr+rcosθcosϕdθ−rsinθsinϕdϕ)^ex +(sinθsinϕdr+rcosθsinϕdθ+rsinθcosϕdϕ)^ey +(cosθdr−rsinθdθ)^ez
Thus we expressed the infinitesimal displacement in cartesian system using spherical measurements such r,θ,ϕ. Now, from our definition of unit vector, ^er=∂→s∂r|∂→s∂r|
and ^eθ=∂→s∂θ|∂→s∂θ|
and ^eϕ=∂→s∂ϕ|∂→s∂ϕ|
Using the above, equation, we can write the unit vectors along r,θ,ϕ directions as follows, ^er=sinθcosϕ^ex+sinθsinϕ^ey+cosθ^ez
and ^eθ=cosθcosϕ^ex+cosθsinϕ^ey−sinθ^ez
and ^eϕ=−sinϕ^ex+cosϕ^ey
From these three unit vectors we can solve for the other three unit vectors as following,
Solving the first two,
sinθ^er+cosθ^eθ=cosϕ^ex+sinϕ^ey
Combining with the third we can solve for x and y, ^ex=sinθcosϕ^er+cosθcosϕ^eθ−sinϕ^eϕ
and ^ey=sinθsinϕ^er+cosθsinϕ^eθ+cosϕ^eϕ
and finally solving for z, ^ez=cosθ^er−sinθ^eθ
That is all we do need to derive for the coordinate transformation from cartesian to spherical.