# Data Science Math Skill-Week 1
###### tags: `note`,`math`,`Data Science Math Skill`
# Sets and what they good for
## Sets - Basics and Vocabulary
### Set
Def:
A set is a collection of things.
A set is made up of elements.
Example:
* $A=\{1,2,-2,7\}$
* $E=\{Apple,Monkey,Daniel\}$
### in
Example:
* $2\in A$
* 2 is elemrnt of A.
* $-3\in A$
* 3 is elemrnt of A.
* $-8\notin A$
* -8 isn't elemrnt of A.
### Cardinality
Def:
Size of a size of set.
Numbers of elements in it
Example:
* $|A|=4$
* $|E|=3$
### Intersect & Union
$A=\{1,2,-3,7\},B=\{2,8,-3,10\},D=\{5,10\}$
#### Intersect
Def:
$A\cap B=\{x:x\in A\text{ and } x\in B\}$
Example:
* $A\cap B=\{2,-3\}\rightarrow$ A intersect B
* $B\cap B=\{10\}\rightarrow$ B intersect D
* $A\cap B=\emptyset\rightarrow$ A intersect D
($|\emptyset |=0$)
#### Union
Def:
$A\cap B=\{x:x\in A\text{ or } x\in B\}$
Example:
* $A\cup B=\{1,2,-3,7,8,10\}\rightarrow$ $\{x:x\in A\text{ or } x\in B\}$
* $A\cup D=\{1,2,3,7,5,10\}\rightarrow$ $\{x:x\in A\text{ or } x\in D\}$
## Sets - Medical Testing Example
### theory + Medical Testings
**VBS-
X=set of people in a clinical trial**
$S=\{x\in X|X\text{ has VBS }\}$
$H=\{x\in X|X\text{ doesn't have VBS }\}$
$X=S\cup H$
$S\cup H=\emptyset$
$P=\{x\in X|X\text{ tests positive for VBS }\}$
$N=\{x\in X|X\text{ tests negative for VBS }\}$
$P\cup N=X$
$P\cap N=\emptyset$
* $S\cap P\rightarrow \text{ true positives}$
* $H\cap N\rightarrow \text{ true negatives}$
* $S\cap N\rightarrow \text{ false negatives}$
* $H\cap P\rightarrow \text{ false positives}$
### Rate
$\frac{|S|}{|X|}=\text{ propotion of people in this study who do have VBS}$
$\frac{|S|}{|X|}=\text{ propotion of people in this study without VBS}$
* $\frac{|S\cap P|}{|S|}=\text{ true positive rate}$
* $\frac{|H\cap P|}{|H|}=\text{ flase positive rate}$
* $\frac{|S\cap N|}{|S|}=\text{ flase negative rate}$
* $\frac{|H\cap N|}{|H|}=\text{ true positive rate}$
## Sets - Venn Diagrams
$A=\{1,5,10,2\},|A|=4$

$A=\{1,5,10,2\},B=\{5,-7,10,3\}$
### Inclusion-exclusion formula
$|A\cup B|=|A|+|B|-|A\cap B|=4+4-2=6$
Example(Medical testing):

# The infinite world of Real Numbers
## Numbers - The Real Number Line
### $\Bbb R$
$\Bbb R=\text{ the real numbers}$

* $\Bbb Z=\{...-3,-2,-1,0,1,2,3...\}$
* $\Bbb Q=\text{ rational numbers ( numbers written as ratio)}$
* $\Bbb N=\text{ Natural numbers (all positive integers starting from 1. (1,2,3....inf)}$

### Distence
Def:
absolute value of a real number X,|X|is the distance from X to 0.
example:

#### General rule
>for any$X\in\Bbb R$
$|X|=\begin{Bmatrix}
\text{ X=if X is non-negative}\\
\text{ -X=if X is negative}\\
\end{Bmatrix}$
#### check
$|8.7|=8.7$
$|-10|=-(-10)$
## Numbers - Less-than and Greater-than
### Inequalities Basic ideas
* $a\lt b$
* $a\lt b \text{ a less than b means a is to the left of b on }\Bbb R$
* $c\gt d$
* $c\gt d \text{ c greater than d means c is to the right of d on }\Bbb R$
$A\lt b \iff A\gt b$
* $x\le y$
* $x\lt y \text{ x less than or equal to y}$
* $z\ge w$
* $z\lt w \text{ z greater than or equal to w}$
* $e\lt\lt f$
* $e\lt\lt f\text{ means e is much much less than on f}$
## Numbers - Algebra With Inequalities
### How?
### plus
Rule:
if a=b,than a+c=b+c
example:
* (1)
1. $4=4$
2. $4+3=4+3$
* (2)
1. $x+3=10$
2. $x+3-3=10-3$
3. $x=7$
### multiply
Rule:
if a,b,c are numbers,and $c\neq 0$,and a=b
then $c\times a=c\times b$
example:
* (1)
1. $4=4$
2. $2\times 4=2\times 4$
3. 8=8
* (2)
1. $4=4$
2. $-3\times 4=-3\times 4$
3. $-12=-12$
---
### plus(Inequalities)
Rule:
If $a\lt b$
then $a+c\lt b+c$
example:
* (1)
1. $4\lt 7$
2. $4+2\lt 7+2$
3. $6\lt9$
* (2)
1. $4\lt 7$
2. $4-1\lt 7-1$
3. $3\lt6$
### multiply(Inequalities)
Rule:
Suppose $a\lt b$
if $c\gt 0$
than $a\times c\lt b\times c$
else if $c\lt 0$
than $a\times c\gt b\times c$
else if $c=0$
than $a\times c=b\times c$
example:
* (1)
1. $5\lt 8$
2. $5\times 3\lt 8\times 3$
3. $15\lt24$
* (2)
1. $4\lt 7$
2. $-1\times 4\lt -1\times 7$
3. $-4\gt -7$
## Numbers - Intervals and Interval Notation
* $(a,b)=\{x\in\Bbb R :a\lt x\lt b\}$
* $[a,b]=\{x\in\Bbb R :a\le x\le b\}$
* $[a,b)=\{x\in\Bbb R :a\le x\lt b\}$
* $[a,\infty )=\{x\in\Bbb R :x\ge a\}$
* $(-\infty,b )=\{x\in\Bbb R :x\lt b\}$
{%hackmd 2uXXCExjQN-3m0TM_k8pQg %}