# Transforming a matrix from cartesian to spherical coordinates

Consider a variable matrix $$\left[\begin{array}{ccc}a_{11}(x,y,z) \quad a_{12}(x,y,z) \quad a_{13}(x,y,z)\\ a_{21}(x,y,z) \quad a_{22}(x,y,z) \quad a_{23}(x,y,z)\\ a_{31}(x,y,z) \quad a_{32}(x,y,z) \quad a_{33}(x,y,z)\\\end{array}\right] ,$$ elements are real functions. How can we transform this matrix to spherical coordinates based on point $S(x_0,y_0,z_0)$, so that we get another matrix

$$\left[\begin{array}{ccc}a_{11}(r,\varphi,\psi) \quad a_{12}(r,\varphi,\psi) \quad a_{13}(r,\varphi,\psi)\\ a_{21}(r,\varphi,\psi) \quad a_{22}(r,\varphi,\psi) \quad a_{23}(r,\varphi,\psi)\\ a_{31}(r,\varphi,\psi) \quad a_{32}(r,\varphi,\psi) \quad a_{33}(r,\varphi,\psi)\\\end{array}\right] ?$$ I know that transform only the elements of matrix $A$ is not correct. Could you advise me what to do in this case?

• If you just want to transform (x, y, z) to (r, phi, psi) (the domain of definition) then it is irrelevant whether you have a matrix or scalar function. Feb 14, 2014 at 18:25
• I also thought in this way, but one man said that it is not true.I should have multiplied matrix $A$ to 2 matrices, but I don't remember these matrices
– cool
Feb 14, 2014 at 18:29
• You need to make up your mind what kind of mapping you are looking at. If your matrix acts on your (x,y,z) space (as domain of definition or target space) you need to transform the matrix as well. If you just have a map (x,y,z) -> Mat(3,3) then no. Feb 15, 2014 at 7:39

Based on the problem as you have stated we have a matrix: A that can be described as

$$A(x,y,z)$$

where we input x, y, z and get out a matrix A. From here it becomes clear that changing variables is independent of the matrix definition: in other words

$$A(x,y,z) = A(r \sin(\phi_1) \cos(\phi_2 ) , r \sin(\phi_1)\sin(\phi_2), r \cos(\phi_1))$$

=================================================================

I'm going to venture to guess you are doing something involving differentiation/integration on this matrix: since you suggested in your comments "I should have multiplied matrix A [to other matrices]"

Which we can explore here:

Suppose we wish to evaluate

$$\int \int \int A(x,y,z) \partial x \partial y \partial z$$

If we wish to convert to another coordinate system not only does the argument of $A$ change, but... the expression $\partial x \partial y \partial z$ is going to have change as well:

goes into more detail but we will sketch it out with your example:

The reason we can't simply throw down $\partial r$ $\partial \phi_1$ $\partial \phi_2$ is that the infinitesmal change in volume by integrating with respect to this system is different than standard cartesian coordinates. Recall from calculus I:

that to grab an area under a curve $f$ in cartesian coordinates we simply evaluate:

$$\int_{a}^{b} y(x) dx$$

but in polar the formula became

$$\frac{1}{2} \int_{a}^{b} r(\phi)^2 d\phi$$

notice that the answer really should've been just r but instead become $r^2$ where the extra r is the scaling factor and we need to calculate that for all integrals.

To compute the scaling factor simply take function:

$$[x(r, \phi_1 ,\phi_2),y(r, \phi_1 ,\phi_2),z(r, \phi_1 ,\phi_2)$$

and compute its jacobian which is the matrix of partial derivatives with respect to $r$, $\phi_1$, and $\phi_2$. And then take the determinant of said matrix (followed by absolute value of it) and multiply it with your answer.

if you go through the work you get a scale factor of: $r^2 \sin(\phi_2)$ that needs to be multipl