# Coordinates transformation by rotating at the origin.

1. Jun 17, 2013

### yungman

I want to transform from rectangular coordinates ( xyz) to (x",y",z") rectangular coordinates that is rotated at the origin as show in the attachment. Then I want to transform (x",y",z") rectangular coordinates into Spherical coordinates.

Attach is the method I use, I want to verify I am doing it correctly. Basically I want to transform the xyz into any position on the SAME ORIGIN as shown in Fig.1. I first rotate along z axis on the xy plane as shown in Fig.2. I rotate clockwise as shown by angle $\alpha$. I called the new coordinates as (x',y',z') as intermediate coordinates. Then the second step is to rotate along x' axis as shown in Fig. 3 by angle $\beta$ to get the final (x",y",z") coordinates. I also show my work step by step in the drawing attached.

[PLAIN]http://i43.tinypic.com/2uxwt52.jpg[/PLAIN]

Then the final step of transforming to Spherical coordinates is by the same method like

$$\hat R=\hat x''(\hat x''\cdot \hat R)+\hat y''(\hat y''\cdot\hat R)+\hat z''(\hat z''\cdot\hat R)$$

Am I correct?

Thanks a million.

2. Jun 18, 2013

### SteamKing

Staff Emeritus
3. Jun 18, 2013

### SteamKing

Staff Emeritus
These manipulations are much clearer and simpler when put into matrix form.

See: http://www.cs.brandeis.edu/~cs155/Lecture_07_6.pdf

This is standard stuff for a lot of computer work with 3-D coordinates.

4. Jun 18, 2013

### yungman

Thanks for the information. What topic is this under? I took a quick look at a Linear Algebra text book and I didn't see it.

Also, Do you have the transformation from one Spherical coordinates to another Spherical coordinates? eg. From (R,θ,∅) to (R',θ',∅')?

Also, any online calculator for 3D rotation?

Thanks

5. Jun 18, 2013

### SteamKing

Staff Emeritus
In general, rotations and translations of coordinates should be addressed under analytic geometry. Matrices are useful in topics besides linear algebra.

It's not clear to me what the difference is between your two sets of spherical coordinates.

6. Jun 18, 2013

### yungman

Can you give a suggestion on a book? I am working through the article you provided to verify.

I am not a math major, I am using this in Antenna design. The problem I am working on is that the dipole ( which is just like a vector) is situated at the origin but point to some direction. The field it is radiating out is in the $\hat \theta$' direction RESPECT to the dipole ( as if the dipole is pointing at +z' direction of it's own coordinates (R',$\theta$',$\phi$')). I need to find the direction of the field at a point P in the normal ($R,\theta,\phi$) coordinates.

Thanks for all your help.

Alan

Last edited: Jun 18, 2013
7. Jun 18, 2013

### yungman

I am trying to verify my work with the notes you gave. For CCW rotation about the z-axis, it is given:

$$\left( \begin{array} \;x' \\ y' \\ z' \\ 1\end{array}\right)=\left(\begin{array} \;\cos \theta & -\sin\theta & 0 & 0\\ \sin\theta & \cos\theta & 0 & 0\\0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{array}\right) \left( \begin{array} \;x \\ y \\ z \\ 1 \end{array}\right)$$

To conform to the Right Hand notation, I just let $\cos\theta=\cos (2\pi-\alpha)=\cos\alpha\;$ and $\;\sin\theta=-\sin(2\pi-\alpha)=-\sin\alpha\;$ to give:

$$\left( \begin{array} \;x' \\ y' \\ z' \\ 1\end{array}\right)=\left(\begin{array} \;\cos \theta & -\sin\theta & 0 & 0\\ \sin\theta & \cos\theta & 0 & 0\\0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{array}\right) \left( \begin{array} \;x \\ y \\ z \\ 1 \end{array}\right)=\left(\begin{array} \;\cos \alpha & \sin\alpha & 0 & 0\\ -\sin\alpha & \cos\alpha & 0 & 0\\0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{array}\right)\left( \begin{array} \;x \\ y \\ z \\ 1 \end{array}\right)$$

This implies $x'=x\cos\alpha-y\sin\alpha\;$ and $y'=-x\sin\alpha+y\cos\alpha$.
But if you look at step 1 in my notes in post #1. It is different. I triple checked my work and I am confident I am correct.

The most important thing is to look at the graph physically. If you rotate about z axis clockwise by $\alpha$, the y component has to be negative agreeing with my derivation in post #1.

Last edited: Jun 18, 2013
8. Jun 18, 2013

### yungman

Also is

$$\left( \begin{array} \;x' \\ y' \\ z' \\ 1\end{array}\right)=\left(\begin{array} \;\cos \alpha & -\sin\alpha & 0 & 0\\ \sin\alpha & \cos\theta & 0 & 0\\0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{array}\right) \left( \begin{array} \;x \\ y \\ z \\ 1 \end{array}\right)$$

really means

$$\left( \begin{array} \;\hat x' \\ \hat y' \\ \hat z' \\ 1\end{array}\right)=\left(\begin{array} \;\cos \alpha & -\sin\alpha & 0 & 0\\ \sin\alpha & \cos\theta & 0 & 0\\0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{array}\right) \left( \begin{array} \;\hat x \\ \hat y \\ \hat z \\ 1 \end{array}\right)$$

As this is vector translations.

Also, why do we have the "1" inserted in to make it a 4X4 instead 3X3 array for calculation? I try eliminating the "1" and calculate as 3X3 array and it gave the same result.

$$\left( \begin{array} \;\hat x' \\ \hat y' \\ \hat z' \end{array}\right)=\left(\begin{array} \;\cos \alpha & -\sin\alpha & 0 \\ \sin\alpha & \cos\theta & 0 \\0 & 0 & 1 \end{array}\right) \left( \begin{array} \;\hat x \\ \hat y \\ \hat z \end{array}\right)$$

Thanks

9. Jun 18, 2013

### SteamKing

Staff Emeritus
The '1' in the lower right hand cell of the transformation matrix is there in order to make what is called an 'affine transformation'. More explanations are given here:

http://en.wikipedia.org/wiki/Cartesian_coordinate_system

I didn't check your OP too closely. The positive rotations in coordinate transformation generally follow the right hand rule. Check your assumptions to see if they are also right-handed.

In the right hand convention, the following cross products give a positive result:

i x j = k
j x k = i
k x j = i

where i, j, k are the three unit vectors for a cartesian coordinate system.

10. Jun 18, 2013

### yungman

Thanks for your time helping me repeatedly.

Before today, I don't even know this is a big topics. I derived my OP just from dot products. In my example as shown in Fig.2, I used Left Hand rotation ( notation) for not knowing any better. To conform to the Right Hand notation, I just let $\cos\theta=\cos (2\pi-\alpha)=\cos\alpha\;$ and $\;\sin\theta=-\sin(2\pi-\alpha)=-\sin\alpha\;$ to give:

$$\left( \begin{array} \;x' \\ y' \\ z' \\ 1\end{array}\right)=\left(\begin{array} \;\cos \theta & -\sin\theta & 0 & 0\\ \sin\theta & \cos\theta & 0 & 0\\0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{array}\right) \left( \begin{array} \;x \\ y \\ z \\ 1 \end{array}\right)=\left(\begin{array} \;\cos \alpha & \sin\alpha & 0 & 0\\ -\sin\alpha & \cos\alpha & 0 & 0\\0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{array}\right)\left( \begin{array} \;x \\ y \\ z \\ 1 \end{array}\right)$$

This implies $x'=x\cos\alpha-y\sin\alpha\;$ and $y'=-x\sin\alpha+y\cos\alpha$.

From looking at Fig.2 in my original drawing, I just cannot agree with the outcome. The most important thing is to look at the graph physically. If you rotate about z axis clockwise by $\alpha$, the y component of x' has to be negative agreeing with my derivation in post #1. Also, both x and y component of y' have to be both positive as $\hat y'$ is in the first quadrant on the xy plane.

Thanks

Alan

Last edited: Jun 19, 2013
11. Jun 18, 2013

### SteamKing

Staff Emeritus
A basic property of even functions is that f(-x) = f(x), while for odd functions f(-x) = -f(x).

cos(x) is an even function, while sin(x) is an odd function. A check of the graph of sin and cos confirms this.

12. Jun 18, 2013

### yungman

I just make a big update on my post #7 and #10 to transform my LH notion to RH notion by letting $\theta =2\pi-\alpha$. And I went through the derivation to show it is NOT agreeing with my OP.

Last edited: Jun 19, 2013
13. Jun 19, 2013

Anyone?