# Cartesian coordinates

## Basics

Cartesian plane denoted $\R^2$

\begin{alignedat}{1} x-axis &= \lbrace (x,y) \in \R^2 : y=0 \rbrace \\ y-axis &= \lbrace (x,y) \in \R^2 : x=0 \rbrace \\ first \nobreakspace quadrant &= \lbrace (x,y) \in \R^2 : x>0, y>0 \rbrace \\ second \nobreakspace quadrant &= \lbrace (x,y) \in \R^2 : x<0, y>0 \rbrace \\ third \nobreakspace quadrant &= \lbrace (x,y) \in \R^2 : x<0, y<0 \rbrace \\ fourth \nobreakspace quadrant &= \lbrace (x,y) \in \R^2 : x>0, y<0 \rbrace \\ \end{alignedat}

## Calculating distance

Pythagoras

$z = \sqrt{x^2 + y^2}$

Distance formula

Given three points:

\begin{alignedat}{1} A &= (x_a, y_a) \\ B &= (x_b, y_b) \\ C &= (x_c, y_c) \\ \\ dist(A,B) &= \sqrt{(x_a-x_b)^2+(y_a-y_b)^2} \\ \\ dist(A,C) &= \sqrt{(x_a-x_c)^2+(y_a-y_c)^2} \end{alignedat}

## Clustering

If $A$ and $B$ are in Cluster $I$
and $C$ is in Cluster $II$

Then

$dist(A,B)<< dist(A,C)$

## Lines

Slope of line segment

Given
$A = (a,b)$
$B = (c,d)$

\begin{alignedat}{1} Slope\enspace of \enspace \overrightarrow{AB} &= \\ m &= \frac{d-b}{c-a} \end{alignedat}

Basic line formula

$y-y_0 = m(x-x_0)$ "Point-slope" form
$y = mx + b$ "slope-intercept" form

Given a line that passes through $(2,1)$ and $(3,2)$, i.e. a slope of 1,
for any point $(x,y)$ to be on the line, the slope from $(2,1)$ to $(x,y)$ must be $1$

\begin{alignedat}{1} 1 &= \frac {y-1}{x-2} \\ \end{alignedat}

rearranging...

\begin{alignedat}{1} y − 1 &= 1(x − 2) \end{alignedat}

so a definition of the line is:

\begin{alignedat}{1} \ell = \big\lbrace (x,y) \in \R^2 : y − 1 &= 1(x − 2) \big\rbrace \\ \end{alignedat}

Point-slope formula for line

Above generalises to

If a line $\ell$ has slope $m$, and if $(x_0, y_0)$ is any point on $\ell$, then $\ell$ has the equation:

\begin{alignedat}{1} y-y_0 = m(x-x_0) \end{alignedat}

Slope-intercept formula for line

Considering same line defined as

\begin{alignedat}{1} \ell = \big\lbrace (x,y) \in \R^2 : y − 1 &= 1(x − 2) \big\rbrace \\ \end{alignedat}

This line intercepts the $y$-axis at a point $(0,b)$ i.e.

\begin{alignedat}{1} b-1 &= 1(0-2) \\ b &= -1 \end{alignedat}

Substituting this intercept point back into the Point-Intercept formula:

\begin{alignedat}{1} y-(-1) &= 1(x-0) \\ y+1 &= x \\ y &= 1x-1 \end{alignedat}

This generalises into the Slope-Intercept formula for the line:

If $\ell$ has slope $m$, and $\ell$ hits the y-axis at $(0, b)$, then

\begin{alignedat}{1} y &= mx + b \\ \end{alignedat}

is an equation for $\ell$, where $m$ is the slope and $b$ is the y-intercept.

Based on course material by Paul Bendich and Daniel Egger from Data Science Maths Skills