# Chris' Math Blog

## Arc Length in Different Coordinate Systems

This post will deal with converting the arc length formulas in two and three dimensions from rectangular coordinates to polar (2-D), cylindrical (3-D) and spherical (3-D) coordinates.

Two Dimensions

In $\mathbb{R}^2$, we define the arc length of a function $y=f(x)$ over the interval $a\leq x\leq b$ to be

$L=\displaystyle\int_a^b \sqrt{1+\left(\frac{\,dy}{\,dx}\right)^2}\,dx$

If we define a parametric function $x=x(t)$ and $y=y(t)$, we observe that $\dfrac{\,dy}{\,dx}=\dfrac{\,dy/\,dt}{\,dx/\,dt}$.  Substituting this into the arc length formula yields

$\displaystyle\int_a^b\sqrt{1+\left(\frac{\,dy/\,dt}{\,dx/\,dt}\right)^2}\,dx$

Getting a common denominator gives us

\begin{aligned}\displaystyle\int_a^b\sqrt{\frac{(\,dx/\,dt)^2+(\,dy/\,dt)^2}{(\,dx/\,dt)^2}}\,dt&=\int_a^b\sqrt{\left(\frac{\,dx}{\,dt}\right)^2+\left(\frac{\,dy}{\,dt}\right)^2}\frac{\,dt}{\,dx}\,dx\\ &=\int_a^b\sqrt{\left(\frac{\,dx}{\,dt}\right)^2+\left(\frac{\,dy}{\,dt}\right)^2}\,dt\end{aligned}

In polar coordinates, we know that $x=r\cos\theta$ and $y=r\sin\theta$.   If $r=r(t)$ and $\theta=\theta(t)$, then we observe that

$\dfrac{\,dy}{\,dt}=r\cos\theta\dfrac{\,d\theta}{\,dt}+\sin\theta\dfrac{\,dr}{\,dt}\text{ and }\dfrac{\,dx}{\,dt}=\cos\theta\dfrac{\,dr}{\,dt}-r\sin\theta\dfrac{\,d\theta}{\,dt}$

Therefore,

\begin{aligned}L &=\displaystyle\int_{\alpha}^{\beta}\sqrt{\left(\cos\theta\frac{\,dr}{\,dt}-r\sin\theta\frac{\,d\theta}{\,dt}\right)^2+\left(r\cos\theta\frac{\,d\theta}{\,dt}+\sin\theta\frac{\,dr}{\,dt}\right)^2}\,dt\\ \implies L&=\displaystyle\int_{\alpha}^{\beta}\sqrt{\left(\frac{\,dr}{\,dt}\right)^2+r^2\left(\frac{\,d\theta}{\,dt}\right)^2}\,dt\end{aligned}

\begin{aligned}\implies L &=\displaystyle\int_{\alpha}^{\beta}\sqrt{\left(\frac{\,d\theta}{\,dt}\right)^2\left[r^2+\left(\frac{\,dr}{\,d\theta}\right)^2\right]}\,dt\\\implies L &=\displaystyle\int_{\alpha}^{\beta}\sqrt{r^2+\left(\frac{\,dr}{\,d\theta}\right)^2}\frac{\,d\theta}{\,dt}\,dt\end{aligned}

\begin{aligned}\implies L&=\displaystyle\int_{\alpha}^{\beta}\sqrt{r^2+\left(\frac{\,dr}{\,d\theta}\right)^2}\,d\theta\end{aligned}

Three Dimensions

Let us now consider two additional coordinate systems in $\mathbb{R}^3$:  the cylindrical and spherical coordinate system.

The cylindrical coordinate system is a 3-D version of the polar coordinate system in 2-D with an extra component for $z$.  We can slightly modify our arc length equation in polar to make it apply to the cylindrical coordinate system given that $r=r(t)$, $\theta=\theta(t)$.  We start from this step:

$\displaystyle\int_{a}^{b}\sqrt{\left(\frac{\,dr}{\,dt}\right)^2+\left(\frac{\,d\theta}{\,dt}\right)^2}\,dt$

From rectangular coordinates, the arc length of a parameterized function is

$\displaystyle\int_a^b\sqrt{\left(\frac{\,dx}{\,dt}\right)^2+\left(\frac{\,dy}{\,dt}\right)^2+\left(\frac{\,dz}{\,dt}\right)^2}\,dt$.

So from this, it follows that in cylindrical coordinates, we have arc length defined to be

$\displaystyle\int_a^b\sqrt{\left(\frac{\,dr}{\,dt}\right)^2+r^2\left(\frac{\,d\theta}{\,dt}\right)^2+\left(\frac{\,dz}{\,dt}\right)^2}\,dt$

To define arc length in the spherical coordinate system, we need to know first how to convert points from spherical to cylindrical coordinates (and then spherical to rectangular).   I leave without proof that $r=\rho\sin\phi$, $\theta=\theta$, and $z=\rho\cos\phi$.  Since we know that $x=r\cos\theta$, $y=r\sin\theta$, and $z=z$ goes from cylindrical to rectangular, it follows that $x=\rho\sin\phi\cos\theta$, $y=\rho\sin\phi\sin\theta$, and $z=\rho\cos\phi$ takes points in spherical coordinates and converts them into points from the rectangular coordinate system.

Again we consider the arc length formula for a parametric curve in the rectangular coordinate system:

$\displaystyle\int_a^b\sqrt{\left(\frac{\,dx}{\,dt}\right)^2+\left(\frac{\,dy}{\,dt}\right)^2+\left(\frac{\,dz}{\,dt}\right)^2}\,dt$

If we let $\rho=\rho(t)$, $\phi=\phi(t)$ and $\theta=\theta(t)$, we now can find expressions for $\frac{\,dx}{\,dt}$, $\frac{\,dy}{\,dt}$ and $\frac{\,dz}{\,dt}$.  I leave the calculations of these three to the reader, but I will, for the sake of space, write the values to each one.

Since $x=\rho\sin\phi\cos\theta$, we have

$\dfrac{\,dx}{\,dt}=\sin\phi\cos\theta\dfrac{\,d\rho}{\,dt}-\rho\sin\phi\sin\theta\dfrac{\,d\theta}{\,dt}+\rho\cos\phi\cos\theta\dfrac{\,d\phi}{\,dt}$

Since $y=\rho\sin\phi\sin\theta$, we have

$\dfrac{\,dy}{\,dt}=\sin\phi\sin\theta\dfrac{\,d\rho}{\,dt}+\rho\sin\phi\cos\theta\dfrac{\,d\theta}{\,dt}+\rho\cos\phi\sin\theta\dfrac{\,phi}{\,dt}$

Since $z=\rho\cos\phi$, we have

$\dfrac{\,dz}{\,dt}=\cos\phi\dfrac{\,d\rho}{\,dt}-\rho\sin\phi\dfrac{\,d\phi}{\,dt}$

When you plug this into the rectangular arc length formula and after a ton of painful simplifying (which I have left out to spare your sanity), we see that the arc length formula in spherical coordinates is:

$\displaystyle\int_a^b\sqrt{\left(\frac{\,d\rho}{\,dt}\right)^2+\rho^2\sin^2\phi\left(\frac{\,d\theta}{\,dt}\right)^2+\rho^2\left(\frac{\,d\phi}{\,dt}\right)^2}\,dt$

## Testing LaTeX

$\displaystyle\int_{-\infty}^{\infty}e^{-ax^2}\,dx=\frac{1}{2}\sqrt{\frac{\pi}{a}}$

$\displaystyle f\!\left(x\right)=a_0+\sum\limits_{n=1}^{\infty}a_n\cos\!\left(\frac{n\pi x}{L}\right)+b_n\sin\!\left(\frac{n\pi x}{L}\right)$

## One Dimensional Wave Equation

Q:  Find the general solution to the boundary value problem for the 1-D Wave Equation:

\begin{aligned}\frac{\partial^2y}{\partial^2t} & = a^2\frac{\partial^2y}{\partial^2x}\\y(0,t) & = y(L,t)=0; \ (00)\\y(x,0) & = f(x) \ (0

where $y(x,t)$ is the displacement function of a vibrating string with fixed ends,$f(x)$ is the initial position function, and $g(x)$ is the initial velocity function.

Solution:  The best way to solve this would be to set up two boundary value problems [where each one has one nonhomogeneous condition], and then solve the problems using the technique of Separation of Variables:

\begin{array}{cc}\text{Problem A} & \text{Problem B}\\\begin{aligned} y_{tt}&=a^2y_{xx}\\y(0,t)&=y(L,t)=0 \\y(x,0)&=f(x)\\y_t(x,0)&=0\end{aligned} & \begin{aligned} y_{tt}&=a^2y_{xx}\\y(0,t)&=y(L,t)=0 \\y(x,0)&=0\\y_t(x,0)&=g(x)\end{aligned}\end{array}

Problem A:

If we let $y(x,t)=X(x)T(t)$, then the PDE becomes $XT^{\prime\prime}=a^2X^{\prime\prime}T$.  Now separate the variables to get:

$\displaystyle\frac{X^{\prime\prime}}{X}=\frac{T^{\prime\prime}}{a^2T}$

The two functions $\displaystyle\frac{X^{\prime\prime}}{X}$ and $\displaystyle\frac{T^{\prime\prime}}{a^2T}$ agree $\forall\,x,t$ if they both are equal to the same constant.  We now let :

$\displaystyle\frac{X^{\prime\prime}}{X}=\frac{T^{\prime\prime}}{a^2T}=-\lambda$

What we now have is an eigenvalue problem.  We can now solve two ordinary DEs:

\begin{aligned} X^{\prime\prime}+\lambda X&=0 \\ T^{\prime\prime}+\lambda a^2T&=0\end{aligned}

Since the endpoint conditions $y(0,t)=X(0)T(t)=0$ and $y(L,t)=X(L)T(t)=0$ require that $X(0)=X(L)=0$ if $T(t)$ is non-trivial.  Thus, $X(x)$ must satisfy the eigenvalue problem

$X^{\prime\prime}+\lambda X=0, ~~~X(0)=X(L)=0$

If $\lambda=0$, then the eigenvalue problem becomes:

$X^{\prime}=0$

When solved, the general solution is $X=Ax+B$.  When we apply the endpoint conditions, we have $A=B=0$.  This gives us the trivial solution $X(x)\equiv 0$.  Thus, $\lambda=0$ is NOT an eigenvalue.

If $\lambda<0$, we will let $\lambda=-\alpha^2 \ (\alpha>0)$.  The eigenvalue problem now becomes:

$X^{\prime\prime}-\alpha^2X=0$

When solved, the general solution is:

$X=c_1e^{\alpha x}+c_2e^{-\alpha x}=A\cosh(\alpha x)+B\sinh(\alpha x); ~ (A=c_1+c_2, ~ B=c_1-c_2)$

where

\begin{aligned} \cosh(\alpha x)&=\frac{1}{2}\left(e^{\alpha x}+e^{-\alpha x}\right) \\ \sinh(\alpha x)&=\frac{1}{2}\left(e^{\alpha x}-e^{-\alpha x}\right)\end{aligned}

Applying the endpoint condition $X(0)=0$, we have$X(0)=A\cosh(0)+B\sinh(0)=A=0$ so that $X(x)=B\sinh(\alpha x)$.  When we apply the other endpoint $X(L)=0$, we have $X(L)=B\sinh(\alpha x)=0$.  Thus, $B=0$ since$\alpha \neq 0$ and $\sinh(\alpha x)=0$ for $x=0$.  Thus the only solution is the trivial solution $X(x)\equiv 0$.  As a result, there are no negative eigenvalues.

Now, when $\lambda>0$, we let $\lambda=\alpha^2,~(\alpha>0)$  The eigenvalue problem then becomes:

$X^{\prime\prime}+\alpha^2X=0$

The general solution has the form:

$X=A\cos(\alpha x)+B\sin(\alpha x)$

Applying the endpoint condition $X(0)=0$, we have $X(0)=A\cos(0)+B\sin(0)=A=0$ so that $X(x)=B\sin(\alpha x)$.  But if we apply the other condition $X(L)=0$, we have $X(L)=B\sin(\alpha L)$.  This can occur when $B\neq 0$ when $\alpha L$ is a positive multiple of $\pi$:

$\pi,\,2\pi,\,3\pi,\dots,\,n\pi\,\,\,\,\left(n\in\mathbb{Z}^+\right)$

Therefore,

$\alpha L=\pi,\,2\pi,\,3\pi,\dots,\,n\pi$

Solving for $\alpha$, we get:

$\alpha=\displaystyle\frac{\pi}{L},~\frac{2\pi}{L},~\frac{3\pi}{L},\dots,~\frac{n\pi}{L}$

Since $\lambda=\alpha^2$, we can say that:

$\lambda=\displaystyle\frac{\pi^2}{L^2},~\frac{4\pi^2}{L^2},~\frac{9\pi^2}{L^2},\dots,~\frac{n^2\pi^2}{L^2}$

We now can see that we have an infinte sequence of eigenvalues defined by:

$\lambda_n=\displaystyle\frac{n^2\pi^2}{L^2}~~~~\left(n\in\mathbb{Z}^+\right)$

The associated eigenfunction is

$X_n=\sin\left(\frac{n\pi}{L}\right),~~~~\left(n\in\mathbb{Z}^+\right)$

——-
***

The homogeneous initial condition

$y_t(x,0)=X(x)T^{\prime}(0)=0$

Implies that $T^{\prime}(0)=0$.  Thus, the solution $T_n(t)$ that is associated with the eigenvalue $\lambda_n=\displaystyle\frac{n^2\pi^2}{L^2}$ must also satisfy the conditions

$T_n\!^{\prime\prime}+\displaystyle\frac{n^2\pi^2a^2}{L^2}T_n=0,~~~T_n\!^{\prime}(0)=0$

After some calculations [which I have omitted], we get the general solution:

$\displaystyle T_n(t)=A_n\cos\left(\frac{n\pi at}{L}\right)+B_n\sin\left(\frac{n\pi at}{L}\right)$

To apply the condition, we need to find $T_n\!^{\prime}(t)$:

\begin{aligned}\displaystyle T_n\!^{\prime}(t)&=-A_n\frac{n\pi a}{L}\sin\left(\frac{n\pi at}{L}\right)+B_n\frac{n\pi a}{L}\cos\left(\frac{n\pi at}{L}\right) \\ \displaystyle &=\frac{n\pi a}{L}\bigg[-A_n\sin\left(\frac{n\pi at}{L}\right)+B_n\cos\left(\frac{n\pi at}{L}\right)\bigg]\end{aligned}

Applying the condition $T^{\prime}(0)=0$, we get:

$T_n\!^{\prime}(0)=\displaystyle\frac{n\pi a}{L}\bigg[-A_n\sin(0)+B_n\cos(0)\bigg]=B_n\frac{n\pi a}{L}=0$

Therefore, $B_n=0$.  Thus, $T_n(t)$ can be defined as the non-trivial solution

$\displaystyle T_n(t)=\cos\left(\frac{n\pi a}{L}\right)$

Since $y(x,t)=X(x)T(x)$, we can say that

$\displaystyle y_n(x,t)=X_n(x)T_n(t)=\sin\bigg(\frac{n\pi x}{L}\bigg)\cos\bigg(\frac{n\pi at}{L}\bigg),~~~~n\in\mathbb{Z}^+$

Each of these terms satisfy the wave equation $\displaystyle\frac{\partial^2y}{\partial t^2}=a^2\frac{\partial^2y}{\partial x^2}$ and the homogeneous boundary condition given at the start of this part of the problem.  Thus, by the principle of superposition, we define $y_n(x,t)$ as the infinte series:

$y_n(x,t)=\displaystyle\sum_{n=1}^{\infty}A_n\sin\bigg(\frac{n\pi x}{L}\bigg)\cos\bigg(\frac{n\pi at}{L}\bigg)$

All we need to do now is find $\left\{A_n\right\}$ such that it satisfies the nonhomogeneous condition

$\displaystyle y(x,0)=\sum_{n=1}^{\infty}A_n\sin\bigg(\frac{n\pi x}{L}\bigg)=f(x)$

for $0.  However, this will be the Fourier Sine Series of $f(x)$ if we choose

$\displaystyle A_n=\frac{2}{L}\int_0^L f(x)\sin\bigg(\frac{n\pi x}{L}\bigg)\,dx$

Therefore, the Formal Series Solution to Problem A is

$y(x,t)=\displaystyle\sum_{n=1}^{\infty}A_n\sin\bigg(\frac{n\pi x}{L}\bigg)\cos\bigg(\frac{n\pi at}{L}\bigg)$

where

$\displaystyle A_n=\frac{2}{L}\int_0^L f(x)\sin\bigg(\frac{n\pi x}{L}\bigg)\,dx$

———————————————-

Problem B

Let us start from ***:

The homogeneous initial condition

$y(x,0)=X(x)T(0)=0$

implies that $T(0)=0$.  Thus, the solution $T_n(t)$ associated with the eigenvalue $\displaystyle\lambda_n=\frac{n^2\pi^2}{L^2}$ must also satisfy the conditions

$\displaystyle T_n\!^{\prime\prime}+\frac{n^2\pi^2a^2t^2}{L^2}T_n=0,~~~T_n(0)=0$

After some calculations [which I have omitted again…], the general solution takes the form

$\displaystyle T_n(t)=A_n\cos\bigg(\frac{n\pi at}{L}\bigg)+B_n\sin\bigg(\frac{n\pi at}{L}\bigg)$

Applying the initial condition, we get

$T_n=A_n=0$

Thus, $T_n(t)$ can be defined as the non-trivial solution

$\displaystyle T_n(t)=\sin\bigg(\frac{n\pi at}{L}\bigg)$

Since $y(x,t)=X(x)T(t)$, we can say that

$\displaystyle y_n(x,t)=X(x)T(t)=\sin\bigg(\frac{n\pi at}{L}\bigg)\sin\bigg(\frac{n\pi x}{L}\bigg)$

Each of these terms satisfy the wave equation $\displaystyle\frac{\partial^2y}{\partial t^2}=a^2\frac{\partial^2y}{\partial x^2}$ and the homogeneous boundary condition given at the start of this part of the problem.  Thus, by the principle of superposition, we define $y_n(x,t)$ as the infinte series:

$\displaystyle y_n(x,t)=\sum_{n=1}^{\infty}B_n\sin\bigg(\frac{n\pi x}{L}\bigg)\sin\bigg(\frac{n\pi at}{L}\bigg)$

Find $y_t(x,y)$:

$\displaystyle y_t(x,t)=\sum_{n=1}^{\infty}B_n\frac{n\pi a}{L}\cos\bigg(\frac{n\pi x}{L}\bigg)\sin\bigg(\frac{n\pi at}{L}\bigg)$

All we need to do now is find $\left\{B_n\right\}$ such that it satisfies the nonhomogeneous condition

$\displaystyle y_t(x,0)=\sum_{n=1}^{\infty}B_n\frac{n\pi a}{L}\cos\bigg(\frac{n\pi x}{L}\bigg)\sin\bigg(\frac{n\pi at}{L}\bigg)=g(x)$

for $0.  However, this will be the Fourier Sine Series of $g(x)$ if we choose

$\displaystyle B_n\frac{n\pi a}{L}=\frac{2}{L}\int_0^L g(x)\sin\bigg(\frac{n\pi x}{L}\bigg)\,dx\implies B_n=\frac{2}{n\pi a}\int_0^L g(x)\sin\bigg(\frac{n\pi x}{L}\bigg)\,dx$

Therefore, the Formal Series Solution to Problem B is

$\displaystyle y(x,t)=\sum_{n=1}^{\infty}B_n\sin\bigg(\frac{n\pi x}{L}\bigg)\sin\bigg(\frac{n\pi at}{L}\bigg)$

where

$\displaystyle B_n=\frac{2}{n\pi a}\int_0^L g(x)\sin\bigg(\frac{n\pi x}{L}\bigg)\,dx$

————-

Thus, the Formal Series Solution to the One Dimensional Wave Equation is

\begin{aligned}y(x,t)&=\sum_{n=1}^{\infty}\bigg[A_n\cos\bigg(\frac{n\pi a}{L}t\bigg)+B_n\sin\bigg(\frac{n\pi a}{L}t\bigg)\bigg]\sin\bigg(\frac{n\pi}{L}x\bigg)\\ \text{where} \\A_n&=\frac{2}{L}\int_0^L f(x)\sin\bigg(\frac{n\pi x}{L}\bigg)\,dx \\B_n&=\frac{2}{n\pi a}\int_0^L g(x)\sin\bigg(\frac{n\pi x}{L}\bigg)\,dx\end{aligned}