2
$\begingroup$

Context

This is an interim problem related to a Green's function solution for a boundary-value problem in the cylindrical coordinate system.

Question

How do I convert $(x-x')^2 + (y-y')^2 + (z-z')^2$ to cylindrical coordinate system?

My worked solution is given in the answer below.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

$$(x-x')^2 + (y-y')^2 + (z-z')^2 =r^2 + {r'}^2 -2\,r\,{r}' \,\cos\left(\theta - \theta'\right) + (z-z')^2$$

My attempt

I know that to tranform from Cartesian to cylindrical requires the following three equations \begin{align} r &= \sqrt{x^2 + y^2} \\ \theta &= \arctan{\left(\frac{y}{x}\right)} \\ z &= z \quad. \end{align}

Directly, the question reduces to how to covert the following to cylindrical system. $$(x-x')^2 + (y-y')^2.$$ Its natural to begin with $r$ and $r'$. \begin{align} (x-x')^2 + (y-y')^2 &= x^2 - 2\,x\,x' +{x'}^2 + y^2 - 2\,y\,{y'} +{y'}^2 \\ &= x^2 + y^2 +{x'}^2 +{y'}^2 - 2\,x\,x' - 2\,y\,{y'} \\ &= r^2 +{r'}^2 - 2\,x\,x' - 2\,y\,{y'} \end{align} Now the problem is to convert $ - 2\,x\,x' - 2\,y\,{y'} $ to cylindrical coordinate system.

The next part of the answer required trial and error, and some good fortune. \begin{align*} r\,r' \,\cos\left(\theta - \theta'\right) &= \sqrt{\left(x^2 + y^2\right)\,\left( {x '}^2 + {y'}^2\right)}\,\cos\left(\arctan{\frac{y}{x}} - \arctan{\frac{y'}{x'}}\right) \\ &= \sqrt{\left(x^2 + y^2\right)\,\left( {x '}^2 + {y'}^2\right)}\,\cos\left(\arctan{\frac{\frac{y}{x} - \frac{y'}{x'}}{1+ \frac{y}{x} + \frac{y'}{x'}}} \right) \\ &= \sqrt{\left(x^2 + y^2\right)\,\left( {x '}^2 + {y'}^2\right)}\,\cos\left(\arctan{\frac{\frac{y}{x} - \frac{y'}{x'}}{1+ \frac{y\,y'}{x\,x'} }} \right) \\ &= \sqrt{\left(x^2 + y^2\right)\,\left( {x '}^2 + {y'}^2\right)}\,\cos\left(\arctan{\frac{ y\, x' - y'\,x }{x\,x'+ y\,y' }} \right) \\ &= \sqrt{\left(x^2 + y^2\right)\,\left( {x '}^2 + {y'}^2\right)}\,\frac{1}{\sqrt{1+\left(\frac{ y\, x' - y'\,x }{x\,x'+ y\,y' }\right)^2}} \\ &= \sqrt{\left(x^2 + y^2\right)\,\left( {x '}^2 + {y'}^2\right)}\,\frac{x\,x'+ y\,y' }{\sqrt{(x\,x'+ y\,y' )^2+\left( y\, x' - y'\,x \right)^2}} \\ &= \sqrt{\left(x^2 + y^2\right)\,\left( {x '}^2 + {y'}^2\right)}\,\frac{x\,x'+ y\,y' }{\sqrt{\left(x\,x'\right)^2+ 2\,x\,x' \, y\,y' + \left( y\,y' \right)^2+\left( y\, x' \right)^2 -2\, y\, x'\,y'\,x + \left( y'\,x \right)^2}} \\ &= \sqrt{\left(x^2 + y^2\right)\,\left( {x '}^2 + {y'}^2\right)}\,\frac{x\,x'+ y\,y' }{\sqrt{\left(x\,x'\right)^2+ \left( y\,y' \right)^2+\left( y\, x' \right)^2 + \left( y'\,x \right)^2}} \\ &= x\,x'+ y\,y' \end{align*} At this point the nut is cracked, and I rebuild the solution as follows: \begin{align} - 2\,x\,x' - 2\,y\,{y'} &= -2\,r\,r' \,\cos\left(\theta - \theta'\right) \\ r^2 + {r'}^2 - 2\,x\,x' - 2\,y\,{y'} &=r^2 + {r'}^2 -2\,r\,r' \,\cos\left(\theta - \theta'\right) \\ (x-x')^2 + (y-y')^2 &=r^2 + {r'}^2 -2\,r\,r' \,\cos\left(\theta - \theta'\right) \\ (x-x')^2 + (y-y')^2 + (z-z')^2 &=r^2 + {r'}^2 -2\,r\,r' \,\cos\left(\theta - \theta'\right) + (z-z')^2 \end{align}

$\endgroup$
3
  • 1
    $\begingroup$ Bonus note: We can see the Law of Cosines popping up in the answer. This makes sense since the expression involves the square of the distance between the projection of the two points onto the $xy$-plane. $\endgroup$
    – aschepler
    Feb 26, 2021 at 1:06
  • $\begingroup$ Yes, it is similar to the Law of Cosines popping up in the formula for the distance between two points in spherical coordiantes (cf., en.wikipedia.org/wiki/Spherical_coordinate_system ) $\endgroup$ Mar 1, 2021 at 21:44
  • $\begingroup$ Though I usually find it easier to work with the equations $x = r \cos \theta$ and $y = r \sin \theta$, instead of immediately starting with $\theta = \tan^{-1}(y/x)$. You might or might not need to isolate $\theta$ eventually, but that's often easier to do later if it is needed. This problem doesn't require it at all. It also allows being more careful about behavior at $x=0$ points. $\endgroup$
    – aschepler
    Mar 1, 2021 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.