functions and onto

21
Functions and Onto Discrete Structures (CS 173) Madhusudan Parthasarathy, University of Illinois Boats with Sand Van Gogh 1

Upload: devi

Post on 23-Feb-2016

22 views

Category:

Documents


0 download

DESCRIPTION

Functions and Onto. Boats with Sand Van Gogh. Discrete Structures (CS 173) Madhusudan Parthasarathy , University of Illinois. Administrative. Midter m-1 Exam next Tuesday in class Materials to help you prepare: Skills list: detailed list of things you could be tested on - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Functions and Onto

Functions and Onto

Discrete Structures (CS 173)Madhusudan Parthasarathy, University of Illinois

Boats with SandVan Gogh

1

Page 2: Functions and Onto

Administrative

• Midterm-1 Exam next Tuesday in class

• Materials to help you prepare:– Skills list: detailed list of things you could be tested on– Mock midterm exam with solutions– Review notes

(concise notes of things you have learnt so far)

• Honors homework available online

• Some office hours next week will be moved from Tues/Wed to Sun/Mon– will post times on piazza

Page 3: Functions and Onto

Last class: relations

Reflexive

Symmetric

Transitive

Irreflexive, Antisymmetric

Not Transitive

Vacuous truth

Page 4: Functions and Onto

Today’s class: functions

• What is a function, and what is not?

• Identify which functions are “onto”

• Nested quantifiers– Mixing “for all” and “there exists”

• Composing functions

4

Page 5: Functions and Onto

What is a function?

Function: maps each input element to exactly one output element

Every function has1) a type signature that defines what inputs and outputs

are possible2) an assignment or mapping that specifies which output

goes with each input

𝑓 : 𝐴→𝐵 such that 𝑓 (𝑥 )=…domain co-domain

Page 6: Functions and Onto

Examples of functionsConcepts: type signature, mapping; bubbles, plotsFunctions: age, t-shirt color,

Page 7: Functions and Onto

What is not a function?Not a valid function if1. No type signature2. Some input is not mapped to an output3. Some input is mapped to two outputs

Page 8: Functions and Onto

When are functions equal?Functions are equal if 1. They have the same type signature2. The mapping is the same

Equal functions may not necessarily have the same description/closed form!

Page 9: Functions and Onto

Ontoimage: set of values produced when a function is applied to all inputs

onto: the image is the co-domain (every possible output is assigned to at least one input)

𝑓 : 𝐴→𝐵 ,∀ 𝑦∈𝐵 ,∃𝑥∈𝐴 , such that 𝑓 (𝑥 )=𝑦

Page 10: Functions and Onto

Proof of ontoClaim: is onto. Definition: is onto iff

Page 11: Functions and Onto

Proof of ontoClaim: is onto. Definition: is onto iff

Page 12: Functions and Onto

Onto functions to a finite set• Let f: A -> B and B have n elements.• How many elements can A have?

- Less than n?- Equal to n?

- Greater than n but finite? - Infinite?

Page 13: Functions and Onto

Can there be an onto function from to ?!

if x is odd

0 -> 0 1->-1 2->1 3-> -2 4-> 2 …

Page 14: Functions and Onto

Nested quantifiersThere is a pencil for every student.

Every student is using the same pencil.

For a function , every output element is assigned to at least one input element.

For a function , there is one output that is assigned to every input.

Page 15: Functions and Onto

Nested quantifiersThere exists an such that for every ,

There exists an such that for every ,

For every there exists a , such that

For every there exists a , such that

Page 16: Functions and Onto

Negation with nested quantifiersIt’s not true that there is a pencil for every student.

No student has any pencil.

There is one pencil that no student has.

onto:

not onto:

Page 17: Functions and Onto

Disproof of ontoDisprove: is onto. Definition: is onto iff

Page 18: Functions and Onto

Composition

What is wrong with ”

Page 19: Functions and Onto

Proof with compositionClaim: For sets , if are onto, then is also onto. Definition: is onto iff

Page 20: Functions and Onto

Things to remember

• A function must have a type signature and a mapping

• A valid function must have exactly one output for each input (two inputs can be assigned the same output)

• For two functions to be equal, both the type signature and the assignment must be the same

• A function is onto iff every output element is assigned at least once.

• With proofs remember: First, take time to understand the hypothesis and conclusionThen, translate into a clear mathematical expression.Then, work backwards and forwards to make hypothesis reach conclusion.Finally, write it all out in logical order from hypothesis to conclusion.

Page 21: Functions and Onto

See you Thursday!

• One-to-one functions, bijection, permutation