# Polar Coordinates Conversion

1. Mar 8, 2015

### roam

1. The problem statement, all variables and given/known data
I am trying to convert the following vector at (1, 1, 0) to cylindrical polar coordinates, and show that in both forms it has the same direction and magnitude:

$4xy\hat{x}+2x^2\hat{y}+3z^2\hat{z}$

2. Relevant equations

$\rho^2=x^2+y^2$

$tan \phi = \frac{y}{x}$

$z=z$

3. The attempt at a solution

So for the Cartesian we have:

$|V|=\sqrt{(4(1)(1))^2+(2(1)(1))^2+(3(0))^2} = \sqrt{20}$

But how can we find the direction? I know how to find the direction angle using trigonometry in the 2D case, but how does one do this in the 3D situation?

Now to convert to cylindrical I am using the above relationships we get:

At that point we have x=4(1)(1)=4, y=2(1)=2, and z=3(0)=0. So

$\rho=\sqrt{20}$

$z=0$

$\phi= tan^{-1} (1/2)$ ($\phi$ being the azimuth angle)

Do we use degrees here?

Now how do we find the magnitude in this polar form? Unfortunately my lecture notes does not explain this.

Any explanation or link is greatly appreciated.

2. Mar 8, 2015

### HallsofIvy

Staff Emeritus
You cannot give a direction in three dimensions as a single number. One thing you can do is give the "direction cosines". They are the cosines of the angles the vector makes with each of the coordinate axes in turn. And cosine is "near side divided by hypotenuse". The "hypotenuse" is, of course, the length of the vector and the "near side" is the component in the direction of the given axis. In other words, the three "direction cosines" for the vectors <a, b, c> are $\frac{a}{\sqrt{a^2+ b^2+ c^2}}$, $\frac{b}{\sqrt{a^2+ b^2+ c^2}}$, and $\frac{c}{\sqrt{a^2+ b^2+ c^2}}$.
In other words, the "direction cosines" of a vector are precisely the components of a unit vector in that direction.

Unless you are dealing with a problem that specifically gives angles in polar form, you should always use radians, not degrees. A for "what is the magnitude", whether you are writing a vector in Cartesian or Polar form, it is still the same vector and it length (magnitude) does not change.

3. Mar 8, 2015

### vela

Staff Emeritus
Are you sure of what you're being asked to do? My interpretation of the problem is that you're being asked to express the vector in the form $A_\rho\hat{\rho} + A_\phi\hat{\phi}+A_z\hat{z}$ where $\hat{\rho}$, $\hat{\phi}$, and $\hat{z}$ are the cylindrical-coordinate unit vectors at the point (1, 1, 0).

4. Mar 9, 2015

### roam

Thank you so much.

So for the Cartesian case, the three direction cosines would be:

$cos a = \frac{A_x}{\sqrt{(A_x)^2+ (A_y)^2+ (A_z)^2}} = \frac{4}{\sqrt{20}} \implies a = 0.46 \ rad$

Here a is the angle the unit vector $\hat{x}$ makes with x-axis.

Similarly, $cos b = \frac{2}{\sqrt{20}} \implies b = 1.107 \ rad$, and $c=0 \ rad$, with respect to y and z-axes respectively.

Is this the correct idea?

I think I need to apply this "direction cosines" method to the cylindrical polar form (the point of the exercise, I believe, is to show that in both coordinate systems the direction is the same).

5. Mar 9, 2015

### roam

Thank you for your response. The question only asks to find the magnitude and direction in Cartesian, then convert it to cylindrical form and show that it still has the same direction and magnitude as the other counterpart.

I think for the unit vectors I need to use the following conversion matrix:

$\begin{pmatrix} cos \phi & sin \phi & 0\\ -sin \phi & cos \phi & 0\\ 0 & 0 & 1 \end{pmatrix}$

Since at the point (1, 1, 0), $x=4, \ y =2 \implies \phi = \tan^{-1} (y/x)= 0.46 \ rad$

So here's what I did:

$\begin{pmatrix} \hat{\rho} \\ \hat{\phi} \\ \hat{z} \end{pmatrix} = \begin{pmatrix} cos (0.46) & sin (0.46) & 0\\ -sin (0.46) & cos (0.46) & 0\\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} \hat{x} \\ \hat{y} \\ \hat{z} \end{pmatrix}$

This yields the following:

$\hat{\rho} = 0.89 \hat{x} + 0.44 \hat{y}$

$\hat{\phi} = 0.89 \hat{x} - 0.44 \hat{y}$

$\hat{z}=\hat{z}$

Is this what we need?

And to transform x, y, z, do I need to use these relations:

$x = \rho \ cos \phi \implies 4xy = \rho (0.89)$

$y = \rho \ sin \phi \implies 2x^2 = \rho (0.44)$

$z=z =3z^2$

I'm confused here, I'm not sure how to work out $A_\rho, A_\phi, A_z$ in $A_\rho\hat{\rho} + A_\phi\hat{\phi}+A_z\hat{z}$.

6. Mar 10, 2015

### roam

Finally, I've managed to get the correct cylindrical form. But I've encountered another problem. Here is what I did:

$\begin{pmatrix} \hat{\rho} \\ \hat{\phi} \\ \hat{z} \end{pmatrix}\begin{pmatrix} cos \phi & sin \phi & 0\\ -sin \phi & cos \phi & 0\\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 4xy \\ 2x^2 \\ 3z^2 \end{pmatrix}$

Using the relations in my first post above we get:

$A_\rho = 4 \rho^2 cos^2 \phi sin \phi + 2 \rho^2 cos^2 \phi sin \phi$

$A_\phi = -4 \rho^2 cos \phi sin^2\phi + 2 \rho^2 cos^3 \phi$

$A_z = 3z^2$

I've been told that this is the correct cylindrical polar form. I then substituted $\rho=\sqrt{20}, \ \phi=0.463, z=0$ (as found above) into this to find the magnitude of the Cylindrical vector field at (1, 1, 0). Here is what I did:

$|A|= \sqrt{A_\rho^2 +A_\phi^2 +A_z^2}= \sqrt{42.9^2+14.37^2+0^2} = 45.24$

But this answer is clearly wrong, because for the Cartesian case we had $|A|=\sqrt{20}$. So why is this wrong, and how can I get the correct magnitude? (I need to confirm that in both cases the magnitudes equal)

Last edited: Mar 10, 2015
7. Mar 10, 2015

### roam

Shouldn't the magnitude be the same in both coordinate systems?

8. Mar 10, 2015

### SammyS

Staff Emeritus
Yes, it should.

You are confusing components of the vector, Aρ, Aφ, and Az with the direction of the cylindrical-coordinate unit vectors at (x, y, z) = (1, 1, 0).

Last edited: Mar 10, 2015
9. Mar 12, 2015

### roam

Yes, thank you.

So:

$\begin{pmatrix} A_\rho \\ A_\phi \\ A_z \end{pmatrix}\begin{pmatrix} cos \phi & sin \phi & 0\\ -sin \phi & cos \phi & 0\\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 4xy \\ 2x^2 \\ 3z^2 \end{pmatrix}$

$4xy cos \phi + 2x^2 sin \phi$
$-4xy sin \phi + 2x^2 cos \phi$
$3z^2 \end{pmatrix}$

Using the relationships $x=\rho cos \phi, \ y= \rho sin \phi, \ z=z$ we get:

$A_\rho = 6 \rho^2 cps^2 \phi sin \phi$
$A_\phi = -4\rho^2 cos \phi sin^2 \phi + 2 \rho^2 cos^3 \phi$
$A_z =3z^2$

Substituting values for (1, 1, 0) we get the correct answer of $||A||=\sqrt{20}$. Correct answer!

But now now I still have trouble finding the direction of the cylindrical form (to confirm it has the same direction as the Cartesian one)...

10. Mar 12, 2015

### roam

In the Cartesian case we had with respect to x-axis: $A(1,1,0)=4(1)(1) \hat{x} + 2(1)^2 \hat{y} + 3 (0)^2 \hat{z} = 4 \hat{x} + 2 \hat{y}$

And the angle with respect to x-axis was $\phi= tan^{-1} (A_y/A_x)=0.46 \ rad$

I even worked out the "direction cosines", as suggested by HallsofIvy.

In cylindrical form we have $A(1,1,0)=(4 cos (0.46)+2 sin(0.46)) \hat{\rho} + (2 cos (0.46) - 4 sin (0.46))\hat{\phi}$

$=4.4721 \hat{\rho} + 0.0163 \hat{\phi}$

How can I use this to show that it has the same direction as the Cartesian counterpart?

(P.S. I'm also not sure how the "direction cosines" apply to the cylindrical case)

11. Mar 12, 2015

### SammyS

Staff Emeritus
You need to find the direction of each of $\hat{\rho}$ and $\hat{\phi}$ at the point (x,y,z)=(1,1,0).

Also, I'm pretty sure that to find the cylindrical components of A, the values of $\rho\text{ and } {\phi}$ you should use are based on the point (x,y,z)=(1,1,0) .

12. Mar 12, 2015

### roam

But how do I do that?

I mean, using (1,1,0) I worked out $\rho = \sqrt{x^2+y^2}=\sqrt{2}$ and $\phi=tan^{-1}(y/x)=0.46 \ rad$. But how do I find their direction?

I know that $\hat{\rho}= cos \phi \hat{x} + sin \phi \hat{y}$ and $\hat{\phi}= -sin \phi \hat{x} + cos \phi \hat{y}$ but I'm not sure if that helps...

13. Mar 12, 2015

### SammyS

Staff Emeritus
OK.

I see you did use that angle. Of course, tan-1(1) is better known as 45° = π/4 radians. (I didn't recognize 0.46 rad as being approx = π/4 rad .)

The z-component of vector A is zero, so verifying the angle can be simplified. Right?

What angle does A make with $\hat{\rho}$ and what angle does $\hat{\rho}$ make with the x-axis?

14. Mar 12, 2015

### roam

It was actually $tan^{-1}(1/2)=0.46 \ rad$.

When we have the expression for $\hat{\rho}$ and A (in cylindrical), how do we calculate the angle between the two vectors? (That's my question)

15. Mar 12, 2015

### SammyS

Staff Emeritus
That's $\hat{\phi}$ for the x & y components of vector A so that's not π/4. (I didn't use a calculator, but should have recognized that.)

So, back to what I said in post #11. Use ${\phi}$ based on (1, 1, 0) .

16. Mar 12, 2015

### roam

Following your advice in post #11, at point (x,y,z)=(1,1,0) and by substituting $\phi=0.46$ we have:

$\hat{\phi}=-4 sin \phi + 2 cos \phi = 0.0163$

$\hat{\rho}=4 cos \phi + 2 sin \phi = 4.4721$

How does this establish that the vector now in its cylindrical form, has the same direction as the Cartesian counterpart?

17. Mar 12, 2015

### SammyS

Staff Emeritus
First of all, $\phi\ne 0.46\$ . At (1, 1, 0), $\phi=\pi/4\approx 0.785398\$ .

Beyond that, what you have above are not unit vectors.

Using the correct $\ \phi$ ,
$A_{\phi}=-4 \sin \phi + 2 \cos \phi$
$A_{\rho}=4 \cos \phi + 2 \sin \phi$