# Week 1: Data Science Math Skills

In the first week, I learned three lessons which are:-

*Sets and What They’re Good For**The infinite World of Real Numbers**That Jagged S Symbol*

So, In the first lesson, the things I learned are:

What is Set?

Cardinality

Intersections

Unions

Medical Testing Example (test and cardinality)

Venn Diagrams

Inclusion-Exclusion Formula

# Set

A set is a collection of things, in general set is a collection of elements

**for example :** A = {1,2,3,4} , the 1, 2, 3 and 4 are the elements of set A

- 1 ∈ A ( means 1 is an element of A)
- 5 ∉ A ( means 5 is not an element of A)

# Cardinality

Cardinality means the size of a set means the number of elements in it.

**for example: **A = {2,3,5,1,2,3} and B = {4,1,2}

- The cardinality of |A| = 6 (because there are 6 elements in A)
- The cardinality of |B| = 3 (because there are 3 elements in B)

# Intersections

Intersection simple means the elements which are present in both sets.The symbol for intersection is ∩ which is known as intersects and in general “and”

**for example :** A = {2,3,4,5,6}, B = {2,4,8,9} and C = {7,8,9}

A ∩ B = {2,4}

B ∩ C = {9}

A ∩ C = ∅

`A ∩ C = ∅ (∅, is known as the empty set)`

**Syntax :** A ∩ B { x : x ∈ A and x ∈ B}

# Unions

Unions simple means the elements which are present in either set.The symbol for union is ∪ which is known as union and in general “or”

**for example :** A = {2,3,4,5,6}, B = {2,4,8,9}

A ⋃ B = {2,3,4,5,6,8,9}

B ⋃ C = {2,4,8,9,7}

**Syntax :** A ⋃ B { x : x ∈ A or x ∈ B}

# Medical Testing Example

As a part of the course I also learned about a **medical testing example. **This medical example is best example to understand, how we can implement sets in real world. So, one think to note that VBS means “very bad syndrome” in this example.

let X = set of people in a clinical trial

S = { x ∈ X : x has VBS}, “S for Sick”

H = {x ∈ X : x does not have VBS}, “H for Healthy”

`S ∩ H = ∅ (No one person is both S and H)`

S ∪ H = X ( either person have VBS or not)

## Test

Now, lets talked about test

P = {x ∈ X : x tests positive for VBS}, “P for Positive”

N = { x ∈ X: x tests negative for VBS}, “N for Negative”

`P ∩ N = ∅ (No one tests is both P and N)`

P ∪ N = X (Either test is P or N)

*S ∩ P are True Positive**H ∩ N are True Negative**S ∩ N are False Negative**H ∩ P are False Positive*

## Cardinality (size)

|S|

─── = proportion of people who have VBS

|X||H|

─── = proportion of people who do not have VBS

|X||S∩P|

───── = true positive rate

|X||H∩N|

───── = true negative rate

|X||H∩P|

───── = false positive rate

|X||S∩N|

───── = false negative rate

|X|

# Venn Diagrams

Venn Diagrams is the way to visualize sets

**for example:**

- A = {1,5,10,2}

2. A = {1,9,6,5,7} and B = {3,4,5,7,8}

# Inclusion-Exclusion Formula

According to the formula,

`|A ⋃ B| = |A| + |B|- |A ∩ B|`

If we apply this in the upper example Fig 1.2 Multiple Sets

|A ⋃ B| = 8, {1,9,6,3,4,8} |A| = 5, {1,9,6,5,7}|B| = 5, {3,4,8,5,7}|A ∩ B| = 2, {5,7}|A ⋃ B| = |A| + |B|- |A ∩ B|8 = 5 + 5–28 = 10 -28 = 8

In the second lesson, the things I learned are:

Real Numbers : Integers and rational numbers

Absolute value

Intervals and Interval Notation

Real numbers are represented by ℝ, graph of ℝ is mention in fig 2.1

Integers are represented by ℤ for example {..,-3,-2,-1,0,1,2,3,…}

Rational Number are also known as integers they can be written as a/b where b is a non-zero denominator whereas Irrational Number are the numbers which cannot be written as simple fraction ex: pi

# Absolute Value

For any x ∈ ℝ,

|x| = x, if x is non-negative|x| = -x, if x is negative

**for example** :

|1.2| = 1.2

|-1.2| = 1.2 = -(-1.2)

# Inequalities

a < b “ a is less than b”a > b “a is greater than b”a ≤ b “a is less than or equal to b”a ≥ b “a is greater than or equal to b”a << b “a is much much lesser than b”

# Closed intervals

In closed intervals *square brackets* [] are used ..

**for example**:

[2,3] = {x ∊ ℝ : 2 ≤ x ≤ 3}

# Open intervals

In open intervals *parentheses () are used ..*

**for example**:

(2,3) = {x ∊ ℝ : 2 < x < 3}

# Half-open intervals

In Half-open intervals both open and closed intervals are used ..

**for example**:

1.(2,3] ={x ∊ ℝ : 2 < x ≤ 3}

2.[2,3) = {x ∊ ℝ : 2 ≤ x < 3}

In the third lesson, the things I learned are:

Sigma Notation

Distributive and Commutative property

Summation of constants

Mean and Variance

# Sigma Notation

Sigma is represented by Σ, some example are:

**for example**:

`i is just an “dummy indices”, that is used as a counter.`

# Distributive Property

This is due to the distributive property: a(b+c) =ab+ac

# Commutative Property

This is due to the commutative property: a+b=b+a

# Summation of constants

Summation of constants means if the whole value is constant then sum that value to n times

# Mean and Variance

To calculate the value of μ

To calculate mean,

To calculate variance and standard deviation,