Shawn Zhong

Shawn Zhong

钟万祥
  • Tutorials
  • Mathematics
    • Math 240
    • Math 375
    • Math 431
    • Math 514
    • Math 521
    • Math 541
    • Math 632
    • Abstract Algebra
    • Linear Algebra
    • Category Theory
  • Computer Sciences
    • CS/ECE 252
    • CS/ECE 352
    • Learn Haskell
  • AP Notes
    • AP Microecon
    • AP Macroecon
    • AP Statistics
    • AP Chemistry
    • AP Physics E&M
    • AP Physics Mech
    • CLEP Psycho

Shawn Zhong

钟万祥
  • Tutorials
  • Mathematics
    • Math 240
    • Math 375
    • Math 431
    • Math 514
    • Math 521
    • Math 541
    • Math 632
    • Abstract Algebra
    • Linear Algebra
    • Category Theory
  • Computer Sciences
    • CS/ECE 252
    • CS/ECE 352
    • Learn Haskell
  • AP Notes
    • AP Microecon
    • AP Macroecon
    • AP Statistics
    • AP Chemistry
    • AP Physics E&M
    • AP Physics Mech
    • CLEP Psycho

Home / 2018 / February / 12

2.3 Functions

  • Feb 12, 2018
  • Shawn
  • Math 240
  • No comments yet
Functions • Definition ○ Let A and B be nonempty sets. ○ A function f from A to B, denoted f:A→B is an assignment of each element of A to exactly one element of B. ○ We write f(a)=b if b is the unique element of B assigned by the function f to the element a of A. ○ Functions are sometimes called mappings or transformations. • Example • Relation ○ A function f:A→B can also be defined as a subset of A×B (a relation). ○ This subset is restricted to be a relation where no two elements of the relation have the same first element. ○ Specifically, a function f from A to B contains one, and only one ordered pair (a,b) for every element a∈A. § ∀x[x∈A→∃y[y∈B∧(x,y)∈f]] § ∀x,y_1,y_2 [[(x,y_1 )∈f∧(x,y_2 )∈f]→y_1=y_2 ] • Terminology ○ Given a function f: A → B: ○ We say f maps A to B or f is a mapping from A to B. § A is called the domain of f. § B is called the codomain of f. ○ If f(a)= b, § then b is called the image of a under f. § a is called the preimage of b. ○ The range of f is the set of all images of points in A under f. § We denote it by f(A). ○ Two functions are equal when § they have the same domain, the same codomain and § map each element of the domain to the same element of the codomain. Representing Functions • Functions may be specified in different ways: • An explicit statement of the assignment. ○ Students and grades example. • A formula. ○ f(x)=x+1 • A computer program. ○ A Java program that when given an integer n, produces n! Example • f(a)=z • The image of d is z • The domain of f is A • The codomain of f is B • The preimage of y is b • f(a)={y,z} • The preimage of z is {a,c,d} • f{a,b,c}={y,z} • f{c,d}={z} Injections • A function f is said to be one-to-one, or injective, • if and only if f(a)=f(b) implies that a=b for all a and b in the domain of f. • A function is said to be an injection if it is one-to-one. Surjections • A function f from A to B is called onto or surjective, • if and only if for every element b∈B there is an element a∈A with f(a)=b. • A function f is called a surjection if it is onto. Bijections • A function f is a one-to-one correspondence, or a bijection, • if it is both one-to-one and onto (surjective and injective). Showing that f is one-to-one or onto • To show that f is injective ○ For x,y,∈A if x≠y then f(x)≠f(y) • To show that f is not injective ○ Find x,y∈A s.t. x≠y and f(x)=f(y) • Example 1 ○ Let f be the function from {a,b,c,d} to {1,2,3} defined by § f(a)=3 § f(b)=2 § f(c)=1 § f(d)=3 ○ Is f an onto function? § Yes, f is onto. § Since all elements of the codomain are images of elements in the domain. ○ If the codomain were changed to {1,2,3,4}, f would not be onto. • Example 2 ○ Is the function f(x) = x^2 from the set of integers to the set of integers onto? ○ No, f is not onto because there is no integer x with x^2 =−1, for example. • Example 3 ○ Let f be the function from the N to the even natural numbers defined by ○ f(n)=2n. Is f an onto function? One to one? ○ f is an onto function, and f is one to one • Example 4 ○ Is the function f(x)=x^3 from R to R onto? One to one? ○ f is an onto function, and f is one to one • Example 5 ○ Is the function f(x)=1/|x| fomr R∖{0} to R onto? One to one? ○ f is not injective, and f is not surjective. Inverse Functions • Let f be a bijection from A to B. • Then the inverse of f, denoted f^(−1) , is the function from B to A defined as • f^(−1) (y)=x iff f(x)=y • No inverse exists unless f is a bijection. Why? • Example Questions • Example 1 ○ Let f be the function from {a,b,c} to {1,2,3} such that § f(a)=2 § f(b)=3 § f(c)=1 ○ Is f invertible and if so what is its inverse? ○ The function f is invertible because it is a one-to-one correspondence. ○ The inverse function f^(−1) reverses the correspondence given by f, so § f^(−1) (1)=c § f^(−1) (2)=b § f^(−1) (3)=a • Example 2 ○ Let f:Z→Z be such that f(x)=x+1. ○ Is f invertible, and if so, what is its inverse? ○ The function f is invertible because it is a one-to-one correspondence. ○ The inverse function f^(−1) reverses the correspondence so f^(−1) (y)=y −1. • Example 3 ○ Let f:R→R be such that f(x)=x^2. ○ Is f invertible, and if so, what is its inverse? ○ The function f is not invertible because it is not one-to-one. Composition • Let f:B→C, g:A→B. • The composition of f with g, denoted f∘g is the function from A to C defined by • f∘g(x)=f(g(x)) • Example Composition Questions • Example 1 ○ If f(x)=x^2 and g(x)=2x+1 ○ Then f(g(x))=(2x+1)^2 ○ And g(f(x))=2x^2+1 • Example 2 ○ Let f and g be functions from the set of integers to the set of integers defined by § f(x)=2x+3 § g(x)=3x+2 ○ What is the composition of f and g, and also the composition of g and f ? § f∘g(x)=f(g(x))=f(3x+2)=2(3x+2)+3=6x+7 § g∘f(x)=g(f(x))=g(2x+3)=3(2x+3)+2=6x+11 Graphs of Functions • Let f be a function from the set A to the set B. • The graph of the function f is the set of ordered pairs {(a,b)┤|a∈A and f(a)=b}. • Example Some Important Functions • The floor function f(x)=⌊x⌋ is the largest integer less than or equal to x. • The ceiling function f(x)=⌈x⌉ is the smallest integer greater than or equal to x • Example ○ ⌈3.5⌉=4, ⌊3.5⌋=3 ○ ⌈−1.5⌉=−1, ⌊−1.5⌋=−2 Factorial Function • f:N→Z+, denoted by f(n) = n! is • the product of the first n positive integers when n is a nonnegative integer. ○ f(n)=1 ∙ 2 ∙∙∙ (n – 1) ∙ n, ○ f(0)=0! = 1 • Examples: ○ f(1)=1!=1 ○ f(2)=2!=1∙2=2 ○ f(6)=6!=1∙2∙3∙4∙5∙6=720 ○ f(20)=2,432,902,008,176,640,000 Partial Function • A partial function f from a set A to a set B is an assignment to each element a in a subset of A, of a unique element b in B. • The sets A and B are called the domain and codomain of f, respectively. • We day that f is undefined for elements in A that are not in the domain of definition of f. • When the domain of definition of f equals A, we say that f is a total function. • Example ○ f:N→Z where f(n)=√n is a partial function from Z to R ○ where the domain of definition is the set of nonnegative integers. ○ Note that f is undefined for negative integers.
Read More >>

Search

  • Home Page
  • Tutorials
  • Mathematics
    • Math 240 – Discrete Math
    • Math 375 – Linear Algebra
    • Math 431 – Intro to Probability
    • Math 514 – Numerical Analysis
    • Math 521 – Analysis I
    • Math 541 – Abstract Algebra
    • Math 632 – Stochastic Processes
    • Abstract Algebra @ 万门大学
    • Linear Algebra @ 万门大学
    • Category Theory
  • Computer Sciences
    • CS/ECE 252 – Intro to Computer Engr.
    • CS/ECE 352 – Digital System Fund.
    • Learn Haskell
  • Course Notes
    • AP Macroeconomics
    • AP Microeconomics
    • AP Chemistry
    • AP Statistics
    • AP Physics C: E&M
    • AP Physics C: Mechanics
    • CLEP Psychology
  • 2048 Game
  • HiMCM 2016
  • 登峰杯 MCM

WeChat Account

Categories

  • Notes (418)
    • AP (115)
      • AP Macroeconomics (20)
      • AP Microeconomics (23)
      • AP Physics C E&M (25)
      • AP Physics C Mechanics (28)
      • AP Statistics (19)
    • Computer Sciences (2)
    • Mathematics (300)
      • Abstract Algebra (29)
      • Category Theory (7)
      • Linear Algebra (29)
      • Math 240 (42)
      • Math 375 (71)
      • Math 514 (18)
      • Math 521 (39)
      • Math 541 (39)
      • Math 632 (26)
  • Projects (2)
  • Tutorials (11)

Archives

  • October 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • July 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017

WeChat Account

Links

RobeZH's thoughts on Algorithms - Ziyi Zhang
Copyright © 2018.      
TOP