# Homework Help: Converting from Cartesian to Cylindrical coords - but division by zero

1. Sep 4, 2008

### VinnyCee

Converting from Cartesian to Cylindrical coords - but division by zero!!!

1. The problem statement, all variables and given/known data

Let's say I want to convert the point P(0, -4, 3) to cylindrical.

To convert from Cartesian to Cylindrical coordinates, one must use the formulas listed below.

2. Relevant equations

$$\rho\,=\,\sqrt{x^2\,+\,y^2}$$

$$\phi\,=\,tan^{-1}\left(\frac{y}{x}\right)$$

$$z\,=\,z$$

3. The attempt at a solution

What do I do about the division by zero produced by using the second equation for $\phi$?

$$\phi\,=\,tan^{-1}\left[\frac{(-4)}{(0)}\right]$$

2. Sep 4, 2008

### untoldstory

Re: Converting from Cartesian to Cylindrical coords - but division by zero!!!

Becuase your point is P(0, -4, 3), really your on a 2D plane. But to explain this mathematically,

$$\arctan^{-1}\left(\frac{-4}{0}\right) = \arctan^{-1}(\infty) = \frac{\pi}{2}$$

which is 90 degrees, so $$\rho$$ = $$\frac{\pi}{2}$$

and the rest should be straight forward. Hope that helps you.

3. Sep 4, 2008

### untoldstory

Re: Converting from Cartesian to Cylindrical coords - but division by zero!!!

I guess I should complete the question so:

$$\rho = \sqrt{0^2 + (-4)^2} = \sqrt(8) = 2\sqrt{2}$$
$$\phi = \frac{\pi}{2} = 1.57$$ (as shown above)
z = 3

Putting this as a vector,
$$(\rho,\phi,z)= (2\sqrt{2},1.57,3)$$

That should be the answer... but it seems a bit messy

4. Sep 4, 2008

### VinnyCee

Re: Converting from Cartesian to Cylindrical coords - but division by zero!!!

Thanks! That -4/0 = $\infty$ should have been obvious to me!

Untoldstory, $$\sqrt{(0)^2\,+\,(-4)^2}\,=\,4$$, but otherwise it's correct:)

5. Sep 4, 2008

### D H

Staff Emeritus
Re: Converting from Cartesian to Cylindrical coords - but division by zero!!!

That is not quite the right equation for the angle. Think about it this way: What if x=y=-1? Your equation gives $\phi=\arctan(-1/-1)=\arctan(1)=\pi/2$. Converting back to cartesian yields x=y=1. The problem is that the range of the inverse tangent is pi radians, but the angle needs to range over a full circle, 2*pi radians. You need to take the quadrant of the arguments into account. If you don't you will get a wrong answer. For example, 90 degrees (or pi/2) is the wrong answer.

It is always a good idea to do a sanity check on your answers when working out problems. In this case, the sanity check is to convert back to cartesian to see if you get the same point you started with.

Last edited: Sep 4, 2008
6. Sep 4, 2008

### VinnyCee

Re: Converting from Cartesian to Cylindrical coords - but division by zero!!!

So, on an x-y plane, the coordinates (0,-4) is on the negative y-axis between the third and fourth quadrants. So the angle is not really 90 degrees, but 270 degrees? Is that correct?

7. Sep 5, 2008

### D H

Staff Emeritus
Re: Converting from Cartesian to Cylindrical coords - but division by zero!!!

Correct. Wikipedia gives one way to do this: http://en.wikipedia.org/wiki/Polar_coordinates#Converting_between_polar_and_Cartesian_coordinates

I like the simpler

$$\phi = \begin{cases} \quad\arctan\frac y x & x > 0 \\ \pi - \arctan\frac y {-x} & x < 0 \\ \quad\;\phantom{-}\,\frac {\pi} 2 & x = 0, y > 0 \\ \quad\;-\,\frac {\pi} 2 & x = 0, y < 0 \end{cases}$$

and of course the angle is undefined if x=y=0.

8. Sep 5, 2008

### HallsofIvy

Re: Converting from Cartesian to Cylindrical coords - but division by zero!!!

(0, -4, 3) has z= 3 and (x,y)= (0, -4). That point is on the y-axis, 4 units below the origin: r= 4, and $\theta= -\pi/4$ or $\theta= 3\pi/4$.