# Calculus in the plane¶

Dr Juan H Klopper

## The algebraic structure in $\mathbb{R}^{2}$¶

Let's kick things off by considering numbers and numbering systems and start off with the natural (counting) numbers, $\mathbb{N}$. They start at $1$ and increment by $1$. That's great for adding, but what about subtracting?

To account for negative addition (subtraction) we introduce the integers, $\mathbb{Z}$. They are $\dots -n,-n+1,-n+2,\dots -2,-1,0,1,2,\dots ,n-2,n-1,n,\dots$.

To account for division we require the rational numbers, $\mathbb{Q}$, which are the ratios of integers.

To complete the gaps left by the rational number we require numbers that are not ratios of integers, the socalled irrational numbers, $\mathbb{I}$ , such as $\pi$ and $\sqrt { 2 }$. Together, these numbers make up the real numbers, $\mathbb{R}$, presented geometrically on a real line $x$-axis on a Cartesian plane.

This does not encompass all numbers, though. We need to introduce complex numbers, $\mathbb{C}$. A complex number consist of a real part and an imaginary part. Both of these are represented as real numbers, but the imaginary part is multiplied with the imaginary number $i$, which is $\sqrt{-1}$.

This section of the lesson has the heading The algebraic structure in $\mathbb{R}^{2}$. $\mathbb{R}^{2}$ represents ordered pairs of real numbers as in $\left(x,y\right)$. They can be visualized as points on a two-dimensional, Cartesian plane.

In these notebooks, I will use the notation $z=\left(x,y\right)$. I will also use the Greek lowercase letters zeta $\left(\zeta\right)$, xi $\left(\xi\right)$, and eta $\left(\eta\right)$, such that $\zeta=\left(\xi , \eta \right)$.
In a simple example we have $$z=\left( x,y \right) \\ \zeta =\left( \xi ,\eta \right) \\ z\pm \zeta =\left( x\pm \xi ,y\pm \eta \right)$$

We also define constant multiplication $$cz = \left( cx,cy \right)$$

We can represent points in the two-dimensional, $\mathbb{R}^{2}$, plane using arrays and matplotlib in python™.

In [1]:
# Using direct importing and namespace abbreviation
from numpy import random
import matplotlib.pyplot as plt

In [2]:
# Plotting graphs directly in the notebook
%matplotlib inline

In [3]:
x_points = random.randint(-3, 3, 10) # Ten random integers ranging from -3 to 3
y_points = random.randint(-3, 3, 10)

In [4]:
 # Creating a plot of size 10 by 10
plt.figure(figsize = (10, 10))

# Plotting ordered pairs of the x- and y-values above
# Using blue, round markers of size 12, with no  lines connecting them
plt.plot(x_points, y_points, marker = "o", markerfacecolor = "blue", markersize = 12, linewidth = 0)
plt.hlines(0, xmin = x_points.min(), xmax = x_points.max(), label = "x-axis")

# Plotting the x- and y-axis
plt.vlines(0, ymin = y_points.min(), ymax = y_points.max(), label = "y-axis");


## The distance between two points¶

Since we are dealing with Euclidian space we can easily calculate the distance between two points $z = \left(x,y\right)$ and $\zeta=\left(\xi , \eta \right)$ from the Pythagorean theorem $$\left| z-\zeta \right| =\sqrt { { \left( x-\xi \right) }^{ 2 }+{ \left( y-\eta \right) }^{ 2 } }$$

With $\xi = 0$ and $\eta = 0$ we have $$\left| z \right| = \sqrt{{x}^{2}+{y}^{2}}$$

The geometry of the Pythagorean theorem also tells us why we have the triangle inequality $$\left| z-\zeta \right| \le \left| z \right| +\left| \zeta \right|$$

## Domains¶

Before we can define a domain in $\mathbb{R}^{2}$ we need to define the words open, connected, and interior points.
Consider a fixed point in $\mathbb{R}^{2}$, call it ${z}_{0}$. Any (free to move) point $z$ near ${z}_{0}$ creates a distance $r=\left| z-{ z }_{ 0 } \right|$ between them. If we fix $r$ we have a circle or disk around ${z}_{0}$.
For an open set of points in this disk, we do not include the rim $$D\left( { z }_{ 0 };r \right) =\left\{ z\in \mathbb{ R }^{ 2 },\left| z-{ z }_{ 0 } \right| Now consider a subset of points (ordered pairs) in the plane and call them  \Omega. Suppose that a point z is in \Omega (is one of the pairs in the subset of pairs). We can only call z and interior point of \Omega if we can create a disk around z (by the method above, i.e. have a fixed r>0) if all the points that make up this disk falls entirely inside \Omega$$ D\left( z;r \right) \subset \Omega $$It's all about the signs, ={r}, or \le {r} and < {r}. An open set then excludes the boundary points. If we included the boundary (border) points in a subset (disk) we cannot create a (new) disk (with radius r) around such a border point such that all the points in this (new) disk fall within the original subset. Open sets include the entire plane in \mathbb{R}^{2}, the empty set, \emptyset, any half plane such as y>0 or x<0. We also define any open set, S, minus one of its interior points, S-\left\{z\right\}, as open. So far, so good. We move on to the next definition. Subsets {S}_{1} and {S}_{2} in \mathbb{R}^{2} are disconnected if there union is the empty set, \emptyset. This means that they have not point in common. An open set is connected if and only if it is not disconnected. Another way to look at this is to say that an open set is connected if any two points in the set can be connected by a finite number of straight lines all going through points that are members of the set. We now have enough knowledge to define a domain in \mathbb{R}^{2}. It is an open, connected subset in \mathbb{R}^{2}. The most common domains we will be dealing with are \mathbb{R}^{2} itself, open disks, punctured disks and the upper half, y>0, of the plane. ## Boundedness and boundaries¶ Here are two more terms to know about. A bounded subset in \mathbb{R}^{2} is bounded if it can be contained within some disc with a finite radius, r. The upper half of the plane, for instance, cannot be a bounded set, as it moves off into infinity as y\rightarrow \infty . Similarly the graph of a function such as y=\cos{x} or \left| z \right|>r are not bounded. On the other hand we have examples of bounded sets such as the empty set, \emptyset, an open or closed set, a single point, any finite set of points, a subset of a bounded set and functions such as {r}_{1}<\left|z-{z}_{0}\right|<{r}_{2}. We can view the definition of a boundary point by considering a point, z on the edge of a disk, S. If we construct any disk around z and some of the points in this new disk falls within S and some don't, then z is a boundary point of S. Importantly, z does not have to be an element of S. Think about S as an open disk with elements only within a radius  We can also consider the fact that a point z is only a boundary point of a set S if it is a boundary point of the set \mathbb{R}^{2}-S. The boundary of a set S is then the collection of all the boundary points of that set. The boundaries of both open around closed disks around a point {z}_{0} are those points, z, such that \left|z-{z}_{0}\right|=r. For both of these disks with a puncture at a point, boundaries will exist with the same (boundary) as the two disks plus the puncture point. \mathbb{R}^{2} itself has no boundary. One half of the plane is an interesting case. It is an unbounded set, but with a boundary, i.e. the boundary of the unbounded set y>0 is y=0. ## Curves in the plane¶ ### The equations for a circle¶ You might have noticed that we have not stuck to the conventional notation for a function. It makes sense to use alternate notations for the sake of what is to come. Here is an example of different notations. We have the equation for a cirle y=\pm \sqrt { { r }^{ 2 }-{ x }^{ 2 } } . We can also write this as C=C\left( 0;r \right) for a circle around the origin, O=\left( 0,0 \right), with a radius, r. This equates to a set of points, z, with \left| z \right| = r. We can parametrize this curve. Introducing a new parameter (variable) such as t, we can create an interval \left[0,2\pi \right], such that , \le t \le 2 \pi. A function in t can then be written as \alpha \left( t \right) = \left( x,y \right) = \left( r \cos{t}, r \sin{t} \right). With \left| \alpha \left({t} \right) \right| = r we have that every point  \alpha \left( {t} \right)  lies on the circle, C=C\left( 0;r \right). A new notation for this would be \alpha : \left[ 0, 2 \pi \right] \rightarrow C \left( 0;r \right). What we have done here is nothing other than parametrizing a function and considering polar coordinates. Doing this allows our function to change from a static circle to a dynamic one with (counterclockwise) movement. At t=0 we have \alpha \left(t\right)=\left(r,0\right) in polar form. At t=\frac{\pi}{2} we have \alpha\left( \frac{\pi}{2} \right) = \left( 0,r \right), and so on. We can also differentiate with respect to t with our equation for a circle in this form.$$ \alpha \left( t \right) =\left[ { \alpha }_{ 1 }\left( t \right) ,{ \alpha }_{ 2 }\left( t \right) \right] =\left[ r\cos { \left( t \right) } ,r\sin { \left( t \right) } \right] \\ \alpha '\left( t \right) =\left[ { \alpha }'_{ 1 }\left( t \right) ,{ \alpha ' }_{ 2 }\left( t \right) \right] =\left[ -r\sin { \left( t \right) } ,r\cos { t } \right] $$The first derivative is now a vector and some texts use angled bracket <> to denote these.$$ \alpha '\left( \frac { \pi }{ 2 } \right) =\left[ { \alpha }'_{ 1 }\left( \frac { \pi }{ 2 } \right) ,{ \alpha ' }_{ 2 }\left( \frac { \pi }{ 2 } \right) \right] =\left< -r,0 \right> $$By adding a coefficient to t we can change the dynamic behavior of our circle equation. Examples include adding an integer, i.e 4. This will allow going around the circle, anticlockwise, four times as t goes from 0 to 2 \pi. We can also go clockwise by using the coefficient 2\pi and changing the trigonometric functions as in  \alpha \left( 2 \pi t \right) =\left[ { \alpha }_{ 1 }\left( 2 \pi t \right) ,{ \alpha }_{ 2 }\left( 2 \pi t \right) \right] =\left[ r\sin { \left( 2 \pi t \right) } ,r\cos { \left( 2 \pi t \right) } \right] . ### Piecewise smooth curves¶ Let's stick to our parametrized function \alpha \left( {t} \right) for now. We parametrize it with a variable t on the interval \left[ a,b \right]. Instead of it mapping to a circle, we'll let it map to some arbitrary subset of \mathbb{R}^{2}. We can call that subset  \complement . This means every point, z in the subset  \complement  is of the form z= \alpha \left({t} \right) . Just remember, for this we need {\alpha}_{1} \left( t \right) and {\alpha}_{1} \left( t \right) to be continuous functions of t. We need more conditions than this, creating a well-behaved class of parametrizations. We need \alpha to map to \complement such that we only include the functions of {\alpha}_{1} \left( t \right) and {\alpha}_{2} \left( t \right) that are differentiable (exist and smooth) at any point of t. We also need all the vectors that are created by the first derivatives of {\alpha}_{1} \left( t \right) and {\alpha}_{2} \left( t \right) to be non-zero vectors. Lastly we only want curves that are closed loops. That is when \alpha \left( a \right) = \alpha \left( b \right) also means that \alpha ' \left( a \right) = \alpha ' \left( b \right) At first read the paragraph above might seem a bit difficult to understand. See it in this light, though. Consider a domain in \mathbb{R}^{2}. We only want a curve that is continuous. Furthermore, if we parametrize it, which means as some parameter, usually t for time, changes, a marker on the curve changes position. We also want velocity all along the curve. This means the first derivative can never be zero, also the marker stops somewhere along the curve. Lastly, we want something special at either ends t=a and t=b. We want these points to coincide and for their derivatives to be equal, so that the marker can just keep going (on the same path as before and at the same velocity). We now need to introduce the concept of a simple parametrization. We want  \alpha \left( {t}_{1} \right) = \alpha \left( {t}_{2} \right)  to be the case only when  {t}_{1} = {t}_{2}. That means, we don't want the curves to cross over themselves. For a circle we can have a crossing at the start and end. This would consitute a closed loop. A good example of a non-simple parametrization is one of our previous examples where we had a coefficient of 4 for our parameter. For every t \in \left[ a,b \right] we have 4 values for \alpha. Next, we must allow for a finite set of corners, so as to form shapes. At a corner, we don't have a smooth velocity transition. This is easy enough to get around, by introducing a finite set of pieces to our parametrized curve. I stress, there must be a finite set of pieces and each piece must obey all the requirements stated above. Here is an example. Consider a right triangle with corners at \left( 0,0 \right), \left( 1,0 \right), and \left( 1,1 \right). We would have the parametrized function$$ \alpha \left( t \right) =\begin{cases} \left( t,0 \right) ;t\in \left[ 0,1 \right] \\ \left( 1,t-1 \right) ;t\in \left[ 1,2 \right] \\ \left( 3-t,3-t \right) ;t\in \left[ 2,3 \right] \end{cases} $$### The length of a curve¶ If we have a parametrized curve in \mathbb{R}^{2} and the coordinate functions are smooth, the norm of the parameterized function is bounded and piecewise continuous.$$ \left| \alpha ' \left( t \right) \right| = \sqrt{{ \left[ { \alpha ' }_{ 1 }\left( t \right) \right] }^{ 2 }+{ \left[ { \alpha ' }_{ 2 }\left( t \right) \right] }^{ 2 }} $$This follows from the summation of infinitely small sections of the curve, the length of each of which is calculated from the slope between two points, using the Pythagorean theorem. In the limit, the two points coincide, hence the integration. The length of a curve is thus$$ \int _{ a }^{ b }{ \left| \alpha '\left( t \right) \right| } dt $$Let's then compute the length of the mapping \alpha : \left[ 0, 2 \pi \right] \rightarrow C \left( 0;r \right) We have  { \alpha }_{ 1 }\left( t \right) =r\cos { \left( t \right) }  and { \alpha }_{ 2 }\left( t \right) =r\sin { \left( t \right) } . Thus$$ { \alpha }_{ 1 }'\left( t \right) =-r\sin { \left( t \right) } \\ { \alpha }_{ 2 }'\left( t \right) =r\cos { \left( t \right) } $$and$$ \int _{ 0 }^{ 2\pi }{ \sqrt { { \left[ -r\sin { \left( t \right) } \right] }^{ 2 }+{ \left[ r\cos { \left( t \right) } \right] }^{ 2 } } } dt\\ r\int _{ 0 }^{ 2\pi }{ } dt\\ 2\pi r $$If we consider  \alpha \left( t \right) =\left[ r\cos { \left( 3t \right) } ,r\sin { \left( 3t \right) } \right]  we have the following$$ { \alpha }_{ 1 }'\left( t \right) =-3r\sin { \left( t \right) } \\ { \alpha }_{ 2 }'\left( t \right) =3r\cos { \left( t \right) } \\ \int _{ 0 }^{ 2\pi }{ \sqrt { { \left[ -3r\sin { \left( t \right) } \right] }^{ 2 }+{ \left[ 3r\cos { \left( t \right) } \right] }^{ 2 } } } dt\\ 3\cdot 2\pi r $$Let's do an example using python™ and sympy$$ \alpha :\left[ 0,\frac { 3\pi }{ 2 } \right] \rightarrow C\left( 0,r \right) $$with$$ \alpha \left( t \right) =\left[ r\cos { \left( 2t \right) } ,r\sin { \left( 2t \right) } \right] $$In [5]: import sympy as sym # Making using of namespace abbreviation  In [6]: # Using Latex to print matehmatical notation sym.init_printing(use_latex = "mathjax")  In [7]: # Creating algebraic symbols r, t = sym.symbols("r, t")  In [8]: # Using the Derivative function which prints the derivative to the screen # Arguments are function and variable with respect to which derivative is taken, i.e. # (function, t) sym.Derivative(r * sym.cos(2 * t), t)  Out[8]:$$\frac{\partial}{\partial t}\left(r \cos{\left (2 t \right )}\right)$$In [9]: sym.Derivative(r * sym.sin(2 * t), t)  Out[9]:$$\frac{\partial}{\partial t}\left(r \sin{\left (2 t \right )}\right)$$In [10]: # Calculating the actual derivative using .doit() sym.Derivative(r * sym.cos(2 * t), t).doit()  Out[10]:$$- 2 r \sin{\left (2 t \right )}$$In [11]: # Calculating the derivative using sym.diff(function,variable) sym.diff(r * sym.sin(2 * t), t)  Out[11]:$$2 r \cos{\left (2 t \right )}$$In [12]: # The integral sym.Integral(sym.sqrt(((sym.diff(r * sym.cos(2 * t), t))**2) + ((sym.diff(r * sym.sin(2 * t), t))**2)), (t, 0, 3 * sym.pi / 2))  Out[12]:$$\int_{0}^{\frac{3 \pi}{2}} \sqrt{4 r^{2} \sin^{2}{\left (2 t \right )} + 4 r^{2} \cos^{2}{\left (2 t \right )}}\, dt$$In [13]: # Actual calculation sym.integrate(sym.sqrt(((sym.diff(r * sym.cos(2 * t), t))**2) + ((sym.diff(r * sym.sin(2 * t), t))**2)), (t, 0, 3 * sym.pi / 2))  Out[13]:$$3 \pi \sqrt{r^{2}}$$Sympy will not always simplify everything (even using .simplify()). The answer is thus  3 \pi {r}. Let's do this example$$ f \left( x \right) = {x}^{2}, x \in \left[ 0,1 \right] $$If we parametrize this we have$$ x = t \\ y = {t}^{2}  \left| f\left( x \right) \right| =\sqrt { { x'\left( t \right) }^{ 2 }+{ y'\left( t \right) }^{ 2 } } $$Thus we have$$ \int _{ t=0 }^{ t=1 }{ \sqrt { 1+4{ t }^{ 2 } } } dt $$We have to use trig substitution$$ t=\frac { 1 }{ 2 } \tan { \left( \theta \right) } ,\quad { t }^{ 2 }=\frac { 1 }{ 4 } \tan ^{ 2 }{ \left( \theta \right) } ,\quad dt=\frac { 1 }{ 2 } \sec ^{ 2 }{ \left( \theta \right) } $$This results in the integral$$ \int _{ \theta =0 }^{ \theta =\arctan { \left( 2 \right) } }{ \frac { 1 }{ 2 } \csc ^{ 3 }{ \left( \theta \right) } } d\theta $$The solution is below, using sympy In [14]: sym.integrate((1/2) * ((sym.sec(t))**3), (t, 0, sym.atan(2))).simplify()  Out[14]:$$\log{\left (\frac{\left(\frac{2 \sqrt{5}}{5} + 1\right)^{0.125}}{\left(- \frac{2 \sqrt{5}}{5} + 1\right)^{0.125}} \right )} + 0.5 \sqrt{5}$$## The dot product¶ The dot product of two vectors (in \mathbb{R}^{2}) is defined as$$ U \cdot V = {u}_{1}{v}_{1}+{u}_{2}{v}_{2} \\ U \cdot V = \left| U \right| \left| V \right| \cos{\theta} $$The norm is$$ \left| U \right| = \sqrt{{u}_{1}^{2} + {u}_{2}^{2}} $$We can accomplish these equations in sympy by using a reference frame. In this example, we'll use C for a Cartesian plane. In [15]: from sympy.physics.vector import ReferenceFrame, dot C = ReferenceFrame("C")  Below, we use the directions of the reference frame. In this case we have two parametrized functions for$$ U = \left< 3,7 \right> \\ V = \left< -3,8 \right> $$In [16]: U = 3 * C.x + 7 * C.y U  Out[16]:$$3\mathbf{\hat{c}_x} + 7\mathbf{\hat{c}_y}$$In [17]: V = -3 * C.x + 8 * C.y V  Out[17]:$$- 3\mathbf{\hat{c}_x} + 8\mathbf{\hat{c}_y}$$In [18]: dot(U, V)  Out[18]:$$47$$Let's see how that looks symbolically. In [19]: u1, u2, v1, v2 = sym.symbols("u_1 u_2 v_1 v_2")  In [20]: U = u1 * C.x + u2 * C.y V = v1 * C.x + v2 * C.y  In [21]: U  Out[21]:$$u_{1}\mathbf{\hat{c}_x} + u_{2}\mathbf{\hat{c}_y}$$In [22]: V  Out[22]:$$v_{1}\mathbf{\hat{c}_x} + v_{2}\mathbf{\hat{c}_y}$$In [23]: dot(U, V)  Out[23]:$$u_{1} v_{1} + u_{2} v_{2}$$It is also very easy using this notation to get the magnitude of U. In [24]: U.magnitude()  Out[24]:$$\sqrt{u_{1}^{2} + u_{2}^{2}}$$### The unit tangent vector¶ The tangent to an arc, which we will commonly see as a boundary to a domain, is the first derivative of the parametrized function of that arc. So, we have a Jordan domain  \Omega , with a boundary, sometimes denoted as  \partial \Omega . We denote  \Gamma  as a Jordan curve that forms part of the boundary. As per usual, we will have a parametrization of  \complement , denoted by  \sigma : \left[ 0,L \right] \rightarrow \complement . That is a fancy notation for saying  \sigma \left( s \right) = \left< {\sigma}_{1} \left( s \right), {\sigma}_{2} \left( s \right) \right>  if we chose s as our parameter. The tangent vector at any point s is  \sigma ' \left( s \right) = \left< {\sigma}_{1} ' \left( s \right), {\sigma}_{2} ' \left( s \right) \right> , which we will denote as  T \left( s \right) . We are more interested in the the unit tangent vector, so we have to divide  \sigma ' \left( s \right)  by its norm. ### The unit normal vector¶ This is also known as the outward normal vector and we construct it so that it always faces outward from the domain  \Omega and is perpendicular to the unit tangent vector. We denoted it as  N \left( s \right). If you think about it, you can construct the unit normal vector from the unit tangent vector. Let's leave the unit part out for a bit. We can always bring it back by dividing by its norm.$$ \sigma '\left( s \right) =\left< { \sigma ' }_{ 1 }\left( s \right) ,{ \sigma ' }_{ 2 }\left( s \right) \right> \\ n\left( s \right) =\left< { \sigma ' }_{ 2 }\left( s \right) ,-{ \sigma ' }_{ 1 }\left( s \right) \right> $$So, we have the unit tangent vector$$ T\left( s \right) =\frac { \sigma '\left( s \right) }{ \left\| \sigma '\left( s \right) \right\| } $$and the unit normal vector$$ N\left( s \right) =\frac { n\left( s \right) }{ \left\| n\left( s \right) \right\| }  They are perpendicular, so their dot product is $0$.

In [ ]: