Functions, High-School Edition

Size: px
Start display at page:

Download "Functions, High-School Edition"

Transcription

1 Functions

2 What is a function?

3 Functions, High-School Edition

4 f(x) = x4 5x2 + 4 source:

5 source:

6 Functions, High-School Edition In high school, functions are usually given as objects of the form x3 +3 x2 +15 x+7 f (x) = 1 x137 What does a function do? Takes in as input a real number. Outputs a real number. except when there are vertical asymptotes or other discontinuities, in which case the function doesn't output anything.

7 Functions, CS Edition

8 int int flipuntil(int flipuntil(int n) n) {{ int int numheads numheads == 0; 0; int int numtries numtries == 0; 0; while while (numheads (numheads << n) n) {{ if if (randomboolean()) (randomboolean()) numheads++; numheads++; }} }} numtries++; numtries++; return return numtries; numtries;

9 Functions, CS Edition In programming, functions might take in inputs, might return values, might have side effects, might never return anything, might crash, and might return different values when called multiple times.

10 What's Common? Although high-school math functions and CS functions are pretty different, they have two key aspects in common: They take in inputs. They produce outputs. In math, we like to keep things easy, so that's pretty much how we're going to define a function.

11 Rough Idea of a Function: A function is an object f that takes in an input and produces exactly one output. x f f(x) (This is not a complete definition we'll revisit this in a bit.)

12 High School versus CS Functions In high school, functions usually were given by a rule: f(x) = 4x + 15 In CS, functions are usually given by code: int factorial(int n) { int result = 1; for (int i = 1; i <= n; i++) { result *= i; } return result; } What sorts of functions are we going to allow from a mathematical perspective?

13 Dikdik Nubian Ibex Sloth

14

15 but also

16 f(x) = x2 + 3x 15

17 n/2 if n is even f (n)= (n+1)/2 otherwise { Functions Functionslike likethese these are arecalled calledpiecewise piecewise functions. functions.

18 To define a function, you will typically either draw a picture, or give a rule for determining the output.

19 In mathematics, functions are deterministic. That is, given the same input, a function must always produce the same output. The following is a perfectly valid piece of C++ code, but it s not a valid function under our definition: int randomnumber(int numoutcomes) { return rand() % numoutcomes; }

20 One Challenge

21 f(x) = x2 + 2x + 5 f( 3 ) = = 20 f( 0 ) = = 5 f( 3 ) =?

22 f(x) = x2 + 2x + 5 f( 3 ) = = 20 f( 0 ) = = 5 f( 3 ) =?

23 f(x) = x2 + 2x + 5 f( 3 ) = = 20 f( 0 ) = = 5 f( 3 ) =?

24 f(x) = x2 + 2x + 5 f( 3 ) = = 20 f( 0 ) = = 5 f( 3 ) =?

25 f( )= f(137 ) =?

26 We need to make sure we can't apply functions to meaningless inputs.

27 Domains and Codomains Every function f has two sets associated with it: its domain and its codomain. A function f can only be applied to elements of its domain. For any x in the domain, f(x) belongs to the codomain. The Thefunction function must be must bedefined defined for every element for every element ofofthe thedomain. domain. Domain Codomain The Theoutput outputofofthe the function must function must always alwaysbe beininthe the codomain, but codomain, but not notall allelements elements ofofthe codomain the codomain must mustbe be produced producedas as outputs. outputs.

28 Domains and Codomains Every function f has two sets associated with it: its domain and its codomain. A function f can only be applied to elements of its domain. For any x in the domain, f(x) belongs to the codomain. The Thecodomain codomainofofthis thisfunction functionisis ℝ. ℝ.Everything Everythingproduced producedisisaareal real number, but not all real numbers number, but not all real numbers can canbe beproduced. produced. The Thedomain domainofofthis thisfunction function isisℝ. Any real number ℝ. Any real numbercan canbe be provided as input. provided as input. private double absolutevalueof(double x) { if (x >= 0) { return x; } else { return -x; } }

29 Domains and Codomains If f is a function whose domain is A and whose codomain is B, we write f : A B. This notation just says what the domain and codomain of the function are. It doesn't say how the function is evaluated. Think of it like a function prototype in C or C++. The notation f : ArgType RetType is like writing RetType f(argtype argument); We know that f takes in an ArgType and returns a RetType, but we don't know exactly which RetType it's going to return for a given ArgType.

30 The Official Rules for Functions Formally speaking, we say that f : A B if the following two rules hold: The function must be obey its domain/codomain rules: a A. b B. f(a) = b ( Every input in A maps to some output in B. ) The function must be deterministic: a₁ A. a₂ A. (a₁ = a₂ f(a₁) = f(a₂)) ( Equal inputs produce equal outputs. ) If you re ever curious about whether something is a function, look back at these rules and check! For example: Can a function have an empty domain? Can a function with a nonempty domain have an empty codomain?

31 Defining Functions Typically, we specify a function by describing a rule that maps every element of the domain to some element of the codomain. Examples: f(n) = n + 1, where f : ℤ ℤ f(x) = sin x, where f : ℝ ℝ f(x) = x, where f : ℝ ℤ Notice that we're giving both a rule and the domain/codomain.

32 Defining Functions Typically, we specify a function by describing a rule that maps every element This function of the domain to some element of the This isis the the ceiling ceiling function the the smallest smallest integer integer greater greater codomain. Examples: than than or or equal equal to to x. x. For For example, example, 1 1 == 1,1, == 2, 2, f(n) = n + 1, where f : ℤ ℤ and and π π == f(x) = sin x, where f : ℝ ℝ f(x) = x, where f : ℝ ℤ Notice that we're giving both a rule and the domain/codomain.

33 Is This a Function from A to B? Stanford Cardinal Berkeley Blue Michigan Gold Arkansas White A B

34 Is This a Function from A to B? California Dover New York Sacramento Delaware Albany Washington DC A B

35 Is This a Function from A to B? Wish Funshine A B Love-a-Lot Tenderheart Friend

36 Combining Functions

37 f : People Places Keith g : Places Prices Mountain View Far Too Much Anna San Francisco King's Ransom Shloka Redding, CA A Modest Amount Dilsher Barrow, AK Pocket Change Shalom People Palo Alto Places h : People Prices h(x) = g(f(x)) Prices

38 Keith Far Too Much Anna King's Ransom Shloka A Modest Amount Dilsher Pocket Change Shalom People Prices h : People Prices h(x) = g(f(x))

39 Function Composition Suppose that we have two functions f : A B and g : B C. Notice that the codomain of f is the domain of g. This means that we can use outputs from f as inputs to g. x f f(x) g g(f(x))

40 Function Composition Suppose that we have two functions f : A B and g : B C. The composition of f and g, denoted g f, is a function where g f : A C, and (g f)(x) = g(f(x)). A few things to notice: The Thename nameofofthe thefunction functionisisgg f.f. When Whenwe weapply applyititto toan aninput inputx,x, we wewrite write(g (g f)(x). f)(x).i Idon't don'tknow know why, but that's what we do. why, but that's what we do. The domain of g f is the domain of f. Its codomain is the codomain of g. Even though the composition is written g f, when evaluating (g f)(x), the function f is evaluated first.

41 Function Composition Let f : ℕ ℕ be defined as f(n) = 2n + 1 and g : ℕ ℕ be defined as g(n) = n2. What is g f? (g f)(n) = g(f(n)) (g f)(n) = g(2n + 1) (g f)(n) = (2n + 1)2 = 4n2 + 4n + 1 What is f g? (f g)(n) = f(g(n)) (f g)(n) = f(n2) (f g)(n) = 2n2 + 1 In general, if they exist, the functions g f and f g are usually not the same function. Order matters in function composition!

42 Time-Out for Announcements!

43 Problem Set Three Problem Set Two was due at 3:00PM today. Problem Set Three goes out right now. Reminder: You have three 24-hour late days to use throughout the quarter. Checkpoint due on Monday at the start of class. Remaining problems due Friday at the start of class. As always, feel free to ask questions on Piazza or to stop by office hours with questions!

44 First Midterm Exam The first midterm exam is on Tuesday, May 2nd from 7:00PM 10:00PM, location TBA. We ll be releasing a ton of practice problems next week, and we ll talk about policies on Monday. We will be holding a practice midterm exam next Tuesday, April 25th from 7:00PM 10:00PM, location TBA. You are highly encouraged to attend. This is an excellent way to practice and prepare for the midterm. More details next week.

45 WiCS Casual CS Dinner Stanford WiCS (Women in Computer Science) is holding a Casual CS Dinner this upcoming Monday, April 24th at 6:00PM at the Women's Community Center. All are welcome. Highly recommended! RSVP using

46 Your Questions

47 I feel like I'll never catch up to my peers who are so ahead in CS. What advice do you have for changing that, especially for someone from FLI background. AA few few things things to to keep keep inin mind: mind: 1.1. The The overwhelming overwhelming majority majority of of CS CS majors majors have have no no prior prior CS CS experience experience before before coming coming here here most most schools schools don t don t offer offer anything. anything Make Make sure sure you you have have the the right right mental mental model model for for where where you you stand stand relative relative to to everyone everyone else else there s there s aa huge huge sampling sampling bias! bias! The The gap gap between between you you and and everyone everyone else else isis largest largest when when you you get get started started and and rapidly rapidly gets gets washed washed out out by by coursework coursework here. here. You d You d be be amazed amazed how how quickly quickly we we move move here! here! A A little little slope slope makes makes up up for for aa lot lot of of y-intercept y-intercept Never Never confuse confuse talent talent for for experience. experience.

48 Is there any hope for a just world under capitalism? II think think so, so, though though that that might might just just be be because because II have have aa different different conception conception of of the the question question than than what what was was intended. intended. I ll I ll take take this this one one inin class. class.

49 Back to CS103!

50 Special Types of Functions

51 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto

52 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto

53 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

54 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

55 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

56 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

57 Injective Functions A function f : A B is called injective (or one-to-one) if the following statement is true about f: a₁ A. a₂ A. (a₁ a₂ f(a₁) f(a₂)) ( If the inputs are different, the outputs are different. ) The following first-order definition is equivalent and is often useful in proofs. a₁ A. a₂ A. (f(a₁) = f(a₂) a₁ = a₂) ( If the outputs are the same, the inputs are the same. ) A function with this property is called an injection. How does this compare to our second rule for functions?

58 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. Since f(n₀) = f(n₁), we see that 2n₀ + 7 = 2n₁ + 7. This in turn means that 2n₀ = 2n₁, so n₀ = n₁, as required.

59 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. Since f(n₀) = f(n₁), we see that 2n₀ + 7 = 2n₁ + 7. This in turn means that 2n₀ = 2n₁, so n₀ = n₁, as required.

60 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. What does itit mean for the function ff to be What does mean for the function to be Since f(n₀) = f(n₁), we see that injective? injective? 2n₀ + 7 = 2n₁ + 7. This in turn means that n₀ ℕ. n₁ ℕ. n₀ ℕ. n₁ ℕ.((f(n₀) f(n₀)==f(n₁) f(n₁) n₀ n₀==n₁ n₁)) 2n₀ = 2n₁, n₀ n₀ ℕ. ℕ. n₁ n₁ ℕ. ℕ.((n₀ n₀ n₁ n₁ f(n₀) f(n₀) f(n₁) f(n₁))) so n₀ = n₁, as required. Therefore, Therefore, we'll we'll pick pick arbitrary arbitrary n₀, n₀,n₁ n₁ ℕ ℕ where where f(n₀) f(n₀)==f(n₁), f(n₁), then then prove prove that that n₀ n₀==n₁. n₁.

61 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. What does itit mean for the function ff to be What does mean for the function to be Since f(n₀) = f(n₁), we see that injective? injective? 2n₀ + 7 = 2n₁ + 7. This in turn means that n₁ ℕ. n₂ ℕ. n₁ ℕ. n₂ ℕ.((f(n₁) f(n₁)==f(n₂) f(n₂) n₁ n₁==n₂ n₂)) 2n₀ = 2n₁, n₁ n₁ ℕ. ℕ. n₂ n₂ ℕ. ℕ.((n₁ n₁ n₂ n₂ f(n₁) f(n₁) f(n₂) f(n₂))) so n₀ = n₁, as required. Therefore, Therefore, we'll we'll pick pick arbitrary arbitrary n₀, n₀,n₁ n₁ ℕ ℕ where where f(n₀) f(n₀)==f(n₁), f(n₁), then then prove prove that that n₀ n₀==n₁. n₁.

62 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. What does itit mean for the function ff to be What does mean for the function to be Since f(n₀) = f(n₁), we see that injective? injective? 2n₀ + 7 = 2n₁ + 7. This in turn means that n₁ ℕ. n₂ ℕ. n₁ ℕ. n₂ ℕ.((f(n₁) f(n₁)==f(n₂) f(n₂) n₁ n₁==n₂ n₂)) 2n₀ = 2n₁, n₁ n₁ ℕ. ℕ. n₂ n₂ ℕ. ℕ.((n₁ n₁ n₂ n₂ f(n₁) f(n₁) f(n₂) f(n₂))) so n₀ = n₁, as required. Therefore, Therefore, we'll we'll pick pick arbitrary arbitrary n₀, n₀,n₁ n₁ ℕ ℕ where where f(n₀) f(n₀)==f(n₁), f(n₁), then then prove prove that that n₀ n₀==n₁. n₁.

63 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. What does itit mean for the function ff to be What does mean for the function to be Since f(n₀) = f(n₁), we see that injective? injective? 2n₀ + 7 = 2n₁ + 7. This in turn means that n₁ ℕ. n₂ ℕ. n₁ ℕ. n₂ ℕ.((f(n₁) f(n₁)==f(n₂) f(n₂) n₁ n₁==n₂ n₂)) 2n₀ = 2n₁, n₁ n₁ ℕ. ℕ. n₂ n₂ ℕ. ℕ.((n₁ n₁ n₂ n₂ f(n₁) f(n₁) f(n₂) f(n₂))) so n₀ = n₁, as required. Therefore, Therefore, we'll we'll pick pick arbitrary arbitrary n₁, n₁,n₂ n₂ ℕ ℕ where where f(n₁) f(n₁)==f(n₂), f(n₂), then then prove prove that that n₁ n₁==n₂. n₂.

64 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. What does itit mean for the function ff to be What does mean for the function to be Since f(n₀) = f(n₁), we see that injective? injective? 2n₀ + 7 = 2n₁ + 7. This in turn means that n₁ ℕ. n₂ ℕ. n₁ ℕ. n₂ ℕ.((f(n₁) f(n₁)==f(n₂) f(n₂) n₁ n₁==n₂ n₂)) 2n₀ = 2n₁, n₁ n₁ ℕ. ℕ. n₂ n₂ ℕ. ℕ.((n₁ n₁ n₂ n₂ f(n₁) f(n₁) f(n₂) f(n₂))) so n₀ = n₁, as required. Therefore, Therefore, we'll we'll pick pick arbitrary arbitrary n₁, n₁,n₂ n₂ ℕ ℕ where where f(n₁) f(n₁)==f(n₂), f(n₂), then then prove prove that that n₁ n₁==n₂. n₂.

65 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. What does itit mean for the function ff to be What does mean for the function to be Since f(n₀) = f(n₁), we see that injective? injective? 2n₀ + 7 = 2n₁ + 7. This in turn means that n₁ ℕ. n₂ ℕ. n₁ ℕ. n₂ ℕ.((f(n₁) f(n₁)==f(n₂) f(n₂) n₁ n₁==n₂ n₂)) 2n₀ = 2n₁, n₁ n₁ ℕ. ℕ. n₂ n₂ ℕ. ℕ.((n₁ n₁ n₂ n₂ f(n₁) f(n₁) f(n₂) f(n₂))) so n₀ = n₁, as required. Therefore, Therefore, we'll we'll pick pick arbitrary arbitrary n₁, n₁,n₂ n₂ ℕ ℕ where where f(n₁) f(n₁)==f(n₂), f(n₂), then then prove prove that that n₁ n₁==n₂. n₂.

66 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₀, n₁ ℕ where f(n₀) = f(n₁). We will prove that n₀ = n₁. What does itit mean for the function ff to be What does mean for the function to be Since f(n₀) = f(n₁), we see that injective? injective? 2n₀ + 7 = 2n₁ + 7. This in turn means that n₁ ℕ. n₂ ℕ. n₁ ℕ. n₂ ℕ.((f(n₁) f(n₁)==f(n₂) f(n₂) n₁ n₁==n₂ n₂)) 2n₀ = 2n₁, n₁ n₁ ℕ. ℕ. n₂ n₂ ℕ. ℕ.((n₁ n₁ n₂ n₂ f(n₁) f(n₁) f(n₂) f(n₂))) so n₀ = n₁, as required. Therefore, Therefore, we'll we'll pick pick arbitrary arbitrary n₁, n₁,n₂ n₂ ℕ ℕ where where f(n₁) f(n₁)==f(n₂), f(n₂), then then prove prove that that n₁ n₁==n₂. n₂.

67 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₁, n₂ ℕ where f(n₁) = f(n₂). We will prove that n₁ = n₂. Since f(n₀) = f(n₁), we see that 2n₀ + 7 = 2n₁ + 7. This in turn means that 2n₀ = 2n₁, so n₀ = n₁, as required.

68 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₁, n₂ ℕ where f(n₁) = f(n₂). We will prove that n₁ = n₂. Since f(n₁) = f(n₂), we see that 2n₁ + 7 = 2n₂ + 7. This in turn means that 2n₀ = 2n₁, so n₀ = n₁, as required.

69 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₁, n₂ ℕ where f(n₁) = f(n₂). We will prove that n₁ = n₂. Since f(n₁) = f(n₂), we see that 2n₁ + 7 = 2n₂ + 7. This in turn means that 2n₁ = 2n₂ so n₀ = n₁, as required.

70 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₁, n₂ ℕ where f(n₁) = f(n₂). We will prove that n₁ = n₂. Since f(n₁) = f(n₂), we see that 2n₁ + 7 = 2n₂ + 7. This in turn means that 2n₁ = 2n₂ so n₁ = n₂, as required.

71 Injective Functions Theorem: Let f : ℕ ℕ be defined as f(n) = 2n + 7. Then f is injective. Proof: Consider any n₁, n₂ ℕ where f(n₁) = f(n₂). We will prove that n₁ = n₂. Since f(n₁) = f(n₂), we see that 2n₁ + 7 = 2n₂ + 7. This in turn means that 2n₁ = 2n₂ so n₁ = n₂, as required.

72 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). Let x₀ = -1 and x₁ = +1. Then f(x₀) = f(-1) = (-1)4 = 1 and f(x₁) = f(1) = 14 = 1, so f(x₀) = f(x₁) even though x₀ x₁, as required.

73 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). Let x₀ = -1 and x₁ = +1. Then f(x₀) = f(-1) = (-1)4 = 1 and f(x₁) = f(1) = 14 = 1, so f(x₀) = f(x₁) even though x₀ x₁, as required.

74 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₀ ℤ. x₁ ℤ. (x₀ x₀ ℤ. x₁ ℤ. (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) x₀ ℤ. x₀ ℤ. ℤ. x₁ x₁ ℤ.(x₀ (x₀ x₁ f(x₀) f(x₁)) f(x₁) = f(1) =x₁ 14 =f(x₀) 1, f(x₁)) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ. (x₀ (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₀ ℤ. ℤ. (x₀ f(x₁))) x₀ ℤ. x₁ x₁ ℤ. (x₀ x₁ x₁ (f(x₀) (f(x₀) f(x₁))) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀)==f(x₁)) f(x₁)) Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but f(x₀) = f(x₁). Can we do that? f(x₀) = f(x₁). Can we do that?

75 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₁ ℤ. x₂ ℤ. (x₁ x₁ ℤ. x₂ ℤ. (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) x₀ ℤ. x₀ ℤ. ℤ. x₁ x₁ ℤ.(x₀ (x₀ x₁ f(x₀) f(x₁)) f(x₁) = f(1) =x₁ 14 =f(x₀) 1, f(x₁)) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ. (x₀ (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₀ ℤ. ℤ. (x₀ f(x₁))) x₀ ℤ. x₁ x₁ ℤ. (x₀ x₁ x₁ (f(x₀) (f(x₀) f(x₁))) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀)==f(x₁)) f(x₁)) Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but f(x₀) = f(x₁). Can we do that? f(x₀) = f(x₁). Can we do that?

76 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₁ ℤ. x₂ ℤ. (x₁ x₁ ℤ. x₂ ℤ. (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) x₀ ℤ. x₀ ℤ. ℤ. x₁ x₁ ℤ.(x₀ (x₀ x₁ f(x₀) f(x₁)) f(x₁) = f(1) =x₁ 14 =f(x₀) 1, f(x₁)) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ. (x₀ (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₀ ℤ. ℤ. (x₀ f(x₁))) x₀ ℤ. x₁ x₁ ℤ. (x₀ x₁ x₁ (f(x₀) (f(x₀) f(x₁))) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀)==f(x₁)) f(x₁)) Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but f(x₀) = f(x₁). Can we do that? f(x₀) = f(x₁). Can we do that?

77 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₁ ℤ. x₂ ℤ. (x₁ x₁ ℤ. x₂ ℤ. (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ.(x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) x₀ ℤ. = x₁ 4 f(x₀) x₀ ℤ. ℤ. x₁ x₁ ℤ. (x₀ x₁1 f(x₁)) f(x₁) =(x₀ f(1) =f(x₀) 1, f(x₁)) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ. (x₀ (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₀ ℤ. f(x₁))) x₀ ℤ. ℤ. x₁ x₁ ℤ.(x₀ (x₀ x₁ x₁ (f(x₀) (f(x₀) f(x₁))) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀)==f(x₁)) f(x₁)) Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but f(x₀) = f(x₁). Can we do that? f(x₀) = f(x₁). Can we do that?

78 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₁ ℤ. x₂ ℤ. (x₁ x₁ ℤ. x₂ ℤ. (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ.(x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) x₁ ℤ. = x₂ 4 f(x₁) x₁ ℤ. ℤ. x₂ x₂ ℤ. (x₁ x₂1 f(x₂)) f(x₁) =(x₁ f(1) =f(x₁) 1, f(x₂)) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ. (x₀ (x₀ x₁ x₁ f(x₀) f(x₀) f(x₁)) f(x₁)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₀ ℤ. f(x₁))) x₀ ℤ. ℤ. x₁ x₁ ℤ.(x₀ (x₀ x₁ x₁ (f(x₀) (f(x₀) f(x₁))) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀)==f(x₁)) f(x₁)) Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but f(x₀) = f(x₁). Can we do that? f(x₀) = f(x₁). Can we do that?

79 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₁ ℤ. x₂ ℤ. (x₁ x₁ ℤ. x₂ ℤ. (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ.(x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) x₁ ℤ. = x₂ 4 f(x₁) x₁ ℤ. ℤ. x₂ x₂ ℤ. (x₁ x₂1 f(x₂)) f(x₁) =(x₁ f(1) =f(x₁) 1, f(x₂)) x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ. (x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₀ ℤ. f(x₁))) x₀ ℤ. ℤ. x₁ x₁ ℤ.(x₀ (x₀ x₁ x₁ (f(x₀) (f(x₀) f(x₁))) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀)==f(x₁)) f(x₁)) Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but f(x₀) = f(x₁). Can we do that? f(x₀) = f(x₁). Can we do that?

80 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₁ ℤ. x₂ ℤ. (x₁ x₁ ℤ. x₂ ℤ. (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ.(x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) x₁ ℤ. = x₂ 4 f(x₁) x₁ ℤ. ℤ. x₂ x₂ ℤ. (x₁ x₂1 f(x₂)) f(x₁) =(x₁ f(1) =f(x₁) 1, f(x₂)) x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ. (x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₁ ℤ. f(x₂))) x₁ ℤ. ℤ. x₂ x₂ ℤ.(x₁ (x₁ x₂ x₂ (f(x₁) (f(x₁) f(x₂))) x₀ x₀ ℤ. ℤ. x₁ x₁ ℤ. ℤ.(x₀ (x₀ x₁ x₁ f(x₀) f(x₀)==f(x₁)) f(x₁)) Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but f(x₀) = f(x₁). Can we do that? f(x₀) = f(x₁). Can we do that?

81 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₁ ℤ. x₂ ℤ. (x₁ x₁ ℤ. x₂ ℤ. (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ.(x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) x₁ ℤ. = x₂ 4 f(x₁) x₁ ℤ. ℤ. x₂ x₂ ℤ. (x₁ x₂1 f(x₂)) f(x₁) =(x₁ f(1) =f(x₁) 1, f(x₂)) x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ. (x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₁ ℤ. f(x₂))) x₁ ℤ. ℤ. x₂ x₂ ℤ.(x₁ (x₁ x₂ x₂ (f(x₁) (f(x₁) f(x₂))) x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ.(x₁ (x₁ x₂ x₂ f(x₁) f(x₁)==f(x₂)) f(x₂)) Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but Therefore, we need to find x₀, x₁ ℤ such that x₀ x₁, but f(x₀) = f(x₁). Can we do that? f(x₀) = f(x₁). Can we do that?

82 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₀ and x₁ such that x₀ x₁, but f(x₀) = f(x₁). What does it mean for f to be injective? What does it mean for f to be injective? Let x₀ = -1 and x₁ = +1. Then x₁ ℤ. x₂ ℤ. (x₁ x₁ ℤ. x₂ ℤ. (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) 4 f(x₀) f(-1) = (-1) =1 What is the negation of this = statement? What is the negation of this statement? and x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ.(x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) x₁ ℤ. = x₂ 4 f(x₁) x₁ ℤ. ℤ. x₂ x₂ ℤ. (x₁ x₂1 f(x₂)) f(x₁) =(x₁ f(1) =f(x₁) 1, f(x₂)) x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ. (x₁ (x₁ x₂ x₂ f(x₁) f(x₁) f(x₂)) f(x₂)) so f(x₀) = f(x₁) even though x₀ x₁, as required. x₁ ℤ. f(x₂))) x₁ ℤ. ℤ. x₂ x₂ ℤ.(x₁ (x₁ x₂ x₂ (f(x₁) (f(x₁) f(x₂))) x₁ x₁ ℤ. ℤ. x₂ x₂ ℤ. ℤ.(x₁ (x₁ x₂ x₂ f(x₁) f(x₁)==f(x₂)) f(x₂)) Therefore, we need to find x₁, x₂ ℤ such that x₁ x₂, but f(x₁) = f(x₂). Therefore, we need to find x₁, x₂ ℤ such that x₁ x₂, but f(x₁) = f(x₂). Can we do that? Can we do that?

83 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₁ and x₂ such that x₁ x₂, but f(x₁) = f(x₂). Let x₀ = -1 and x₁ = +1. Then f(x₀) = f(-1) = (-1)4 = 1 and f(x₁) = f(1) = 14 = 1, so f(x₀) = f(x₁) even though x₀ x₁, as required.

84 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₁ and x₂ such that x₁ x₂, but f(x₁) = f(x₂). Let x₁ = -1 and x₂ = +1. Then f(x₀) = f(-1) = (-1)4 = 1 and f(x₁) = f(1) = 14 = 1, so f(x₀) = f(x₁) even though x₀ x₁, as required.

85 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₁ and x₂ such that x₁ x₂, but f(x₁) = f(x₂). Let x₁ = -1 and x₂ = +1. f(x₁) = f(-1) = (-1)4 = 1 and f(x₁) = f(1) = 14 = 1, so f(x₀) = f(x₁) even though x₀ x₁, as required.

86 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₁ and x₂ such that x₁ x₂, but f(x₁) = f(x₂). Let x₁ = -1 and x₂ = +1. f(x₁) = f(-1) = (-1)4 = 1 and f(x₂) = f(1) = 14 = 1, so f(x₀) = f(x₁) even though x₀ x₁, as required.

87 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₁ and x₂ such that x₁ x₂, but f(x₁) = f(x₂). Let x₁ = -1 and x₂ = +1. f(x₁) = f(-1) = (-1)4 = 1 and f(x₂) = f(1) = 14 = 1, so f(x₁) = f(x₂) even though x₁ x₂, as required.

88 Injective Functions Theorem: Let f : ℤ ℕ be defined as f(x) = x4. Then f is not injective. Proof: We will prove that there exist integers x₁ and x₂ such that x₁ x₂, but f(x₁) = f(x₂). Let x₁ = -1 and x₂ = +1. f(x₁) = f(-1) = (-1)4 = 1 and f(x₂) = f(1) = 14 = 1, so f(x₁) = f(x₂) even though x₁ x₂, as required.

89 Injections and Composition

90 Injections and Composition Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is an injection. Our goal will be to prove this result. To do so, we're going to have to call back to the formal definitions of injectivity and function composition.

91 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required.

92 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required.

93 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required.

94 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required.

95 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). There There are are two two definitions definitions of of injectivity injectivity that that we we can can use use here: here: Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that a₁ A. A. ((g f)(a₁) = g(f(a₁)) g(f(a₂)), required. a₁ A. a₂ a₂ A.as ((g f)(a₁) =(g (g f)(a₂) f)(a₂) a₁ a₁= = a₂) a₂) a₁ a₁ A. A. a₂ a₂ A. A.(a₁ (a₁ a₂ a₂ (g (g f)(a₁) f)(a₁) (g (g f)(a₂)) f)(a₂)) Therefore, Therefore, we ll we ll choose choose an an arbitrary arbitrary a₁, a₁,a₂ a₂ AA where where a₁ a₁ a₂, a₂, then then prove prove that that (g (g f)(a₁) f)(a₁) (g (g f)(a₂). f)(a₂).

96 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). There There are are two two definitions definitions of of injectivity injectivity that that we we can can use use here: here: Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that a₁ A. A. ((g f)(a₁) = g(f(a₁)) g(f(a₂)), required. a₁ A. a₂ a₂ A.as ((g f)(a₁) =(g (g f)(a₂) f)(a₂) a₁ a₁= = a₂) a₂) a₁ a₁ A. A. a₂ a₂ A. A.(a₁ (a₁ a₂ a₂ (g (g f)(a₁) f)(a₁) (g (g f)(a₂)) f)(a₂)) Therefore, Therefore, we ll we ll choose choose an an arbitrary arbitrary a₁, a₁,a₂ a₂ AA where where a₁ a₁ a₂, a₂, then then prove prove that that (g (g f)(a₁) f)(a₁) (g (g f)(a₂). f)(a₂).

97 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). There There are are two two definitions definitions of of injectivity injectivity that that we we can can use use here: here: Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that a₁ A. A. ((g f)(a₁) = g(f(a₁)) g(f(a₂)), required. a₁ A. a₂ a₂ A.as ((g f)(a₁) =(g (g f)(a₂) f)(a₂) a₁ a₁= = a₂) a₂) a₁ a₁ A. A. a₂ a₂ A. A.(a₁ (a₁ a₂ a₂ (g (g f)(a₁) f)(a₁) (g (g f)(a₂)) f)(a₂)) Therefore, Therefore, we ll we ll choose choose an an arbitrary arbitrary a₁, a₁,a₂ a₂ AA where where a₁ a₁ a₂, a₂, then then prove prove that that (g (g f)(a₁) f)(a₁) (g (g f)(a₂). f)(a₂).

98 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required.

99 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required.

100 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that How isis (g defined? Howas (g f)(x) f)(x) g(f(a₁)) g(f(a₂)), required. defined? (g (g f)(x) f)(x)==g(f(x)) g(f(x)) So So we we need need to to prove prove that that g(f(a₁)) g(f(a₁)) g(f(a₂)). g(f(a₂)).

101 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that How isis (g defined? Howas (g f)(x) f)(x) g(f(a₁)) g(f(a₂)), required. defined? (g (g f)(x) f)(x)==g(f(x)) g(f(x)) So So we we need need to to prove prove that that g(f(a₁)) g(f(a₁)) g(f(a₂)). g(f(a₂)).

102 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that How isis (g defined? Howas (g f)(x) f)(x) g(f(a₁)) g(f(a₂)), required. defined? (g (g f)(x) f)(x)==g(f(x)) g(f(x)) So So we we need need to to prove prove that that g(f(a₁)) g(f(a₁)) g(f(a₂)). g(f(a₂)).

103 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that How isis (g defined? Howas (g f)(x) f)(x) g(f(a₁)) g(f(a₂)), required. defined? (g (g f)(x) f)(x)==g(f(x)) g(f(x)) So So we we need need to to prove prove that that g(f(a₁)) g(f(a₁)) g(f(a₂)). g(f(a₂)).

104 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required. g(f(a₁)) f(a₁) a₁ a₂ g(f(a₂)) f(a₂) A B C

105 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required. g(f(a₁)) f(a₁) a₁ a₂ g(f(a₂)) f(a₂) A B C

106 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required. g(f(a₁)) f(a₁) a₁ a₂ g(f(a₂)) f(a₂) A B C

107 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required. g(f(a₁)) f(a₁) a₁ a₂ g(f(a₂)) f(a₂) A B C

108 Theorem: If f : A B is an injection and g : B C is an injection, then the function g f : A C is also an injection. Proof: Let f : A B and g : B C be arbitrary injections. We will prove that the function g f : A C is also injective. To do so, consider any a₁, a₂ A where a₁ a₂. We will prove that (g f)(a₁) (g f)(a₂). Equivalently, we need to show that g(f(a₁)) g(f(a₂)). Since f is injective and a₁ a₂, we see that f(a₁) f(a₂). Then, since g is injective and f(a₁) f(a₂), we see that g(f(a₁)) g(f(a₂)), as required. g(f(a₁)) f(a₁) a₁ a₂ Great Great exercise: exercise: Repeat Repeat this this proof proof using using the the other other g(f(a₂)) f(a₂) A B definition definition of of injectivity. injectivity. C

109 Another Class of Functions

110 Mt. Lassen California Mt. Hood Washington Mt. St. Helens Oregon Mt. Shasta

111 Surjective Functions A function f : A B is called surjective (or onto) if this first-order logic statement is true about f: b B. a A. f(a) = b ( For every possible output, there's at least one possible input that produces it ) A function with this property is called a surjection. How does this compare to our first rule of functions?

112 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

113 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

114 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. does mean for Let What xwhat = 2y. Thenititwe see that does mean for ff to to be be surjective? surjective? f(x) = f(2y) = 2y / 2 = y. y ℝ. x ℝ. f(x) ==yy y ℝ. x ℝ. f(x) So f(x) = y, as required. Therefore, Therefore, we'll we'll choose choose an an arbitrary arbitrary yy ℝ, ℝ, then then prove prove that that there there isis some some xx ℝℝ where where f(x) f(x)==y. y.

115 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. does mean for Let What xwhat = 2y. Thenititwe see that does mean for ff to to be be surjective? surjective? f(x) = f(2y) = 2y / 2 = y. y ℝ. x ℝ. f(x) ==yy y ℝ. x ℝ. f(x) So f(x) = y, as required. Therefore, Therefore, we'll we'll choose choose an an arbitrary arbitrary yy ℝ, ℝ, then then prove prove that that there there isis some some xx ℝℝ where where f(x) f(x)==y. y.

116 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. does mean for Let What xwhat = 2y. Thenititwe see that does mean for ff to to be be surjective? surjective? f(x) = f(2y) = 2y / 2 = y. y ℝ. x ℝ. f(x) ==yy y ℝ. x ℝ. f(x) So f(x) = y, as required. Therefore, Therefore, we'll we'll choose choose an an arbitrary arbitrary yy ℝ, ℝ, then then prove prove that that there there isis some some xx ℝℝ where where f(x) f(x)==y. y.

117 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. does mean for Let What xwhat = 2y. Thenititwe see that does mean for ff to to be be surjective? surjective? f(x) = f(2y) = 2y / 2 = y. y ℝ. x ℝ. f(x) ==yy y ℝ. x ℝ. f(x) So f(x) = y, as required. Therefore, Therefore, we'll we'll choose choose an an arbitrary arbitrary yy ℝ, ℝ, then then prove prove that that there there isis some some xx ℝℝ where where f(x) f(x)==y. y.

118 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. does mean for Let What xwhat = 2y. Thenititwe see that does mean for ff to to be be surjective? surjective? f(x) = f(2y) = 2y / 2 = y. y ℝ. x ℝ. f(x) ==yy y ℝ. x ℝ. f(x) So f(x) = y, as required. Therefore, Therefore, we'll we'll choose choose an an arbitrary arbitrary yy ℝ, ℝ, then then prove prove that that there there isis some some xx ℝℝ where where f(x) f(x)==y. y.

119 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. does mean for Let What xwhat = 2y. Thenititwe see that does mean for ff to to be be surjective? surjective? f(x) = f(2y) = 2y / 2 = y. y ℝ. x ℝ. f(x) ==yy y ℝ. x ℝ. f(x) So f(x) = y, as required. Therefore, Therefore, we'll we'll choose choose an an arbitrary arbitrary yy ℝ, ℝ, then then prove prove that that there there isis some some xx ℝℝ where where f(x) f(x)==y. y.

120 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

121 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

122 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

123 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

124 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

125 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

126 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

127 Surjective Functions Theorem: Let f : ℝ ℝ be defined as f(x) = x / 2. Then f(x) is surjective. Proof: Consider any y ℝ. We will prove that there is a choice of x ℝ such that f(x) = y. Let x = 2y. Then we see that f(x) = f(2y) = 2y / 2 = y. So f(x) = y, as required.

128 Composing Surjections

129 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

130 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

131 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

132 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

133 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) =does c. itit mean What What does mean for for gg ff :: AA CC to to be be surjective? surjective? Consider any c C. Since g : B C is surjective, there is c C. = A. f)(a) = some b B such g(b) Similarly, c that C. a a A.c.(g (g f)(a)since = cc f : A B is surjective, there is some a A such that f(a) = b. This means thatwe'll there is some a A csuch Therefore, choose arbitrary C that and prove that there Therefore, we'll choose arbitrary c C and prove that there isis some AA such that (g g(b) = c,f)(a) some aa g(f(a)) such= that (g f)(a) == c. c. which is what we needed to show.

134 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) =does c. itit mean What What does mean for for gg ff :: AA CC to to be be surjective? surjective? Consider any c C. Since g : B C is surjective, there is c C. = A. f)(a) = some b B such g(b) Similarly, c that C. a a A.c.(g (g f)(a)since = cc f : A B is surjective, there is some a A such that f(a) = b. This means thatwe'll there is some a A csuch Therefore, choose arbitrary C that and prove that there Therefore, we'll choose arbitrary c C and prove that there isis some AA such that (g g(b) = c,f)(a) some aa g(f(a)) such= that (g f)(a) == c. c. which is what we needed to show.

135 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) =does c. itit mean What What does mean for for gg ff :: AA CC to to be be surjective? surjective? Consider any c C. Since g : B C is surjective, there is c C. = A. f)(a) = some b B such g(b) Similarly, c that C. a a A.c.(g (g f)(a)since = cc f : A B is surjective, there is some a A such that f(a) = b. This means thatwe'll there is some a A csuch Therefore, choose arbitrary C that and prove that there Therefore, we'll choose arbitrary c C and prove that there isis some AA such that (g g(b) = c,f)(a) some aa g(f(a)) such= that (g f)(a) == c. c. which is what we needed to show.

136 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

137 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

138 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show. A B C

139 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show. A f B C

140 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show. A f B g C

141 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is c surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show. A f B g C

142 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. b Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is c surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show. A f B g C

143 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. b Consider any c C. Since g : B C is surjective, there is a b B such that g(b) = c. Similarly, since f : A B is some c surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show. A f B g C

144 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. b Consider any c C. Since g : B C is surjective, there is a b B such that g(b) = c. Similarly, since f : A B is some c surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show. A f B g C

145 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

146 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

147 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

148 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

149 Theorem: If f : A B is surjective and g : B C is surjective, then g f : A C is also surjective. Proof: Let f : A B and g : B C be arbitrary surjections. We will prove that the function g f : A C is also surjective. To do so, we will prove that for any c C, there is some a A such that (g f)(a) = c. Equivalently, we will prove that for any c C, there is some a A such that g(f(a)) = c. Consider any c C. Since g : B C is surjective, there is some b B such that g(b) = c. Similarly, since f : A B is surjective, there is some a A such that f(a) = b. This means that there is some a A such that g(f(a)) = g(b) = c, which is what we needed to show.

150 Injections and Surjections An injective function associates at most one element of the domain with each element of the codomain. A surjective function associates at least one element of the domain with each element of the codomain. What about functions that associate exactly one element of the domain with each element of the codomain?

151 Katniss Everdeen Elsa Hermione Granger

152 Bijections A function that associates each element of the codomain with a unique element of the domain is called bijective. Such a function is a bijection. Formally, a bijection is a function that is both injective and surjective. Bijections are sometimes called one-toone correspondences. Not to be confused with one-to-one functions.

153 Bijections and Composition Suppose that f : A B and g : B C are bijections. Is g f necessarily a bijection? Yes! Since both f and g are injective, we know that g f is injective. Since both f and g are surjective, we know that g f is surjective. Therefore, g f is a bijection.

154 Inverse Functions

155 Katniss Everdeen Elsa Hermione Granger

156 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

157 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

158 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

159 Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

Functions, High-School Edition

Functions, High-School Edition Functions What is a function? Functions, High-School Edition f(x) = x4 5x2 + 4 source: https://saylordotorg.github.io/text_intermediate-algebra/section_07/6aaf3a5ab540885474d58855068b64ce.png source: http://study.com/cimages/multimages/16/asymptote_1.jpg

More information

Functions, High-School Edition

Functions, High-School Edition Functions What is a function? Functions, High-School Edition f(x) = x4 5x2 + 4 source: https://saylordotorg.github.io/text_intermediate-algebra/section_07/6aaf3a5ab540885474d58855068b64ce.png source: http://study.com/cimages/multimages/16/asymptote_1.jpg

More information

Functions, High-School Edition

Functions, High-School Edition Functions What is a function? Functions, High-School Edition f(x) = x4 5x2 + 4 source: https://saylordotorg.github.io/text_intermediate-algebra/section_07/6aaf3a5ab540885474d58855068b64ce.png source: http://study.com/cimages/multimages/16/asymptote_1.jpg

More information

Functions, High-School Edition

Functions, High-School Edition Functions What is a function? Functions, High-School Edition f(x) = x4 5x2 + 4 source: https://saylordotorg.github.io/text_intermediate-algebra/section_07/6aaf3a5ab540885474d58855068b64ce.png source: http://study.com/cimages/multimages/16/asymptote_1.jpg

More information

f(x) = x4 5x2 + 4 source:

f(x) = x4 5x2 + 4 source: Functions What is a function? f(x) = x4 5x2 + 4 source: https://saylordotorg.github.io/text_intermediate-algebra/section_07/6aaf3a5ab540885474d58855068b64ce.png int int flipuntil(int flipuntil(int n) n)

More information

The Pigeonhole Principle & Functions

The Pigeonhole Principle & Functions The Pigeonhole Principle & Functions Problem Problem Set Set Two Two due due in in the the box box up up front. front. The pigeonhole principle is the following: If m objects are placed into n bins, where

More information

Announcements. Problem Set 3 due Friday, October 21. Alternate Midterm Times. Drop by office hours! Ask questions at

Announcements. Problem Set 3 due Friday, October 21. Alternate Midterm Times. Drop by office hours! Ask questions at Functions Announcements Problem Set 3 due Friday, October 21 Drop by office hours! Ask questions at cs103@cs.stanford.edu. Alternate Midterm Times Wednesday, October 26, 7:00PM 10:00PM Thursday, October

More information

Functions. How is this definition written in symbolic logic notation?

Functions. How is this definition written in symbolic logic notation? functions 1 Functions Def. Let A and B be sets. A function f from A to B is an assignment of exactly one element of B to each element of A. We write f(a) = b if b is the unique element of B assigned by

More information

Graph Theory Part Two

Graph Theory Part Two Graph Theory Part Two Recap from Last Time A graph is a mathematical structure for representing relationships. Nodes A graph consists of a set of nodes (or vertices) connected by edges (or arcs) A graph

More information

Mathematical Logic Part One

Mathematical Logic Part One Mathematical Logic Part One Question: How do we formalize the logic we've been using in our proofs? Where We're Going Propositional Logic (Today) Basic logical connectives. Truth tables. Logical equivalences.

More information

Binary Relations Part One

Binary Relations Part One Binary Relations Part One Outline for Today Binary Relations Reasoning about connections between objects. Equivalence Relations Reasoning about clusters. A Fundamental Theorem How do we know we have the

More information

Outline for Today. The Pigeonhole Principle. Graph Theory Party Tricks. The Hadwiger-Nelson Problem. Results that are too big to fail.

Outline for Today. The Pigeonhole Principle. Graph Theory Party Tricks. The Hadwiger-Nelson Problem. Results that are too big to fail. Graphs Part Two Outline for Today The Pigeonhole Principle Graph Theory Party Tricks Results that are too big to fail. Applying graph theory to real life! The Hadwiger-Nelson Problem A glimpse of advanced

More information

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan MATH 22 Lecture M: 10/14/2003 MORE ABOUT FUNCTIONS Form follows function. Louis Henri Sullivan This frightful word, function, was born under other skies than those I have loved. Le Corbusier D ora innanzi

More information

Functions. Def. Let A and B be sets. A function f from A to B is an assignment of exactly one element of B to each element of A.

Functions. Def. Let A and B be sets. A function f from A to B is an assignment of exactly one element of B to each element of A. Functions functions 1 Def. Let A and B be sets. A function f from A to B is an assignment of exactly one element of B to each element of A. a A! b B b is assigned to a a A! b B f ( a) = b Notation: If

More information

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology.

In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. Guide to and Hi everybody! In our first lecture on sets and set theory, we introduced a bunch of new symbols and terminology. This guide focuses on two of those symbols: and. These symbols represent concepts

More information

Extra Practice Problems 2

Extra Practice Problems 2 CS103 Handout 31 Fall 2018 October 29, 2018 Extra Practice Problems 2 Here's a set of a bunch of practice problems you can work through to solidify your understanding of the topics from Problem Sets Three,

More information

2. Functions, sets, countability and uncountability. Let A, B be sets (often, in this module, subsets of R).

2. Functions, sets, countability and uncountability. Let A, B be sets (often, in this module, subsets of R). 2. Functions, sets, countability and uncountability I. Functions Let A, B be sets (often, in this module, subsets of R). A function f : A B is some rule that assigns to each element of A a unique element

More information

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Relations Let s talk about relations! Grade 6 Math Circles November 6 & 7 2018 Relations, Functions, and

More information

Skill 1: Multiplying Polynomials

Skill 1: Multiplying Polynomials CS103 Spring 2018 Mathematical Prerequisites Although CS103 is primarily a math class, this course does not require any higher math as a prerequisite. The most advanced level of mathematics you'll need

More information

Mathematical Logic Part Two

Mathematical Logic Part Two Mathematical Logic Part Two A Note on the Career Fair Recap from Last Time Recap So Far A propositional variable is a variable that is either true or false. The propositional connectives are as follows:

More information

Mathematical Logic Part Two

Mathematical Logic Part Two Mathematical Logic Part Two A Note on the Career Fair Recap from Last Time Recap So Far A propositional variable is a variable that is either true or false. The propositional connectives are as follows:

More information

CS103 Spring 2018 Mathematical Vocabulary

CS103 Spring 2018 Mathematical Vocabulary CS103 Spring 2018 Mathematical Vocabulary You keep using that word. I do not think it means what you think it means. - Inigo Montoya, from The Princess Bride Consider the humble while loop in most programming

More information

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships

Instructor: Craig Duckett. Lecture 04: Thursday, April 5, Relationships Instructor: Craig Duckett Lecture 04: Thursday, April 5, 2018 Relationships 1 Assignment 1 is due NEXT LECTURE 5, Tuesday, April 10 th in StudentTracker by MIDNIGHT MID-TERM EXAM is LECTURE 10, Tuesday,

More information

W13:Homework:H07. CS40 Foundations of Computer Science W13. From 40wiki

W13:Homework:H07. CS40 Foundations of Computer Science W13. From 40wiki W13:Homework:H07 From 40wiki CS40 Foundations of Computer Science W13 W13:Exams W13:Homework in Class and Web Work W13:Calendar W13:Syllabus and Lecture Notes UCSB-CS40-W13 on Facebook (https://www.facebook.com/groups/ucsb.cs40.w13/)

More information

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 [talking head] This lecture we study theory design and implementation. Programmers have two roles to play here. In one role, they

More information

ASYMPTOTIC COMPLEXITY

ASYMPTOTIC COMPLEXITY Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better. - Edsger Dijkstra ASYMPTOTIC COMPLEXITY Lecture

More information

Functions. Jason Filippou UMCP. Jason Filippou UMCP) Functions / 19

Functions. Jason Filippou UMCP. Jason Filippou UMCP) Functions / 19 Functions Jason Filippou CMSC250 @ UMCP 06-22-2016 Jason Filippou (CMSC250 @ UMCP) Functions 06-22-2016 1 / 19 Outline 1 Basic definitions and examples 2 Properties of functions 3 The pigeonhole principle

More information

Mathematical Logic Part Two

Mathematical Logic Part Two Mathematical Logic Part Two Recap from Last Time Recap So Far A propositional variable is a variable that is either true or false. The propositional connectives are as follows: Negation: p Conjunction:

More information

Introduction to Sets and Logic (MATH 1190)

Introduction to Sets and Logic (MATH 1190) Introduction to Sets and Logic () Instructor: Email: shenlili@yorku.ca Department of Mathematics and Statistics York University Dec 4, 2014 Outline 1 2 3 4 Definition A relation R from a set A to a set

More information

Functions 2/1/2017. Exercises. Exercises. Exercises. and the following mathematical appetizer is about. Functions. Functions

Functions 2/1/2017. Exercises. Exercises. Exercises. and the following mathematical appetizer is about. Functions. Functions Exercises Question 1: Given a set A = {x, y, z} and a set B = {1, 2, 3, 4}, what is the value of 2 A 2 B? Answer: 2 A 2 B = 2 A 2 B = 2 A 2 B = 8 16 = 128 Exercises Question 2: Is it true for all sets

More information

Welcome to CS 135 (Winter 2018)

Welcome to CS 135 (Winter 2018) Welcome to CS 135 (Winter 2018) Instructors: Sandy Graham, Paul Nijjar Other course personnel: see website for details ISAs (Instructional Support Assistants) IAs (Instructional Apprentices) ISC (Instructional

More information

Solutions to Some Examination Problems MATH 300 Monday 25 April 2016

Solutions to Some Examination Problems MATH 300 Monday 25 April 2016 Name: s to Some Examination Problems MATH 300 Monday 25 April 2016 Do each of the following. (a) Let [0, 1] denote the unit interval that is the set of all real numbers r that satisfy the contraints that

More information

Proofwriting Checklist

Proofwriting Checklist CS103 Winter 2019 Proofwriting Checklist Cynthia Lee Keith Schwarz Over the years, we ve found many common proofwriting errors that can easily be spotted once you know how to look for them. In this handout,

More information

Friday Four Square! Today at 4:15PM, Outside Gates

Friday Four Square! Today at 4:15PM, Outside Gates Control Structures Announcements Programming Assignment #1 due right now. Due on next Wednesday if using a late day. Email due on Sunday night. Programming Assignment #2 out today, due Wednesday, January

More information

Outline for Today. How can we speed up operations that work on integer data? A simple data structure for ordered dictionaries.

Outline for Today. How can we speed up operations that work on integer data? A simple data structure for ordered dictionaries. van Emde Boas Trees Outline for Today Data Structures on Integers How can we speed up operations that work on integer data? Tiered Bitvectors A simple data structure for ordered dictionaries. van Emde

More information

Cardinality Lectures

Cardinality Lectures Cardinality Lectures Enrique Treviño March 8, 014 1 Definition of cardinality The cardinality of a set is a measure of the size of a set. When a set A is finite, its cardinality is the number of elements

More information

Binary Relations Part One

Binary Relations Part One Binary Relations Part One Outline for Today Binary Relations Reasoning about connections between objects. Equivalence Relations Reasoning about clusters. A Fundamental Theorem How do we know we have the

More information

Problem One: A Quick Algebra Review

Problem One: A Quick Algebra Review CS103A Winter 2019 Solutions for Week One Handout 01S Problem One: A Quick Algebra Review In the first week of CS103, we'll be doing a few proofs that will require some algebraic manipulations and reasoning

More information

MATH 271 Summer 2016 Assignment 4 solutions

MATH 271 Summer 2016 Assignment 4 solutions MATH 7 ummer 06 Assignment 4 solutions Problem Let A, B, and C be some sets and suppose that f : A B and g : B C are functions Prove or disprove each of the following statements (a) If f is one-to-one

More information

CS 4349 Lecture August 21st, 2017

CS 4349 Lecture August 21st, 2017 CS 4349 Lecture August 21st, 2017 Main topics for #lecture include #administrivia, #algorithms, #asymptotic_notation. Welcome and Administrivia Hi, I m Kyle! Welcome to CS 4349. This a class about algorithms.

More information

Announcement. Submit assignment 3 on CourSys Do not hand in hard copy Due Friday, 15:20:00. Caution: Assignment 4 will be due next Wednesday

Announcement. Submit assignment 3 on CourSys Do not hand in hard copy Due Friday, 15:20:00. Caution: Assignment 4 will be due next Wednesday Announcement Submit assignment 3 on CourSys Do not hand in hard copy Due Friday, 15:20:00 Caution: Assignment 4 will be due next Wednesday Recursion Examples and Simple Searching CMPT 125 Jan. 28 Recursion

More information

Notes on metric spaces and topology. Math 309: Topics in geometry. Dale Rolfsen. University of British Columbia

Notes on metric spaces and topology. Math 309: Topics in geometry. Dale Rolfsen. University of British Columbia Notes on metric spaces and topology Math 309: Topics in geometry Dale Rolfsen University of British Columbia Let X be a set; we ll generally refer to its elements as points. A distance function, or metric

More information

Control Statements. if for while

Control Statements. if for while Control Structures Control Statements if for while Control Statements if for while This This is is called called the the initialization initialization statement statement and and is is performed performed

More information

Mathematical Logic Part One

Mathematical Logic Part One Mathematical Logic Part One Question: How do we formalize the logic we've been using in our proofs? Where We're Going Propositional Logic (Today) Basic logical connectives. Truth tables. Logical equivalences.

More information

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall CSE 20 https://goo.gl/forms/1o 1KOd17RMoURxjn2 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Explain the steps in a proof by mathematical and/or structural

More information

Turing Machines Part Two

Turing Machines Part Two Turing Machines Part Two Recap from Last Time The Turing Machine A Turing machine consists of three parts: A finite-state control that issues commands, an infinite tape for input and scratch space, and

More information

Context-Free Grammars

Context-Free Grammars Context-Free Grammars Describing Languages We've seen two models for the regular languages: Automata accept precisely the strings in the language. Regular expressions describe precisely the strings in

More information

MITOCW watch?v=4dj1oguwtem

MITOCW watch?v=4dj1oguwtem MITOCW watch?v=4dj1oguwtem PROFESSOR: So it's time to examine uncountable sets. And that's what we're going to do in this segment. So Cantor's question was, are all sets the same size? And he gives a definitive

More information

Range Minimum Queries Part Two

Range Minimum Queries Part Two Range Minimum Queries Part Two Recap from Last Time The RMQ Problem The Range Minimum Query (RMQ) problem is the following: Given a fixed array A and two indices i j, what is the smallest element out of

More information

Context-Free Grammars

Context-Free Grammars Context-Free Grammars Describing Languages We've seen two models for the regular languages: Finite automata accept precisely the strings in the language. Regular expressions describe precisely the strings

More information

3. Determine whether f is a function from the set of all bit strings to the set of integers if

3. Determine whether f is a function from the set of all bit strings to the set of integers if Exercises Exercises 1. Why is f not a function from R to R if a) f(x) = 1/x? b) c) 2. Determine whether f is a function from Z to R if a) f(n) = ± n. b). c) f(n) = 1/(n2 4). 3. Determine whether f is a

More information

Instructor: Craig Duckett. Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables

Instructor: Craig Duckett. Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables Instructor: Craig Duckett Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables 1 Assignment 1 is due LECTURE 5, Tuesday, April 10 th, 2018 in StudentTracker by MIDNIGHT MID-TERM

More information

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson Lecture 7: Primitive Recursion is Turing Computable Michael Beeson Closure under composition Let f and g be Turing computable. Let h(x) = f(g(x)). Then h is Turing computable. Similarly if h(x) = f(g 1

More information

Welcome to CS 135 (Fall 2018) Themes of the course. Lectures. cs135/

Welcome to CS 135 (Fall 2018) Themes of the course. Lectures.   cs135/ Welcome to CS 135 (Fall 2018) Instructors: Byron Weber Becker, Charles Clarke, Gord Cormack, Robert Hackman, Kevin Lanctot, Paul Nijjar, Adrian Reetz Other course personnel: see website for details ISAs

More information

x-fast and y-fast Tries

x-fast and y-fast Tries x-fast and y-fast Tries Outline for Today Bitwise Tries A simple ordered dictionary for integers. x-fast Tries Tries + Hashing y-fast Tries Tries + Hashing + Subdivision + Balanced Trees + Amortization

More information

A graph is a mathematical structure for representing relationships.

A graph is a mathematical structure for representing relationships. Graphs Part Two A graph is a mathematical structure for representing relationships. Nodes A graph consists of a set of nodes (or vertices) connected by edges (or arcs) A graph is a mathematical structure

More information

(Refer Slide Time: 1:27)

(Refer Slide Time: 1:27) Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 1 Introduction to Data Structures and Algorithms Welcome to data

More information

Outline for Today. How can we speed up operations that work on integer data? A simple data structure for ordered dictionaries.

Outline for Today. How can we speed up operations that work on integer data? A simple data structure for ordered dictionaries. van Emde Boas Trees Outline for Today Data Structures on Integers How can we speed up operations that work on integer data? Tiered Bitvectors A simple data structure for ordered dictionaries. van Emde

More information

Range Minimum Queries Part Two

Range Minimum Queries Part Two Range Minimum Queries Part Two Recap from Last Time The RMQ Problem The Range Minimum Query (RMQ) problem is the following: Given a fied array A and two indices i j, what is the smallest element out of

More information

Relations I. Margaret M. Fleck. 7 November 2008

Relations I. Margaret M. Fleck. 7 November 2008 Relations I Margaret M. Fleck 7 November 2008 This lecture covers relations and basic properties of relations, which is most of section 8.1 of Rosen. 1 Announcements Model solutions for the second midterm

More information

ASYMPTOTIC COMPLEXITY

ASYMPTOTIC COMPLEXITY Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better. - Edsger Dijkstra ASYMPTOTIC COMPLEXITY Lecture

More information

Lecture 3: Recursion; Structural Induction

Lecture 3: Recursion; Structural Induction 15-150 Lecture 3: Recursion; Structural Induction Lecture by Dan Licata January 24, 2012 Today, we are going to talk about one of the most important ideas in functional programming, structural recursion

More information

Continuous functions and homeomorphisms

Continuous functions and homeomorphisms Continuous functions and homeomorphisms 1 Motivation Up to now we have defined just a few topological properties, like the first three T -axioms and the countability properties (separable, ccc, first and

More information

Continuity and Tangent Lines for functions of two variables

Continuity and Tangent Lines for functions of two variables Continuity and Tangent Lines for functions of two variables James K. Peterson Department of Biological Sciences and Department of Mathematical Sciences Clemson University April 4, 2014 Outline 1 Continuity

More information

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 [talking head] Formal Methods of Software Engineering means the use of mathematics as an aid to writing programs. Before we can

More information

CS261: Problem Set #1

CS261: Problem Set #1 CS261: Problem Set #1 Due by 11:59 PM on Tuesday, April 21, 2015 Instructions: (1) Form a group of 1-3 students. You should turn in only one write-up for your entire group. (2) Turn in your solutions by

More information

0.1 Welcome. 0.2 Insertion sort. Jessica Su (some portions copied from CLRS)

0.1 Welcome. 0.2 Insertion sort. Jessica Su (some portions copied from CLRS) 0.1 Welcome http://cs161.stanford.edu My contact info: Jessica Su, jtysu at stanford dot edu, office hours Monday 3-5 pm in Huang basement TA office hours: Monday, Tuesday, Wednesday 7-9 pm in Huang basement

More information

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM Name: Student ID: Signature: Section (circle one): George Steve Your signature acknowledges your understanding of and agreement

More information

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction

CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want

More information

CS61A Notes Week 1A: Basics, order of evaluation, special forms, recursion

CS61A Notes Week 1A: Basics, order of evaluation, special forms, recursion CS61A Notes Week 1A: Basics, order of evaluation, special forms, recursion Assorted Scheme Basics 1. The ( is the most important character in Scheme. If you have coded in other languages such as C or Java,

More information

Computation, Computers, and Programs. Administrivia. Resources. Course texts: Kozen: Introduction to Computability Hickey: Introduction to OCaml

Computation, Computers, and Programs. Administrivia. Resources. Course texts: Kozen: Introduction to Computability Hickey: Introduction to OCaml CS20a: Computation, Computers, Programs Instructor: Jason Hickey Email: jyh@cs.caltech.edu Office hours: TR 10-11am TAs: Nathan Gray (n8gray@cs.caltech.edu) Brian Aydemir (emre@cs.caltech.edu) Jason Frantz

More information

Shared Variables and Interference

Shared Variables and Interference Solved Shared Variables and Interference CS 536: Science of Programming, Fall 2018 A. Why Parallel programs can coordinate their work using shared variables, but it s important for threads to not interfere

More information

Most of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few

Most of the class will focus on if/else statements and the logical statements (conditionals) that are used to build them. Then I'll go over a few With notes! 1 Most of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few useful functions (some built into standard

More information

Graph Theory Part Two

Graph Theory Part Two Graph Theory Part Two Recap from Last Time A graph a mamatical structure for representing relationships. A graph consts a set nodes (or vertices) connected by edges (or arcs) Adjacency and Connectivity

More information

Calculus I Review Handout 1.3 Introduction to Calculus - Limits. by Kevin M. Chevalier

Calculus I Review Handout 1.3 Introduction to Calculus - Limits. by Kevin M. Chevalier Calculus I Review Handout 1.3 Introduction to Calculus - Limits by Kevin M. Chevalier We are now going to dive into Calculus I as we take a look at the it process. While precalculus covered more static

More information

Denotational semantics

Denotational semantics 1 Denotational semantics 2 What we're doing today We're looking at how to reason about the effect of a program by mapping it into mathematical objects Specifically, answering the question which function

More information

Introduction to Counting, Some Basic Principles

Introduction to Counting, Some Basic Principles Introduction to Counting, Some Basic Principles These are the class notes for week. Before we begin, let me just say something about the structure of the class notes. I wrote up all of these class notes

More information

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 1.1 Inductive Reasoning What You Will Learn Inductive and deductive reasoning processes 1.1-2 Natural Numbers The set of natural numbers is also called the set of counting numbers. N = {1, 2, 3,

More information

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc.

Section 1.1. Inductive Reasoning. Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 1.1 Inductive Reasoning What You Will Learn Inductive and deductive reasoning processes 1.1-2 Natural Numbers The set of natural numbers is also called the set of counting numbers. N = {1, 2, 3,

More information

B ABC is mapped into A'B'C'

B ABC is mapped into A'B'C' h. 00 Transformations Sec. 1 Mappings & ongruence Mappings Moving a figure around a plane is called mapping. In the figure below, was moved (mapped) to a new position in the plane and the new triangle

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

Math 152: Applicable Mathematics and Computing

Math 152: Applicable Mathematics and Computing Math 152: Applicable Mathematics and Computing April 10, 2017 April 10, 2017 1 / 12 Announcements Don t forget, first homework is due on Wednesday. Each TA has their own drop-box. Please provide justification

More information

W13:Homework:H08. CS40 Foundations of Computer Science W13. From 40wiki

W13:Homework:H08. CS40 Foundations of Computer Science W13. From 40wiki W13:Homework:H08 From 40wiki CS40 Foundations of Computer Science W13 W13:Exams W13:Homework in Class and Web Work W13:Calendar W13:Syllabus and Lecture Notes UCSB-CS40-W13 on Facebook (https://www.facebook.com/groups/ucsb.cs40.w13/)

More information

We will show that the height of a RB tree on n vertices is approximately 2*log n. In class I presented a simple structural proof of this claim:

We will show that the height of a RB tree on n vertices is approximately 2*log n. In class I presented a simple structural proof of this claim: We have seen that the insert operation on a RB takes an amount of time proportional to the number of the levels of the tree (since the additional operations required to do any rebalancing require constant

More information

How invariants help writing loops Author: Sander Kooijmans Document version: 1.0

How invariants help writing loops Author: Sander Kooijmans Document version: 1.0 How invariants help writing loops Author: Sander Kooijmans Document version: 1.0 Why this document? Did you ever feel frustrated because of a nasty bug in your code? Did you spend hours looking at the

More information

The Language of Sets and Functions

The Language of Sets and Functions MAT067 University of California, Davis Winter 2007 The Language of Sets and Functions Isaiah Lankham, Bruno Nachtergaele, Anne Schilling (January 7, 2007) 1 The Language of Sets 1.1 Definition and Notation

More information

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 10 Notes. Class URL:

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 10 Notes. Class URL: Notes slides from before lecture CSE 21, Winter 2017, Section A00 Lecture 10 Notes Class URL: http://vlsicad.ucsd.edu/courses/cse21-w17/ Notes slides from before lecture Notes February 13 (1) HW5 is due

More information

B ABC is mapped into A'B'C'

B ABC is mapped into A'B'C' h. 00 Transformations Sec. 1 Mappings & ongruence Mappings Moving a figure around a plane is called mapping. In the figure below, was moved (mapped) to a new position in the plane and the new triangle

More information

Specifications. Prof. Clarkson Fall Today s music: Nice to know you by Incubus

Specifications. Prof. Clarkson Fall Today s music: Nice to know you by Incubus Specifications Prof. Clarkson Fall 2015 Today s music: Nice to know you by Incubus Question Would you like a tiny bonus to your final grade for being here on time today? A. Yes B. Sí C. Hai D. Haan E.

More information

Hi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides

Hi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides Hi everyone. Starting this week I'm going to make a couple tweaks to how section is run. The first thing is that I'm going to go over all the slides for both problems first, and let you guys code them

More information

Math 5320, 3/28/18 Worksheet 26: Ruler and compass constructions. 1. Use your ruler and compass to construct a line perpendicular to the line below:

Math 5320, 3/28/18 Worksheet 26: Ruler and compass constructions. 1. Use your ruler and compass to construct a line perpendicular to the line below: Math 5320, 3/28/18 Worksheet 26: Ruler and compass constructions Name: 1. Use your ruler and compass to construct a line perpendicular to the line below: 2. Suppose the following two points are spaced

More information

Outline for Today. Planar Graphs. Graph Coloring. The Pigeonhole Principle. Ramsey Theory. The Hadwiger-Nelson Problem (ITA)

Outline for Today. Planar Graphs. Graph Coloring. The Pigeonhole Principle. Ramsey Theory. The Hadwiger-Nelson Problem (ITA) Graphs Part Two Outline for Today Planar Graphs Graph Coloring Revisiting a core idea in counting. Ramsey Theory A common operation on graphs with surprising properties. The Pigeonhole Principle A special

More information

Welcome to CS166! Four handouts available up front. Today: Also available online! Why study data structures? The range minimum query problem.

Welcome to CS166! Four handouts available up front. Today: Also available online! Why study data structures? The range minimum query problem. Welcome to CS166! Four handouts available up front. Also available online! Today: Why study data structures? The range minimum query problem. Why Study Data Structures? Why Study Data Structures? Explore

More information

Search Lesson Outline

Search Lesson Outline 1. Searching Lesson Outline 2. How to Find a Value in an Array? 3. Linear Search 4. Linear Search Code 5. Linear Search Example #1 6. Linear Search Example #2 7. Linear Search Example #3 8. Linear Search

More information

B ABC is mapped into A'B'C'

B ABC is mapped into A'B'C' h. 00 Transformations Sec. 1 Mappings & ongruence Mappings Moving a figure around a plane is called mapping. In the figure below, was moved (mapped) to a new position in the plane and the new triangle

More information

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say Sets 1 Where does mathematics start? What are the ideas which come first, in a logical sense, and form the foundation for everything else? Can we get a very small number of basic ideas? Can we reduce it

More information

14.1 Encoding for different models of computation

14.1 Encoding for different models of computation Lecture 14 Decidable languages In the previous lecture we discussed some examples of encoding schemes, through which various objects can be represented by strings over a given alphabet. We will begin this

More information

CS103 Handout 50 Fall 2018 November 30, 2018 Problem Set 9

CS103 Handout 50 Fall 2018 November 30, 2018 Problem Set 9 CS103 Handout 50 Fall 2018 November 30, 2018 Problem Set 9 What problems are beyond our capacity to solve? Why are they so hard? And why is anything that we've discussed this quarter at all practically

More information

Mathematical Logic Part Two

Mathematical Logic Part Two Mathematical Logic Part Two Recap from Last Time Recap So Far A propositional variable a variable that either true or false. The propositional connectives are as follows: Negation: p Conjunction: p q Djunction:

More information

Equations and Functions, Variables and Expressions

Equations and Functions, Variables and Expressions Equations and Functions, Variables and Expressions Equations and functions are ubiquitous components of mathematical language. Success in mathematics beyond basic arithmetic depends on having a solid working

More information