math camp ii - yiqing xuyiqingxu.org/teaching/mathcamp2/slides_basics_handout.pdf · math camp ii...

27
Math Camp II Basics Yiqing Xu MIT August 24, 2014

Upload: lemien

Post on 25-Mar-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Math Camp IIBasics

Yiqing Xu

MIT

August 24, 2014

Plan

Lectures1 Preliminaries: notations, function; Linear algebra: vectors, vector space2 Linear algebra: matrix algebra; Application: OLS mechanics3 Calculus: differentiation; Application: OLS Asymptotics4 Calculus: integration5 Calculus: integration; R Session

R Session:1 Basic plots2 Basic parallel computing3 Accessing remote servers

“Homework”: Four of them, expected to be finished in class

Yiqing Xu (MIT) Basics August 24, 2014 1 / 24

1 Notations

2 Functions

Types of numbers

Natural numbers: N = {1, 2, 3, 4, . . .}Integers: Z = {. . . ,−3,−2,−1, 0, 1, 2, 3, . . .}Rational numbers: Q ≡ { ab |a, b ∈ Z; b 6= 0}Real numbers (R)

Complex numbers (C)

Yiqing Xu (MIT) Basics August 24, 2014 2 / 24

Symbols

Symbol Explanation

¬ logical negation statement∈ is an element of∴ therefore∵ because⇒ logical “then” statement⇔ if and only iff, also abbreviated “iff”∃ there exists∀ for all≡ defined as or equivalent to

∀x ∈ Z+ and x¬prime, ∃y ∈ Z+ s.t. x/y ∈ Z+

Yiqing Xu (MIT) Basics August 24, 2014 3 / 24

Basic Notations

summation operator and mean: X = 1n

∑ni=1 Xi

product operator:∏5

i=1 Xi = X1 · X2 · X3 · X4 · X5·Set: ∅, ∪, ∩, \, ⊂ (⊆), Ac(orA), ∈Symbols (1) ∝, ⊥, ∞, +∞, −∞Symbols (2) max{}, min{}, argmaxf (x), argminf (x)

Yiqing Xu (MIT) Basics August 24, 2014 4 / 24

Pairs of numbers

Cartesian coordinate system

(x , y), for example, (1, 5)“x” represents a location on a horizontal axis...“y” represents alocation on a vertical axis

Straightforward to add additional axes...this increases the dimensionsof the graph

(x , y , z) is a point in 3-Dimensions (3-D)

Yiqing Xu (MIT) Basics August 24, 2014 5 / 24

R1 and Rn

R1 is the set of all real numbers extending from −∞ to +∞ — i.e.,the real number line.

Rn is an n-dimensional space (often referred to as Euclidean space),where each of the n axes extends from −∞ to +∞.

Examples:

1 R1 is a line.2 R2 is a plane.3 R3 is a 3-D space.4 R4 could be 3-D plus time.

Points in Rn are ordered n-tuples, where each element of the n-tuplerepresents the coordinate along that dimension.

Yiqing Xu (MIT) Basics August 24, 2014 6 / 24

Interval Notations

Open interval: x ∈ (a, b) if a < x < b

Closed interval: x ∈ [a, b] if a ≤ x ≤ b

Mixed intervals: For example ∞ is usually an open interval:x ∈ [0,∞) if x ≥ 0.

Yiqing Xu (MIT) Basics August 24, 2014 7 / 24

Open and Closed Sets

Definition

A subset U of the Euclidean n-space Rn is called open if, given any point xin U, there exists a real number ε > 0 such that, given any point y in Rn

whose Euclidean distance from x is smaller than ε, y also belongs to U.

Equivalently, a subset U of Rn is open if every point in U has aneighborhood in Rn contained in U.

Definition

There are several equivalent definitions of a closed set. Let S be a subsetof a metric space. A set S is closed if

1 The complement of S is an open set

2 S is its own set closure

3 S contains all the limit points of sequences in S

4 Every point outside S has a neighborhood disjoint from S

Yiqing Xu (MIT) Basics August 24, 2014 8 / 24

1 Notations

2 Functions

Functions

Definition

A function is a rule that takes a subset of real numbers, R, and assigns toeach real number to another real number.

R is the set of all real numbers (e.g., −3,−2.1, 0, 5, 13) from −∞ to ∞.

More generally, a function is a relation between a set of inputs and a set ofpermissible outputs with the property that each input is related to exactlyone output.

f : X → Y

Yiqing Xu (MIT) Basics August 24, 2014 9 / 24

Domain and Range/Image

Some functions are defined only on proper subsets of Rn.

Domain: the set of numbers in X at which f (x) is defined.

Range: elements of Y assigned by f (x) to elements of X , or

f (X ) = {y : y = f (x), x ∈ X}

Most often used when talking about a function f : R1 → R1.

Image: same as range, but more often used when talking about afunction f : Rn → R1. It can be a subset of the range that is theoutput of function on a subset of the domain.

Yiqing Xu (MIT) Basics August 24, 2014 10 / 24

Examples of Common Functions

Linear functions

Non-Linear functions in polynomial form

Rational functions: the quotient of two polynomials

Exponential functions

Trigonometric functions

Yiqing Xu (MIT) Basics August 24, 2014 11 / 24

Inverse Functions

Definition

Two functions f (x), g(x) are called inverse functions if the following holdsfor any x :

f (g(x)) = x

-4 -2 2 4x value

-4

-2

2

4

f HxL

Yiqing Xu (MIT) Basics August 24, 2014 12 / 24

Exponential Functions

Consider the graph of y = ex

-4 -2 2 4x value

10

20

30

40

50

60

f HxL

Figure: Graph of f (x) = ex

Yiqing Xu (MIT) Basics August 24, 2014 13 / 24

Properties of Exponential Functions

strictly positive, never less than or equal to 0

strictly increasing

frequently written as exp(x)

can be expressed as ex =∑∞

n=1xn

n! (why?)

Yiqing Xu (MIT) Basics August 24, 2014 14 / 24

Gaussian Curve

-4 -2 0 2 4x value

0.2

0.4

0.6

0.8

1.0

f HxL

Figure: Graph of f (x) = e−x2

Yiqing Xu (MIT) Basics August 24, 2014 15 / 24

Logarithmic Functions

Definition

y = loga(x) ⇔ ay = x

The logarithmic function gives us the power to which one must raise a toget x . It follows from the definition that:

alogax = x and loga(az) = z

Base e logarithms

Definition

The inverse of ex is called the natural logarithm and is denoted by ln(x).Formally,

y = ln(x) ⇔ ey = x

Yiqing Xu (MIT) Basics August 24, 2014 16 / 24

Rules for Logarithms and Exponentials

1 axay = ax+y

2 a−x = 1/ax

3 ax/ay = ax−y

4 (ax)y = axy

5 a0 = 1

1 log(xy) = log(x) + log(y)

2 log(1/x) = − log(x)

3 log(x/y) = log(x)− log(y)

4 log(xy ) = y log(x)

5 log(1) = 0

6 if x < y , then loga x < loga y

Yiqing Xu (MIT) Basics August 24, 2014 17 / 24

Proving Properties of Logs

1 Proof of log(xy) = log(x) + log(y)

2 Proof of if x < y , then loga x < loga y

Yiqing Xu (MIT) Basics August 24, 2014 18 / 24

The function ln(x)

The graph of ln x is the inverse of ex , and hence is the reflection acrossthe line y = x .

1 2 3 4 5x value

-1.0

-0.5

0.5

1.0

1.5

2.0

f HxL

Figure: Graph of f (x) = ln(x)

Yiqing Xu (MIT) Basics August 24, 2014 19 / 24

The logistic function

A special function that is frequently used, in a variety of ways, is thefunction f (x) = ex

1+ex

-4 -2 0 2 4x value

0.2

0.4

0.6

0.8

1.0

f HxL

Figure: Graph of f (x) = ex

1+ex

Yiqing Xu (MIT) Basics August 24, 2014 20 / 24

Composite Functions

Definition

Consider the following two functions. f : S → T and g : T → U.The composition g ◦ f : S → U is defined by (g ◦ f )(x) = g(f (x)).

Note that (g ◦ f )(x) 6= (g ◦ f )(x)

Yiqing Xu (MIT) Basics August 24, 2014 21 / 24

Continuous Functions

Definition

A continuous function is a function f : X → Y where the pre-image ofevery open set in Y is open in X .

More concretely, a function f(x) is said to be continuous at point x0 if

1 f (x0) is defined, so that x0 is in the domain of f

2 limx→x0f (x) exists for x in the domain of f

3 limx→x0f (x) = f (x0)

Yiqing Xu (MIT) Basics August 24, 2014 22 / 24

Continuous Functions in ε− δ Language

A limit c of function f (x) as x approaches a point x0, limx→x0f (x) = c , isdefined as:

Definition (Limit)

Given any ε > 0, ∃δ > 0 s.t. for ∀x in some domain D and within theneighborhood of x0 of radius delta (except possibly x0 itself),

|f (x)− c | < ε

Definition (Continuous)

If x0 is in D andlimx→x0f (x) = f (x0) = c,

f (x) is said to be continuous at x0.

Yiqing Xu (MIT) Basics August 24, 2014 23 / 24

Continuous Functions

If f is differentiable at point x0, then it is also continuous at x0

If two functions f and g are continuous at x0, then1 f + g is continuous at x0.2 f − g is continuous at x0.3 fg is continuous at x0.4 f /g is continuous at x0 if g(x0) 6= 0.5 Providing that f is continuous at g(x0), f ◦ g is continuous at x0

Yiqing Xu (MIT) Basics August 24, 2014 24 / 24