Sponsoring website: Emergency Boot Kit

Page 3 of :
All the Steps in Transforming the Laplace Equation ($\displaystyle\Delta f=0$)
from Rectangular to Cylindrical and to Spherical Coordinates

(Copyright©2023 by Daniel B. Sedory.)

$\leftarrow$ Previous Page

 


 

 

Transforming the Laplace Operator (∇2) Directly from Cartesian to Spherical Coordinates

    In order to transform the Laplace Operator (∇2) directly from cartesian to shperical coordinates, we must make use of the following:

$x = r \sin\theta\ \cos\phi\ ,\quad y = r \sin\theta\ \sin\phi\ ,\quad z = r \cos\theta$

where $x = x(r,\theta,\phi),\ y = y(r,\theta,\phi)$ and $z = z(r,\theta)$ and the partial derivatives of a function $f$ (with respect to x, y and z); the spherical coordinates being related to the cartesian coordinates as:

$r =\sqrt{x^2 + y^2 + z^2}\ ,\quad\theta =\arccos\ (z/r)\ ,\quad\phi =\arctan\ (y/x)\ .$

 

Obtaining the First Order Partial Differentials in Terms of $r, \theta$ and $\phi$

  The first step in the transformation of cartesian coordinates directly into spherical coordinates is to derive the first order partial differentials of a function with respect to $x$, $y$ and $z$ in terms of the spherical coordinates ($r, \theta$ and $\phi$):

  As before, the chain rule is applied to these parametric equations, producing:

$\newcommand{\pdif}[2]{\frac{\partial #1}{\partial #2}}$

$\large{\pdif{f}{x} =\pdif{f}{\ r}\ \pdif{\ r}{x} +\pdif{f}{\theta}\ \pdif{\theta}{x} +\pdif{f}{\phi}\ \pdif{\phi}{x}}$  (Dx.1), $\large{\pdif{f}{y} =\pdif{f}{\ r}\ \pdif{\ r}{y} +\pdif{f}{\theta}\ \pdif{\theta}{y} +\pdif{f}{\phi}\ \pdif{\phi}{y}}$  (Dy.1)  and  $\large{\pdif{f}{z} =\pdif{f}{\ r}\ \pdif{\ r}{z} +\pdif{f}{\theta}\ \pdif{\theta}{z}}$  (Dz.1)

  The following shows all the details for obtaining the first order partial derivatives of a function $f$ with respect to $x, y$ and $z$, by first working on $\large{\pdif{\ r}{x}, \pdif{\ r}{y}, \pdif{\ r}{z}}$  and then  $\large{\pdif{\theta}{x}, \pdif{\theta}{y}}, \large{\pdif{\theta}{z}}$ :

\begin{align*} \colorbox{yellow}{$\pdif{\ r}{x}$} & =\pdif{\ (\sqrt{x^2 +y^2 +z^2})}{\ x} = (\frac{1}{2})(2x)(x^2 +y^2 +z^2)^{-1/2}\quad\\ \\ & =\frac{x}{\sqrt{x^2 +y^2 +z^2}} =\frac{r\ \sin\theta\ \cos\phi}{r} =\colorbox{yellow}{$\sin\theta\ \cos\phi$}\ .\\ \\ & \text{In a similar manner we obtain:}\\ \colorbox{yellow}{$\pdif{\ r}{y}$} & =\colorbox{yellow}{$\sin\theta\ \sin\phi$}\quad\textbf{and}\quad\colorbox{yellow}{$\pdif{\ r}{z}$} =\colorbox{yellow}{$\cos\theta$} .\end{align*}

Then using the derivative rules:  $\large{\frac{d}{dx}}\small{(\arccos\ u)} = -\ \large{\frac{1}{\sqrt{1 - u^2}}\ \frac{du}{dx}}$  and  $\large{\frac{d}{dx}(\frac{u}{w}) =\frac{w\ \frac{du}{dx}\ -\ u\ \frac{dw}{dx}}{w^2}}$  (with $\colorbox{pink}{$\pdif{y}{x}=\pdif{x}{y}=\pdif{z}{x}=\pdif{z}{y}= 0$}$), and the trigonometric identity, $1 -\cos^2\theta =\sin^2\theta$, we have:

\begin{align*} \colorbox{yellow}{$\pdif{\theta}{x}$} & =\pdif{\ [\arccos\ (z/r)]}{x} =\ -\ \frac{1}{\sqrt{1 -(z/r)^2}}\ \pdif{\ (z/r)}{x} =\left(-\ \frac{1}{\sqrt{1 -(z/r)^2}}\right)\ \large{\frac{\colorbox{pink}{$r \pdif{z}{x}$} - z \pdif{r}{x}}{r^2}}\\ \\ & =\left(-\ \frac{1}{\sqrt{1 -\ (r \cos\theta/r)^2}}\right)\ \frac{-\ (r\cos\theta)\ (\colorbox{yellow}{$\partial\ r/\partial x$})}{r^2} =\left(-\ \frac{1}{\sqrt{\colorbox{lightgreen}{$1 -\cos^2\theta$}}}\right)\ \frac{(-\ r\cos\theta)\ (\sin\theta\ \cos\phi)}{r^2}\quad\\ \\ & =\left(-\ \frac{1}{\colorbox{pink}{$\sin\theta$}}\right)\ \frac{-\ \colorbox{pink}{$\sin\theta$}\ \cos\theta\ \cos\phi}{r} =\colorbox{yellow}{$\frac{\cos\theta\ \cos\phi}{r}$}\ .\\ & \text{And in a similar manner we obtain:}\quad\colorbox{yellow}{$\pdif{\theta}{y}$} =\colorbox{yellow}{$\frac{\cos\theta\ \sin\phi}{r}$}\quad\textbf{and}\\ \colorbox{yellow}{$\pdif{\theta}{z}$} & =\pdif{\ [\arccos\ (z/r)]}{z} =\ -\ \frac{1}{\sqrt{1 -(z/r)^2}}\ \pdif{\ (z/r)}{z} =\left(-\ \frac{1}{\sqrt{1 -(z/r)^2}}\right)\ \large{\frac{r\ \colorbox{lightgreen}{$\pdif{z}{z}$} - z\ \pdif{\ r}{z}}{r^2}}\\ \\ & =\left(-\ \frac{1}{\sqrt{\colorbox{lightgreen}{$1 -\cos^2\theta$}}}\right)\ \frac{r - [r\ \cos\theta\ (\colorbox{yellow}{$\partial\ r/\partial z$})]}{r^2}\ =\left(-\ \frac{1}{\sin\theta}\right)\ \frac{r -\ (r\ \cos\theta\ \cos\theta)}{r^2} \\ \\ & =\left(-\ \frac{1}{\sin\theta}\right)\ \frac{\colorbox{lightgreen}{$1 -\cos^2\theta$}}{r}\ =\left(-\ \frac{1}{\sin\theta}\right)\ \frac{\sin^2\theta}{r}\ =\ \colorbox{yellow}{$-\ \frac{\sin\theta}{r}$}\ .\end{align*}

  And finishing with $\large{\pdif{\phi}{x}}$  and  $\large{\pdif{\phi}{y}}$  using the rule, $\frac{d}{dx}(\arctan u) =\large{\frac{1}{1 + u^2}\ \frac{du}{dx}}$,  and the identity, $(\sin\theta/\cos\theta) = \tan\theta$ :

\begin{align*} \colorbox{yellow}{$\pdif{\phi}{x}$} & =\pdif{\ [\arctan\ (y/x)]}{x} =\frac{1}{1 + (y/x)^2}\ \pdif{(y/x)}{x} =\left(\frac{1}{1 +\tan^2\theta}\right)\ \frac{\large{\colorbox{pink}{$x \pdif{y}{x}$} - y\ \colorbox{lightgreen}{$\pdif{x}{x}$}}}{x^2}\quad\\ \\ & =\left(\frac{1}{\sec^2\phi}\right)\ \left(-\ \frac{r\ \sin\theta\ \sin\phi}{x^2}\right) = -\ \frac{(\colorbox{pink}{$\cos^2\phi$})(r\ \sin\theta\ \sin\phi)}{r^2\ \sin^2\theta\ \colorbox{pink}{$\cos^2\phi$}}\ =\ \colorbox{yellow}{$-\ \frac{\sin\phi}{r\ \sin\theta}$}\ .\end{align*}
\begin{align*} \colorbox{yellow}{$\pdif{\phi}{y}$} & =\pdif{\ [\arctan\ (y/x)]}{y} =\frac{1}{1 + (y/x)^2}\ \pdif{(y/x)}{y} =\left(\frac{1}{1 +\tan^2\theta}\right)\ \frac{\large{x\ \colorbox{lightgreen}{$\pdif{y}{y}$} -\ \colorbox{pink}{$y\pdif{x}{y}$}}}{x^2}\quad\\ \\ & =\left(\frac{1}{\sec^2\phi}\right)\ \left(\frac{r\ \sin\theta\ \cos\phi}{r^2 \sin^2\theta\ \cos^2\phi}\right) =\frac{(\colorbox{pink}{$\cos^2\phi$})(r\ \sin\theta\ \cos\phi)}{r^2 \sin^2\theta\ \colorbox{pink}{$\cos^2\phi$}}\ =\ \colorbox{yellow}{$\frac{\cos\phi}{r\ \sin\theta}$}\ .\end{align*}

 

  By substituting all the derivatives marked with yellow in the boxes above into equations (Dx.1), (Dy.1) and (Dz.1), they become:

\begin{align*} &\large{\pdif{f}{x}\ =\ \sin\theta\ \cos\phi\ \pdif{f}{\ r}\ +\ \frac{\cos\theta\ \cos\phi}{r}\ \pdif{f}{\theta}\ -\ \frac{\sin\phi}{r \sin\theta}\ \pdif{f}{\phi}}\quad\textbf{(Dx.2)}\\ \\ &\large{\pdif{f}{y}\ =\ \sin\theta\ \sin\phi\ \pdif{f}{\ r}\ +\ \frac{\cos\theta\ \sin\phi}{r}\ \pdif{f}{\theta}\ +\ \frac{\cos\phi}{r \sin\theta}\ \pdif{f}{\phi}}\quad\textbf{(Dy.2)}\\ \\ &\large{\pdif{f}{z}\ =\ \cos\theta\ \pdif{f}{\ r}\ -\ \frac{\sin\theta}{r}\ \pdif{f}{\theta}}\quad\textbf{(Dz.2)} \end{align*}

 

Obtaining the Second Order Partial Differentials

  The next step is finding the second order partial derivatives of the function $f$ (with respect to x, y and z) from the equations above; substituting all of the right-sides of these equations into the first order differentials highlighted below, and then making use of the chain rule, $\colorbox{lightblue}{$\frac{d}{dx}(uw) = u\frac{dw}{dx} + w\frac{du}{dx}$}$, throughout the rest of the differentiation process:

\begin{align*} \large{\pdif{^2 f}{x^2}} &\colorbox{yellow}{$=$}\ \large{\sin\theta\ \cos\phi\ \pdif{^2\ f}{r\ \partial x}+\ \frac{\cos\theta\ \cos\phi}{r}\ \pdif{^2 f}{\theta\ \partial x}\ -\ \frac{\sin\phi}{r \sin\theta}\ \pdif{^2 f}{\phi\ \partial x}}\\ \\ &\colorbox{yellow}{$=$}\sin\theta\ \cos\phi\ \left(\pdif{}{\ r}\ \colorbox{yellow}{$\pdif{f}{x}$}\right)+\frac{\cos\theta\ \cos\phi}{r}\ \left(\pdif{f}{\theta}\ \colorbox{yellow}{$\pdif{f}{x}$}\right)-\frac{\sin\phi}{r \sin\theta}\ \left(\pdif{f}{\phi}\ \colorbox{yellow}{$\pdif{f}{x}$}\right)\\ \\ &\colorbox{yellow}{$=$}\sin\theta\ \cos\phi\ \left[\pdif{}{\ r}\ \left(\sin\theta\ \cos\phi\ \pdif{f}{\ r}+\frac{\cos\theta\ \cos\phi}{r}\ \pdif{f}{\theta}-\frac{\sin\phi}{r\ \sin\theta}\ \pdif{f}{\phi}\right)\right]\textbf{...}\\ &\textbf{...}\ \ +\frac{\cos\theta\ \cos\phi}{r}\ \left[\pdif{}{\theta}\ \left(\sin\theta\ \cos\phi\ \pdif{f}{\ r}+\frac{\cos\theta\ \cos\phi}{r}\ \pdif{f}{\theta}-\frac{\sin\phi}{r\ \sin\theta}\ \pdif{f}{\phi}\right)\right]\textbf{...}\\ &\textbf{...}\ \ -\frac{\sin\phi}{r \sin\theta}\ \left[\pdif{}{\phi}\ \left(\sin\theta\ \cos\phi\ \pdif{f}{\ r}+\frac{\cos\theta\ \cos\phi}{r}\ \pdif{f}{\theta}-\frac{\sin\phi}{r\ \sin\theta}\ \pdif{f}{\phi}\right)\right]\ . \end{align*}

$(d/dr)(1/r)= -(1/r^2)$  is made use of twice in the terms within the first set of parentheses above, and  $(d/dx)(\sin x)=\cos x$  and  $(d/dx)(\cos x)= -\sin x$   along with  $\bigg(\large{\frac{d}{dx}\frac{1}{\sin x}}\bigg)= -\csc x\ \cot x =\bigg(-\frac{\large{\cos x}}{\large{\sin^2 x}}\bigg)$  in the remaining terms to arrive at:

\begin{align*} \large{\pdif{^2 f}{x^2}} &\colorbox{yellow}{$=$}\sin\theta\ \cos\phi\ \bigg(\sin\theta\ \cos\phi\ \pdif{^2 f}{\ r^2}+\frac{\cos\theta\ \cos\phi}{r}\ \pdif{^2 f}{r\ \partial\theta}-\frac{\cos\theta\ \cos\phi}{r^2}\ \pdif{f}{\theta}\textbf{...}\\ &\textbf{...}\ \ -\frac{\sin\phi}{r \sin\theta}\ \pdif{^2 f}{r\ \partial\phi}+\frac{\sin\phi}{r^2\sin\theta}\ \pdif{f}{\phi}\bigg)\textbf{...}\\ \\ &\textbf{...}\ \ +\frac{\cos\theta\ \cos\phi}{r}\ \bigg(\sin\theta\ \cos\phi\ \pdif{^2 f}{r\ \partial\theta}+\cos\theta\ \cos\phi\ \pdif{f}{r}+\frac{\cos\theta\ \cos\phi}{r}\ \pdif{^2 f}{\theta^2}\textbf{...}\\ &\textbf{...}\ \ -\frac{\sin\theta\ \cos\phi}{r}\ \pdif{f}{\theta}-\frac{\sin\phi}{r\ \sin\theta}\ \pdif{^2 f}{\theta\ \partial\phi}+\frac{\cos\theta\ \sin\phi}{r\ \sin^2\theta}\ \pdif{f}{\phi}\bigg)\textbf{...}\\ \\ &\textbf{...}\ \ -\frac{\sin\phi}{r \sin\theta}\ \bigg(\sin\theta\ \cos\phi\ \pdif{^2 f}{r\ \partial\phi}-\sin\theta\ \sin\phi\ \pdif{f}{r}+\frac{\cos\theta\ \cos\phi}{r}\ \pdif{^2 f}{\theta\ \partial\phi}\textbf{...}\\ &\textbf{...}\ \ -\frac{\cos\theta\ \sin\phi}{r}\ \pdif{f}{\theta}-\frac{\sin\phi}{r\ \sin\theta}\ \pdif{^2 f}{\phi^2}-\frac{\cos\phi}{r\ \sin\theta}\ \pdif{f}{\phi}\bigg)\ . \end{align*}

Before moving on, here are some details and an example of how the results above were obtained: Each of the terms within the brackets above this table were differentiated with respect to $r$, $\theta$ or $\phi$, and since there is no variable $r$ in the very first term ($u=\sin\theta\ \cos\phi$), applying the chain rule to that gives zero as its second half, $(d/dr)(\sin\theta\ \cos\phi)=0$; whereas all of the remaining chain rule differentiations produce two terms each. Example: Applying the general chain rule to this differentiation: $\large{\pdif{}{\phi}}\bigg(-\frac{\sin\phi}{r\sin\theta}\ \pdif{f}{\phi}\bigg)$ gives us: $\large{-\frac{\sin\phi}{r\sin\theta}}\ \pdif{}{\phi}\pdif{f}{\phi}+\pdif{f}{\phi}\ \bigg(\pdif{}{\phi}\frac{\sin\phi}{r\sin\theta}\bigg)$ $=\large{-\frac{\sin\phi}{r\sin\theta}}\ \pdif{^2 f}{\phi^2}+\pdif{f}{\phi}\bigg(\frac{-\cos\phi}{r\sin\theta}\bigg)$ for the last two terms in the table above. And multiplying through to eliminate the parentheses, gives us:

\begin{align*} \large{\pdif{^2 f}{x^2}} &\colorbox{yellow}{$=$}\sin^2\theta\ \cos^2\phi\ \pdif{^2 f}{\ r^2}+\colorbox{lightgreen}{$\frac{\sin\theta\ \cos\theta\ \cos^2\phi}{r}\ \pdif{^2 f}{r\ \partial\theta}$}-\colorbox{lightgreen}{$\frac{\sin\theta\ \cos\theta\ \cos^2\phi}{r^2}\ \pdif{f}{\theta}$}\ \textbf{...}\\ &\textbf{...}\ \ -\frac{\colorbox{pink}{$\sin\theta$}\ \colorbox{lightgreen}{$\sin\phi\ \cos\phi$}}{\colorbox{lightgreen}{$r$}\ \colorbox{pink}{$\sin\theta$}}\ \colorbox{lightgreen}{$\pdif{^2 f}{r\ \partial\phi}$}+\frac{\sin\phi\ \cos\phi}{r^2}\ \pdif{f}{\phi}+\colorbox{lightgreen}{$\frac{\sin\theta\ \cos\theta\ \cos^2\phi}{r}\ \pdif{^2 f}{r\ \partial\theta}$}\ \textbf{...}\\ &\textbf{...}\ \ +\frac{\cos^2\theta\ \cos^2\phi}{r}\ \pdif{f}{r}+\frac{\cos^2\theta\ \cos^2\phi}{r^2}\ \pdif{^2 f}{\theta^2}-\colorbox{lightgreen}{$\frac{\sin\theta\ \cos\theta\ \cos^2\phi}{r^2}\ \pdif{f}{\theta}$}\ \textbf{...}\\ &\textbf{...}\ \ -\colorbox{lightgreen}{$\frac{\cos\theta\ \sin\phi\ \cos\phi}{r^2\ \sin\theta}\ \pdif{^2 f}{\theta\ \partial\phi}$}+\frac{\cos^2\theta\ \sin\phi\ \cos\phi}{r^2\ \sin^2\theta}\ \pdif{f}{\phi}-\colorbox{lightgreen}{$\frac{\sin\phi\ \cos\phi}{r}\ \pdif{^2 f}{r\ \partial\phi}$}\ \textbf{...}\\ &\textbf{...}\ \ +\frac{\sin^2\phi}{r}\ \pdif{f}{r}-\colorbox{lightgreen}{$\frac{\cos\theta\ \sin\phi\ \cos\phi}{r^2\ \sin\theta}\ \pdif{^2 f}{\theta\ \partial\phi}$}+\frac{\cos\theta\ \sin^2\phi}{r^2\ \sin\theta}\ \pdif{f}{\theta}\ \textbf{...}\\ &\textbf{...}\ \ + \frac{\sin^2\phi}{r^2\ \sin^2\theta}\ \pdif{^2 f}{\phi^2}+\frac{\sin\phi\ \cos\phi}{r^2\ \sin^2\theta}\ \pdif{f}{\phi}\ .\end{align*}

Note: Only the first instance ($\colorbox{pink}{$\sin\theta$} / \colorbox{pink}{$\sin\theta$}$) of values canceling out is shown above; there are others!

After combining some terms, we still have 13 of them below. But, many will cancel out upon adding the terms from $\pdif{^2 f}{y^2}$ and $\pdif{^2 f}{z^2}$:

\begin{align*} \large{\pdif{^2 f}{x^2}} &\colorbox{yellow}{$=$}\sin^2\theta\ \cos^2\phi\ \pdif{^2 f}{\ r^2}+\frac{\colorbox{lightgreen}{$2$}\ \sin\theta\ \cos\theta\ \cos^2\phi}{r}\ \pdif{^2 f}{r\ \partial\theta}-\frac{\colorbox{lightgreen}{$2$}\ \sin\theta\ \cos\theta\ \cos^2\phi}{r^2}\ \pdif{f}{\theta}\ \textbf{...}\\ &\textbf{...}\ \ -\frac{\colorbox{lightgreen}{$2$}\ \sin\phi\ \cos\phi}{r}\ \pdif{^2 f}{r\ \partial\phi}+\frac{\sin\phi\ \cos\phi}{r^2}\ \pdif{f}{\phi}+\frac{\cos^2\theta\ \cos^2\phi}{r}\ \pdif{f}{r}\ \textbf{...}\\ &\textbf{...}\ \ +\frac{\cos^2\theta\ \cos^2\phi}{r^2}\ \pdif{^2 f}{\theta^2}-\frac{\colorbox{lightgreen}{$2$}\ \cos\theta\ \sin\phi\ \cos\phi}{r^2\ \sin\theta}\ \pdif{^2 f}{\theta\ \partial\phi}+\frac{\cos^2\theta\ \sin\phi\ \cos\phi}{r^2\ \sin^2\theta}\ \pdif{f}{\phi}\ \textbf{...}\\ &\textbf{...}\ \ +\frac{\sin^2\phi}{r}\ \pdif{f}{r}+\frac{\cos\theta\ \sin^2\phi}{r^2\ \sin\theta}\ \pdif{f}{\theta}+\frac{\sin^2\phi}{r^2\ \sin^2\theta}\ \pdif{^2 f}{\phi^2}+\frac{\sin\phi\ \cos\phi}{r^2\ \sin^2\theta}\ \pdif{f}{\phi}\ .\end{align*}

 

 

Next Page:   Direct Transformation ... continued

$\leftarrow$ Previous Page

 

 

The Math symbols and equations displayed here use LaTeX under MathJaX.

 


First Posted on: 16 November 2023 (2023.11.16).
Updated on:
17 NOV 2023 (2023.11.17); used a macro to reduce file size, continued adding content, 18 NOV 2023 (2023.11.18); rearranged presentation, added more content and clarifications, 20 NOV 2023 (2023.11.20); more content added, 21 NOV 2023 (2023.11.21); more clarifications, finished page, 22 NOV 2023 (2023.11.22); added some explanations and made changes to page layout, 23 NOV 2023 (2023.11.23); corrected a sign error and finished adding details.


You can write to me here: contact page.

Math Index Index Page

The Starman’s Realm Index Page