# how to change polar coordinate into cartesian coordinate using transformation matrix

I would like to change $(3,4,12)$ in $xyz$ coordinate to spherical coordinate using the following relation

It is from the this link. I do not understand the significance of this matrix (if not for coordinate transformation) or how it is derived. Also please check my previous question building transformation matrix from spherical to cartesian coordinate system. Please I need your insight on building my concept.

Thank you.
EDIT::
I understand that $\left [ A_x \sin \theta\cos \phi \hspace{5 mm} A_y \sin \theta\sin\phi \hspace{5 mm} A_z\cos\theta\right ]$ gives $A_r$ but how is other coordinates $(A_\theta, A_\phi)$ equal to their respective respective rows from Matrix multiplication?

-
I did not check if the matrix is correct. However, it represents the change of coordinates in passing to polar coordinates in $\mathbb{R}^3$. $R$ is the norm of $(x,y,z)$, while $\theta$ and $\phi$ are two angles that represents latitude and longitude on the sphere $R=1$. –  Siminore Jun 24 '12 at 11:57
@Siminore i would like to know how $\theta$ and $\phi$ are equal to their respective rows from that matrix multiplication. –  hasExams Jun 24 '12 at 12:00

The transformation from Cartesian to polar coordinates is not a linear function, so it cannot be achieved by means of a matrix multiplication.

-
so what is the purpose of that matrix (what exactly is that matrix)?? –  hasExams Jun 24 '12 at 12:02
I didn't check, but it probably gives a relation between the local bases (sometimes possibly also called the local frame or something like that) of the two coordinate systems. Here in the spherical coordinates the local basis has one vector pointing away from the origin, one pointing "East" and one pointing "North". –  Jyrki Lahtonen Jun 24 '12 at 12:05
anyway thank you for answer –  hasExams Jun 24 '12 at 12:08
@JyrkiLahtonen: Dear Jyrki, What makes the transformation you pointed not to be linear? Is that because of Jacobian matrix of them? –  Babak S. Jun 24 '12 at 14:25
@Babak, I got the impression that the OP wanted to transform the coordinates. So for example $$r=r(x,y,z)=\sqrt{x^2+y^2+z^2}$$ is not a linear function of $(x,y,z)$, and therefore there cannot be a matrix $M$ such that $r=M(x,y,z)^T$. The given matrix will transform a representation of a vector in terms of its coordinates w.r.t. the cartesian basis to the coordinates w.r.t. a local basis. May be I misunderstood what the OP wanted to do? –  Jyrki Lahtonen Jun 24 '12 at 15:10

I have checked the formula on the link to transform from cartesian to spherical co-ords and it is correct. While it is correct that this is a nonlinear transformation for a vector field, the formula represent the correct linear transformation of a vector at any particular point in that field. Hope that helps since you helped me to fine that link.

-

This is not the Matrix you're looking for. For a simple co-ordinate switch you can just use the relations:

\begin{align*}x &= \rho\sin\theta\cos\phi\\ y &= \rho\sin\theta\sin\phi \\ z &= \rho\cos\theta\end{align*}

And the inverse operations:

\begin{align*}\rho &= \sqrt{x^2 + y^2 + z^2}\\ \phi &= \arctan\dfrac yx\\ \theta &= \arctan\left(\frac{\sqrt{x^2 + y^2}}z\right)\end{align*}

However the matrix you've found is for mapping a vector between the co-ordinate systems. For example (using a textbook, Engineering Electromagnetics by Demarest. Example 2-6, p34)

Need to do an integration of $\int( r^3\cos\phi\sin\theta\cdot Ar) d\theta d\phi$

Where $Ar$ is a unit vector in the radial direction. The integral is over phi and theta but also dependent on phi and theta, therefore it's much easier to do this by switching back to cartesian coordinates by the relation:

$$Ar = \sin\theta\cos\phi\cdot Ax + \sin\theta\sin\phi\cdot Ay + \cos\theta\cdot Az$$

Once we substitute that straight in for Ar the integral looks longer but we've removed the dependence inside the integrand, so we can do the integration in a straight forward way.

-

This is actually the matrix used for Rotation. if u have a coordinate of point X, this matrix gives the rotational matrix to find point Y, given theta.

-