Introduction to Probability

Multivariable Calculus

Algorithms: Part II

Algorithms: Part I

Introduction to Software Design and Architecture

Calculus Two: Sequences and Series

LAFF Linear Algebra

Stanford Machine Learning

Calculus One

Computational Thinking

Effective Thinking Through Mathematics

CS50 Introduction to Computer Science


Week 2-3 - Functions & Limits


  • Definition: A function f is a rule that assigns to each element x in a set D exactly one element, called f(x)f(x), in a set E.

    • The set D is called the domain of the function.
    • The number f(x)f(x) is the value of f at x and is read “f of x”.
    • The range of f is the set of all possible values of f(x)f(x) as x varies throughout the domain.
    • A symbol that represents an arbitrary number in the domain of a function f is called an independent variable. A symbol that represents a number in the range of f is called a dependent variable.
  • Four ways to represent a functions

    • verbally (by a description in words)
    • numerically (by a table of values)
    • visually (by a graph)
    • algebraically (by an explicit formula)
  • A catalog of essential functions

    • linear function

      • f(x)=mx+bf(x) = mx+b
    • polynomials

      • P(x)=anxn+an1xn1+an2xn2+...+a2x2+a1x1+a0P(x)=a_{n}x^{n}+a_{n-1}x^{n-1}+a_{n-2}x^{n-2}+...+a_{2}x^{2}+a_{1}x^{1}+a_{0}
      • The domain of any polynomial is R=(,+)\mathbb{R} = (-\infty, + \infty).
      • If the leading coefficient an0a_{n}\ne 0, then the degree of the polynomial is n.
        • n=2: quadratic function
        • n=3: cubic function
    • power function

      • f(x)=xaf(x) = x^a
        • a = n, where n is a positive integer
        • a = 1/n, where n is a positive integer. It’s a root function.
        • a = -1: reciprocal function
    • rational function

      • A rational function f is a ratio of two polynomials:
        • f(x)=P(x)Q(x)f(x)=\frac{P(x)}{Q(x)}, {Q(x)0}\{Q(x)\ne0\}
        • f(x)=2x4x2+1x24f(x)=\frac{2x^{4}-x^{2}+1}{x^{2}-4}, {xx±2}\{x|x \ne \pm 2\}:
    • algebraic function

      • A function f is called an algebraic function if it can be constructed using algebraic operations (such as addition, subtraction, multiplication, division, and taking roots)
    • trigonometric function

      • f(x)=sinxf(x)=\sin{x}
    • exponential function

      • f(x)=bxf(x)=b^x
      • law of exponential function:
        • bx+y=bx+byb^{x+y}=b^x+b^y
        • bxy=bxbyb^{x-y}=\frac{b^x}{b^y}
        • (bx)y=bxy(b^{x})^{y}=b^{xy}
        • abx=axbx{ab}^{x}=a^{x}b^{x}
    • logarithmic function

      • f(x)=logbxf(x)=\log_{b}{x}

Combinations of Functions

  • (f+g)(x)=f(x)+g(x)(f+g)(x)=f(x)+g(x)
  • (fg)(x)=f(x)g(x)(f-g)(x)=f(x)-g(x)
  • (fg)(x)=f(x)g(x)(fg)(x)=f(x)g(x), the domain of fg is ABA \cap B
  • (fg)(x)=f(x)g(x)(\frac{f}{g})(x)=\frac{f(x)}{g(x)}, the domain of f/g is {xAB  g(x)0}\{x \in A \cap B\ |\ g(x) \ne 0\}.
  • (fg)(x)=f(g(x))(f \circ g)(x) = f(g(x))
    • composition (or composite) of f and g, denoted by fgf \circ g (“f circle g”).

Inverse of Functions

  • Definition:
    • If a function maps every input to exactly one output, an inverse of that function maps every “output” to exactly one “input.”
  • denoted byf1f^{-1} , and read “f inverse”.
  • to function N=f(t)N=f(t), the inverse function will be t=f1(N)t=f^{-1}(N).

one-to-one functions

  • A function is one-to-one if for every value in the range(f(x)), there is exactly one value in the domain(x).
    • domain of f1f^{-1} = range of ff
    • range of f1f^{-1} = domain of ff
    • for example: f(x)=x3f(x)=x^3 is a one-to-one function, f(x)=x2f(x)=x^2 is not.


  • Definition:
    • limxaf(x)=L\displaystyle\lim_{x \to a}{f(x)}=L
    • the limit of f(x), as x approaches a, equals L
    • if we can make the values of f(x) arbitrarily close to L (as close to L as we like) by restricting x to be sufficiently close to a (on either side of a) but NOT equal to a.(This means that in finding the limit of f(x) as x approaches a, we never consider x = a.)

Limit Laws

  • Suppose that c is a constant and the limits limxaf(x)\displaystyle\lim_{x \to a}{f(x)} and limxag(x)\displaystyle\lim_{x \to a}{g(x)} exist, Then:

    1. limxa[f(x)+g(x)]=limxaf(x)+limxag(x)\displaystyle\lim_{x \to a}{[f(x)+g(x)]}=\lim_{x \to a}{f(x)}+\lim_{x \to a}{g(x)}
    2. limxa[f(x)g(x)]=limxaf(x)limxag(x)\displaystyle\lim_{x \to a}{[f(x)-g(x)]}=\lim_{x \to a}{f(x)}-\lim_{x \to a}{g(x)}
    3. limxacf(x)=climxaf(x)\displaystyle\lim_{x \to a}{cf(x)}=c\lim_{x \to a}{f(x)}
    4. limxa[f(x)g(x)]=limxaf(x)limxag(x)\displaystyle\lim_{x \to a}{[f(x)g(x)]}=\lim_{x \to a}{f(x)}\cdot \lim_{x \to a}{g(x)}
    5. limxaf(x)g(x)=limxaf(x)limxag(x)\displaystyle\lim_{x \to a}{\frac{f(x)}{g(x)}}=\frac{\displaystyle\lim_{x \to a}{f(x)}}{\displaystyle\lim_{x \to a}{g(x)}}, if limxag(x)0\displaystyle\lim_{x \to a}{g(x)} \ne 0
  • These five laws can be stated verbally as follows:

    1. Sum Law : The limit of a sum is the sum of the limits.
    2. Difference Law : The limit of a difference is the difference of the limits.
    3. Constant Multiple Law : The limit of a constant times a function is the constant times the limit of the function.
    4. Product Law : The limit of a product is the product of the limits.
    5. Quotient Law : The limit of a quotient is the quotient of the limits (provided that the limit of the denominator is not 0).

Squeeze Theorem

  • if g(x)f(x)h(x)g(x) \le f(x) \le h(x) and limxag(x)=limxah(x)=L\displaystyle\lim_{x\to{a}}g(x) = \lim_{x\to{a}}h(x) = L, then limxaf(x)=L\displaystyle\lim_{x\to{a}}f(x)=L
  • Sample: to prove limx0sin(x)x=1\displaystyle\lim_{x\to{0}}\frac{\sin(x)}{x}=1
    • we know:
      • limx0cos(x)=1=limx01\displaystyle\lim_{x\to{0}}\cos(x)=1=\lim_{x\to{0}}1
      • cos(x)sin(x)x1\cos(x) \le \frac{\sin(x)}{x} \le 1
    • then:
      • limx0cos(x)limx0sin(x)x1\displaystyle\lim_{x\to{0}}\cos(x) \le \lim_{x\to{0}}\frac{\sin(x)}{x} \le 1
    • so:
      • limx0sin(x)x=1\displaystyle\lim_{x\to{0}}\frac{\sin(x)}{x}=1


  • Definition 1:
    • A function f is continuous at a number a, if limxaf(x)=f(a)\displaystyle\lim_{x \to a}f(x)=f(a)
      • Notice that this Definition implicitly requires three things if f is continuous at a:
        1. f(a) is defined (that is, a is in the domain of f)
        2. limxaf(x)\displaystyle\lim_{x \to a}f(x) exists
        3. limxaf(x)=f(a)\displaystyle\lim_{x \to a}f(x) = f(a)
  • Definition 2:
    • A function f is continuous from the right at a number a if limxa+f(x)=f(a)\displaystyle\lim_{x \to a^{+}}f(x) = f(a), and f is continuous from the left at a if limxaf(x)=f(a)\displaystyle\lim_{x \to a^{-}}f(x) = f(a)
  • Definition 3:
    • A function f is continuous on the interval (a, b), if for all points c so that a < c < b, f(x) is continuous at c.
      • close intervals:
        • To say "f(x) is continuous on the interval [a, b]", means:
          • f(x) is continuous on the interval (a, b)
          • limxa+f(x)=f(a)\displaystyle\lim_{x \to a^{+}}f(x) = f(a)
          • limxbf(x)=f(b)\displaystyle\lim_{x \to b^{-}}f(x) = f(b)

The Intermediate Value Theorem

  • Suppose that f is continuous on the closed interval [a, b] and let N be any number between f(a) and f(b), where f(a)f(b)f(a) \ne f(b). Then there exists a number c in [a, b] such that f(c)=Nf(c) = N.
  • For example: how to approximate root two?
    • use function f(x)=x22f(x)=x^2-2
    • when x=2x=\sqrt{2}, this function equals 0,
    • so i just need to look for a positive value, that I can plug into this function to make it equals zero.
    • We know that f(1)=-1<0 and f(2)=2>0. So base on The Intermediate Value Theorem, there must be a value in domain (1, 2) that exist c such that f(c) = 0.
    • to continue calculating f(1.5)=0.25>0, we got c(1,1.5)c \in (1, 1.5), then c(1.4,1.5)c \in (1.4, 1.5) … then we are getting closer and closer to 2\sqrt{2}.

Fixed Point

  • Definition
    • A fixed point of a function f is a number c in its domain such that f(c) = c. (The function doesn’t move c; it stays fixed.)
      • if f(x) continuous on [0,1], and 0f(x)10 \le f(x) \le 1, then there is an x in domain [0, 1], exist f(x) = x.
        • To Prove:
        • Assumption: g(x) = f(x) - x, so g(x) is continuous
        • g(0) = f(0) - 0 >= 0
        • g(1) = f(1) - 1 <= 1
        • Base on the IVT(Intermediate Value Theorem), there must be an x such that g(x) = 0, which is f(x) = x.


  • Definition

    • limxaf(x)=\displaystyle\lim_{x \to a}f(x) = \infty means that f(x) is as large as you like provides x is close enough to a.
      • limxπ/2tan(x)=\displaystyle\lim_{x \to \pi/2}\tan(x) = \infty
    • limxf(x)=L\displaystyle\lim_{x \to \infty}f(x) = L means that f(x) is close enough to L provided x is large enough.
      • limxtan1(x)=π2\displaystyle\lim_{x \to \infty}\tan^{-1}(x) = \frac{\pi}{2}
    • if limxf(x)=L\displaystyle\lim_{x \to \infty}f(x) = L or limxf(x)=L\displaystyle\lim_{x \to -\infty}f(x) = L, then the line y = L is called a horizontal asymptote of the curve y = f(x) :
  • Potential Infinity vs Actual Infinity (from Wikipedia)

    • Actual Infinity is the idea that numbers, or some other type of mathematical object, can form an actual, completed totality;
      • Such as the set of all natural numbers, an infinite sequence of rational numbers.
    • Potential Infinity is a non-terminating process (such as “add 1 to the previous number”) produces an unending “infinite” sequence of results, but each individual result is finite and is achieved in a finite number of steps.
  • Precise Definitions

    • limxaf(x)=L\displaystyle\lim_{x \to a}f(x) = L means:
      • for all ϵ>0\epsilon > 0, there is δ>0\delta>0,
      • so that if 0<xa<δ0 < |x - a| < \delta (xax \ne a and x in within δ\delta of a), then f(x)L<ϵ|f(x)-L| < \epsilon (f(x) is within ϵ\epsilon of L).
        • |x - a| is the distance from x to a and |f(x) - L| is the distance from f(x) to L.
        • so limxaf(x)=L\displaystyle\lim_{x \to a}f(x) = L means that the distance between f(x) and L can be made arbitrarily small by requiring that the distance from x to a be sufficiently small (but not 0).
    • For Example: limx2x2=4\displaystyle\lim_{x \to 2}x^2 = 4
      • Let’s say ϵ=0.1\epsilon = 0.1, that means f(x)4<0.1|f(x)-4| < 0.1, 3.9 < f(x) < 4.1,
      • Base on the definition, there should be a δ\delta, that 2δ<x<2+δ2 - \delta < x < 2 + \delta to satisfy the demand.
      • Try δ=0.01\delta = 0.01. We got 1.99 < x < 2.01, 3.9601 < x^2 < 4.0401, 3.9 < f(x) < 4.1 which suit the demand.
    • Another Example: limx102x=20\displaystyle\lim_{x \to 10}2x = 20
      • Let ϵ>0,δ=ϵ/2\epsilon > 0, \delta = \epsilon / 2
      • if 0<x10<δ0<|x-10|<\delta, then,
      • 0<2x10<2δ=ϵ0<2|x-10|<2\delta=\epsilon, and so,
      • 0<2x20<ϵ0<|2x-20|<\epsilon