# Coordinate systems

This resource focuses on an introduction suitable for an introductory college physics course in electromagnetism.
We describe three different coordinate systems, known as Cartesian, cylindrical and spherical. The cylindrical system is closely related to polar coordinates.
See also Derivation of formulas

## Coordinate systems
### Cartesian Coordinate

Mathematical expression of a point on Cartesian coordinate
    A (x,y)

### Polar Coordinate

Mathematical expression of a point on Cartesian coordinate
    A (r,$\theta$)

### Conversion Coordinate

    $r={\sqrt {x^{2}+y^{2}}}$
    $\theta =Tan^{-}{\frac {y}{x}}$
    $x(\theta )=rCos\theta$
    $y(\theta )=rSin\theta$

## Cartesian Coordinates

To the left: Illustration of a Cartesian coordinate plane. Four points are marked and labeled with their coordinates: (2, 3) in green, (−3, 1) in red, (−1.5, −2.5) in blue, and the origin (0, 0) in purple.
To the right: A three dimensional Cartesian coordinate system, with origin O and axis lines X, Y and Z, oriented as shown by the arrows. The tick marks on the axes are one length unit apart. The black dot shows the point with coordinates x = 2, y = 3, and z = 4, or (2,3,4).

### Line element in Cartesian coordinates

The distance between points $(x_{1},y_{1},z_{1})$ and $(x_{2},y_{2},z_{2})$ is
    $l={\sqrt {(x_{2}-x_{1})^{2}+(y_{2}-y_{1})^{2}+(z_{2}-z_{1})^{2}}}.$
In other coordinate systems, it is best to focus on the distance between two points that are close together. For our purposes, it is best to replace the above formula with:
    $d\ell ={\sqrt {(dx)^{2}+(dy)^{2}+(dz)^{2}}}={\sqrt {{\vec {d}}\ell \cdot {\vec {d}}\ell }}$
where,
    ${\vec {d}}\ell ={\hat {x}}dx+{\hat {y}}dy+{\hat {z}}dz$.
is known as a line element.

#### Line integral of a vector field in Cartesian coordinates

So far we have discussed the integral of a scalar field, $f=f({\vec {r}})$. An example of a scalar field is the temperature as a function of position (at any given time). Wind velocity as a function of position would be a vector field. In Cartesian coordinates it is easy to analyze a vector field as being equivalent to three scalar fields, one for each direction: Let ${\vec {F}}({\vec {r}})=f({\vec {r}}){\hat {i}}+g({\vec {r}}){\hat {j}}+h({\vec {r}}){\hat {k}}\,$ (so that F$_x$=f, F$_y$=g, and F$_z$=h). The line integral of the vector field from ${\vec {r}}={\vec {a}}$ to ${\vec {r}}={\vec {b}}$ can now be defined as the limit of a Riemann sum:
    $\int _{\vec {a}}^{\vec {b}}{\vec {F}}\cdot d{\vec {\ell }}\approx \sum _{j}{\vec {F_{j}}}\cdot \Delta {\vec {\ell }}\equiv \sum _{j}F_{j}\ \Delta \ell \cos \theta$

##### Line integral of a uniform field over a straight path

Line integrals are trivial if the vector field is uniform, meaning that the field does not depend on position. A well known example is the acceleration of gravity at Earth's surface, under the assumption that we may approximate the Earth as 'flat': ${\vec {F}}_{0}=-g{\hat {y}}$ where g=9.8m/s$^2$, and the 0 subscript reminds us that the field is a constant. Constant terms may be factored out of either a Riemann sum or an integral: If ${\vec {F}}$ does not depend on position, then:
    $\sum _{j}{\vec {F}}_{j}\cdot \Delta {\vec {\ell }}_{j}\ ={\vec {F}}\cdot \sum _{j}\Delta {\vec {\ell }}\leftrightarrow \int _{\vec {a}}^{\vec {b}}{\vec {F}}\cdot d{\vec {\ell }}\,$ $={\vec {F}}\cdot \int _{\vec {a}}^{\vec {b}}d{\vec {\ell }}$
Note how the integral notation permits us to state the endpoint, ${\vec {b}}$ and starting point, ${\vec {a}}$, of the path. This can be evaluated to assume:
$=\int _{\vec {a}}^{\vec {b}}{\vec {F}}\cdot d{\vec {\ell }}={\vec {F}}\cdot ({\vec {b}}-{\vec {a}})\,$$=F\;|{\vec {b}}-{\vec {a}}|\cos \theta$
* See the Escher Waterfall to appreciate the technology that would be made possible if weight were not a conservative force.

### Differential volume element in Cartesian coordinates

The Cartesian volume element is,
    $dV=dxdydz,$
which easily permits a volume integral over a rectangular box. The integral of a function f=f(x,y,z) over the box is the triple integral, which is often informally written using a single integral, sign $\int$.
    $\int f\,dV=\int _{x1}^{x2}dx\overbrace {\int _{y1}^{y2}dy\underbrace {\int _{z1}^{z2}dz\,f(x,y,z)} _{\mathrm {function\ of\ x\ and\ y} }} ^{\mathrm {function\ of\ x\ only} }$
Note how the variable of integration (x or y or z) will disappear each time the integral is evaluated between the endpoints. This is a scalar integral if the function, $f=f(x,y,z)$. In general, the limits may be functions, for example (z1,z2) may be functions of x and y, while (y1,y2) may be functions of x. Fortunately such complexity is not required in the volume integrals needed to understand electromagnetism.

#### Volume integral over a rectangular box

If none of the limits, (z1,z2) and (y1,y2), in the above integral are functions, then the integral is over a rectangular box. The most elementary example of such an integral occurs when $f(x,y,z)=1$:
    $\int 1dV=(x_{2}-x_{1})\times (y_{2}-y_{1})\times (z_{2}-z_{1})\equiv \iiint 1dV=volume$
This is just the volume of the box.

### Differential surface element in Cartesian coordinates

Surface integrals can also be viewed as the limit of a Riemann sum, but can be more difficult to construct than line or volume integrals unless the geometry is very simple. The differential element of surface area can either be a scalar, $dA$, or the vector element, $d{\vec {A}}={\hat {n}}dA$. Here, ${\hat {n}}$ is normal to the surface.
    $\int {\vec {F}}\cdot d{\vec {A}}\approx \sum _{j}{\vec {F_{j}}}\cdot \Delta {\vec {A}}\equiv \sum _{j}(F_{j})\ (\Delta A_{j})\cos \theta$
At the moment of this writing a Wikipedia page states that a surface element in Cartesian coordiantes is,
    $d{\vec {A}}=dxdy{\hat {z}}+dydz{\hat {x}}+dzdx{\hat {y}}\,,$
which is at best misleading. In practice, one learns electromagnetism by doing very simple surface integrals where only one term is present.

#### A surface integral over a square with its normal parallel to a Cartesian axis

The vector surface area element,
    $d{\vec {A}}=dA{\hat {n}}=dxdy{\hat {z}}$
occupies rectangle parallel to the xy-plane. If the integral is of the form $\int {\vec {F}}\cdot d{\vec {A}}$, and the area is a square of length L centered at the origin, and occupying the plane, z=H, then:
$\int {\vec {F}}\cdot d{\vec {A}}=\int F_{z}dA=\int _{-L/2}^{+L/2}dx\int _{-L/2}^{+L/2}dyF_{z}(x,y,H)$
In contrast to the one-dimensional integrals of a first-year calculus course, limits are not always used to define the region over which the field is integrated. Instead it is customary to state the integral, $\int f\,dA$, and then use words to describe the area (e.g. "where the integral is over a square with sides of length, L, centered at the origin and occupying the xy plane"). Very simply defined surface integrals can also be defined using limits. For example,
    $\int {\vec {F}}\cdot \,dA=\int _{-L/2}^{L/2}dx\int _{-L/2}^{L/2}dyF_{z}(x,y,0)\,$
actually does describe a surface integral over a square with sides of length, L, that occupies the xy plane, and is centered at the origin. For example, if L=4, and
    $F_{z}(x,y,z)=(1+z)y^{2}\Rightarrow F_{z}(x,y,0)=y^{2}$,
we have:
    $\int F_{z}\,dA=\underbrace {\int _{-4/2}^{4/2}dx} _{4}\underbrace {\int _{-4/2}^{4/2}y^{2}dy} _{(2)\left({\frac {1}{3}}\right)\left(2^{3}\right)}=4+16/3={\frac {28}{3}}$

## Polar coordinates

In the two-dimensional polar coordinate system, the displacement vector, ${\vec {r}}$ is specified by the distance to the origin, $r$, and the angle, $\theta$, measured with respect to the x-axis. The unit vectors (shown in red), ${\hat {r}}$ and ${\hat {\theta }}$ are orthonormal, but change direction as the angle changes. It is evident from the two figures that:
    $d{\vec {\ell }}={\hat {r}}dr+{\hat {\theta }}rd\theta$
    $d\ell ={\sqrt {(dr)^{2}+r^{2}(d\theta )^{2}}}=\left[\left({\frac {dr}{d\tau }}\right)^{2}+r^{2}\left({\frac {d\theta }{d\tau }}\right)^{2}\right]^{1/2}$
    $dA=rdrd\theta$

## Cylindrical coordinates

The cylindrical coordinate system specifies point positions by the symbols $(\rho ,\varphi ,z)$, as shown in the figure. The coordinate $z$ can be positive or negative, while $\rho$ is always positive. Sometimes the Greek r,$\rho$ (called rho), is written in Latin form, $r$, in order to avoid confusion with rho as charge density, and also in order to emphasize the close relationship between polar and cylindrical coordinates.
The line element is
    ${\vec {d}}\mathbf {\ell } =\mathrm {d} \rho \,{\boldsymbol {\hat {\rho }}}+\rho \,\mathrm {d} \varphi \,{\boldsymbol {\hat {\varphi }}}+\mathrm {d} z\,\mathbf {\hat {z}} .$
The volume element is
    $\mathrm {d} V=\rho \,\mathrm {d} \rho \,\mathrm {d} \varphi \,\mathrm {d} z.$
The surface element in a surface of constant radius $\rho$ (a vertical cylinder) is
    $\mathrm {d} S_{\rho }=\rho \,\mathrm {d} \varphi \,\mathrm {d} z.$
The surface element in a surface of constant azimuth $\varphi$ (a vertical half-plane) is
    $\mathrm {d} S_{\varphi }=\mathrm {d} \rho \,\mathrm {d} z.$
The surface element in a surface of constant height $z$ (a horizontal plane) is
    $\mathrm {d} S_{z}=\rho \,\mathrm {d} \rho \,\mathrm {d} \varphi .$

## Spherical coordinates

    $\mathrm {d} {\vec {\ell }}=\mathrm {d} r\,{\boldsymbol {\hat {r}}}+r\,\mathrm {d} \theta \,{\boldsymbol {\hat {\theta }}}+r\sin {\theta }\,\mathrm {d} \varphi \,\mathbf {\boldsymbol {\hat {\varphi }}} .$
While three surface elements exist (one for each direction), the only one commonly used to introduce electrodynamics is in the radial direction:
    ${\hat {r}}dA={\hat {r}}r^{2}\sin \theta \,\mathrm {d} \theta \,\mathrm {d} \varphi .$
Recall that the radian can be defined in terms of an arclength on a circle: $d\theta \equiv ds/r$. By analogy, the solid angle can be defined through an area on a sphere:
    $\mathrm {d} \Omega \equiv {\frac {dA}{r^{2}}}=\sin \theta \,\mathrm {d} \theta \,\mathrm {d} \varphi ,$
where dA is an area element taken on the surface of a sphere of radius, r, centered at the origin.
The volume element is spherical coordinates is:
    $\mathrm {d} V=r^{2}\sin \theta \,\mathrm {d} r\,\mathrm {d} \theta \,\mathrm {d} \varphi .$
Introductory discussions of electromagnetism often involve spherical symmetry, in which fields do not depend on the two directional coordinates (φ and θ). This permits integration over both variables:
$\int d\Omega =\int _{0}^{2\pi }d\varphi \int _{0}^{\pi }sin\theta d\theta =\int _{0}^{2\pi }d\varphi \int _{-1}^{1}d(\cos \theta )=4\pi$
We have just shown that the solid angle associated with a sphere is 4π steradians (just as the circle is associated with 2π radians).

## Divergence, gradient and Laplacian (differential operators)

$_{fromhttps://en.wikipedia.org/w/index.php?title=Divergence&oldid=605214437}$

### Cartesian coordinates

The del operator acting on a scalar field $f=f({\vec {r}})$ is the gradient of that field:
    ${\vec {\nabla }}f={\boldsymbol {\hat {x}}}{\frac {\partial f}{\partial x}}+{\boldsymbol {\hat {y}}}{\frac {\partial f}{\partial y}}+\mathbf {\hat {z}} {\frac {\partial f}{\partial z}},$
The divergence of a the vector field ${\vec {F}}={\vec {F}}({\vec {r}})$ is
    $\operatorname {div} \,{\vec {F}}={\vec {\nabla }}\cdot {\vec {F}}={\frac {\partial F_{x}}{\partial x}}+{\frac {\partial F_{y}}{\partial y}}+{\frac {\partial F_{z}}{\partial z}}\,.$
The Laplacian $\nabla ^{2}$ of a scalar field is
    $\nabla ^{2}f={\vec {\nabla }}\cdot {\vec {\nabla }}f=+{\partial ^{2}f \over \partial x^{2}}+{\partial ^{2}f \over \partial y^{2}}+{\partial ^{2}f \over \partial z^{2}}.$

### Cylindrical coordinates

The del operator acting on a scalar field $f=f({\vec {r}})$ is the gradient of that field:
    ${\vec {\nabla }}f={\boldsymbol {\hat {\rho }}}{\frac {\partial f}{\partial \rho }}+{\boldsymbol {\hat {\varphi }}}{\frac {1}{\rho }}{\frac {\partial f}{\partial \varphi }}+\mathbf {\hat {z}} {\frac {\partial f}{\partial z}},$
The divergence of a the vector field ${\vec {F}}={\vec {F}}({\vec {r}})$ is
    $\operatorname {div} \,{\vec {F}}={\vec {\nabla }}\cdot {\vec {F}}={\frac {1}{\rho }}{\frac {\partial }{\partial \rho }}(\rho F_{\rho })+{\frac {1}{\rho }}{\frac {\partial F_{\varphi }}{\partial \varphi }}+{\frac {\partial F_{z}}{\partial z}}\,.$
The Laplacian $\nabla ^{2}$ of a scalar field is
    $\nabla ^{2}f={\vec {\nabla }}\cdot {\vec {\nabla }}f={1 \over \rho }{\partial \over \partial \rho }\left(\rho {\partial f \over \partial \rho }\right)+{1 \over \rho ^{2}}{\partial ^{2}f \over \partial \varphi ^{2}}+{\partial ^{2}f \over \partial z^{2}}.$

## Advanced topics in vector integrals

The most well-known integrals of vector calculus are deliberately chosen to be simple because the intent is usually to depict important concepts in physics. This section describes moderately difficult geometries.

#### Line integral of scalar field

The most elementary line integral is along an axis. For example,
    $\int _{x1}^{x2}f(x,y_{0},z_{0})\,dx$
is the line integral of $f({\vec {r}})$ from the point $(x_{1},y_{0},z_{0})$ to $(x_{2},y_{0},z_{0})$. A line an an arbitrary direction may be defined parametrically, e.g., by:
    ${\vec {r}}={\vec {r}}_{0}+{\vec {\beta }}\tau$
To define scalar line integral, we need to convert the vector path differential into a scalar by taking the magnitude. It is customary to label a differential in the vector ${\vec {r}}$ using the symbol $d{\vec {\ell }}$ instead of $d{\vec {r}}$ because the latter falsely hints at a change in radius, as we shall soon see:
    $d{\vec {\ell }}\equiv d{\vec {r}}={\vec {\beta }}d\tau \Rightarrow d\ell =\beta d\tau \;,$
where $\beta \equiv |{\vec {\beta }}|$ is the vector magnitude. Writing the path differential ${\vec {d}}\ell$ as ${\vec {d}}r$ would lead to great confusion when the (scalar) magnitude is taken because $dr\equiv |d{\vec {r}}|$ creates a conflict with the differential in radius if spherical coordinates are used: $dr=d|{\vec {r}}|\neq |d{\vec {r}}|$. The scalar line integral over a scalar field, $f=f({\vec {r}})$ is therefore:
    $\int _{\tau 1}^{\tau 2}f(x_{0}+\beta _{x}\tau ,y_{0}+\beta _{y}\tau ,z_{0}+\beta _{z}\tau )\,{\sqrt {\beta _{x}^{2}+\beta _{y}^{2}+\beta _{z}^{2}}}\,d\tau$
is the line integral of $f({\vec {r}})$ from the point $(x_{1},y_{0},z_{0})$ to $(x_{2},y_{0},z_{0})$.
If $\beta =1$, the three components of ${\vec {\beta }}$ are the cosines that each coordinate axis (x-y-z) makes with ${\vec {\beta }}$. The most convenient way to express the differential line vector and scalar are:
    $d{\vec {\ell }}={\hat {x}}dx+{\hat {y}}dy$
    $d\ell ={\sqrt {dx^{2}+dy^{2}}}=\left[\left({\frac {dx}{d\tau }}\right)^{2}+\left({\frac {dx}{d\tau }}\right)^{2}\right]^{1/2}d\tau$

### The vector line integral in polar coordinates

${\vec {F}}\cdot d{\vec {\ell }}=F_{x}dx+F_{y}dy=F_{r}dr+F_{\theta }rd\theta$

## Appendix: Teaching the vector

The "vector" is a nontrivial concept that arises even in Riemannian calculus where an n-dimensional space of variables is defined, and the concept of metric is used to generate vector and tensor fields, all without that fundamental sense of "direction" that students use to define "vector".
A students' introduction to coordinates starts with points on a two-dimensional x-y plane. There are a number of more or less equivalent way to label these points. We begin with the displacement vector:
    ${\vec {r}}=x{\hat {i}}+y{\hat {j}}\rightarrow x{\hat {x}}+y{\hat {y}}\rightarrow x_{1}{\hat {e}}_{1}+x_{2}{\hat {e}}_{2}$
This is essentially an ordered pair of variables that represent the real numbers x and y, and the formalism is easily extended to an arbitrary number of dimensions: :$z{\hat {k}}\rightarrow z{\hat {z}}\rightarrow x_{3}{\hat {e}}_{3}$
One can define the displacement vector as an instruction to move a certain distance in a certain direction. In a Euclidean space, there is no difference between specifying a location (x,y) and an instruction to step from the origin in a certain direction to the point (x,y).
One advantage that vector notation offers is the ability to use symbols to represent a vector, and subscripts to represent the components:
    a=a$_x$ i + a$_y$ j and b=b$_x$ i + b$_y$ j
This notation uses boldface instead of arrows and hats to distinguish between vectors and scalars. (In other words, a, and ${\vec {a}}$ are different way to express the same thing.) The w:scalar (physics) or w:scalar (mathematics) is just a fancy word for "ordinary number". For example, a$_x$ and a$_y$ are scalars that form the two components of vector a. A famous use of different symbols to represent different vectors is F=ma, which says that the vector acceleration, a, multiplied the scalar, m, equals the net force, F (the latter being a vector because it has magnitude and direction).

## Wikipedia links

* w:Vector calculus identities
* w:Surface integral
* Cartesian coordinates
* Polar coordinates
* Cylindrical cordinates
* w:Cylindrical coordinate system#Line and volume elements
* w:Spherical coordinate system#Integration and differentiation in spherical coordinates
* Unit vector (Wikipedia)
* w:standard basis (Wikipedia)
* w:Vector Calculus

### other links

* Math.com Homepage
* ↑ from
* ↑ Quoting a misleading or false statement is unusual, but in this case serves to emphasize the need to not rely on Wikipedia whenever there are consequences to being wrong.
* ↑ (1) $d{\vec {A}}=dxdy{\hat {z}}+dydz{\hat {x}}+dzdx{\hat {y}}$ is not how the surface integral is usually set up. Nevertheless, $d{\vec {A}}$, as shown above, is a vector area element. The usual way is to use a cross product and a surface defined in parametric form: (2) $d{\vec {A}}=d{\vec {\ell }}_{\alpha }\times d{\vec {\ell }}_{\beta }$ $=(dy_{\alpha }dz_{\beta }-dz_{\alpha }dy_{\beta }){\hat {x}}+(dz_{\alpha }dx_{\beta }-dx_{\alpha }dz_{\beta }){\hat {y}}+(dx_{\alpha }dy_{\beta }-dy_{\alpha }dx_{\beta }){\hat {z}}$ We can now "force" (1) to occur with (3) $dz_{\alpha }=0\qquad dz_{\beta }<0\qquad dx_{\beta }=0$ In this context, writing (1) is putting the proverbial round peg into a square hole.
* ↑ from https://en.wikipedia.org/w/index.php?title=Cylindrical_coordinate_system&oldid=606250748
* ↑ https://en.wikipedia.org/w/index.php?title=Spherical_coordinate_system&oldid=608581087