# Web Developer

## Discrete Math: Functions

### Define: Functions

Let A and B be nonempty sets. A function f   from A to B, which is denoted f: A –> B, is a relation from A to B such that all a ∈ Dom(f), f(a), the f-relative set of a, contains just one element of B. Naturally, if a is not in Dom(f), then f(a) = ∅. If f(a) = {b}, it is traditional to identify the set {b} with the element b and write f(a) = b.

### Simplified Definition: Functions

Definition 1.a: Each member of the domain associates with only one member of the range.
Defintion 1.b Inversely, one member of the range can associate with multiple members of the domain.

Therefore, an example of a function using Definition 1.a is: {(a,1),(c,2),(d,-4)} as each domain (a,c,d) is associated with only 1 range (1,2,-4). Inversely, an example of definition 1.b is: {(a,1),(c,1)} as each domain (a,b) is associated with only 1 range (1) even though the range (1) is associated with more then one domains (a,c).

### Function: Input/Output Example

Example 1: You can:
input:a and output:-3
but you cannot:
input:(a) and output:(2,-3)

Example 2: You can
input:(a,c) and output:(1,1)

Input can have only one output. Output can have more then one input.
F(x) = {(a,1),(z,-3),(d,9)}
F(x) = {(a,1),(z,1),(d,1)}
F(x) ≠ {(a,1),(a,2)}

### Simplified Example

Given that A = {a,b,c} and B = {3,4}
then the Relation:
R = {(a,3),(b,4)} is a function. Why is this true?
Because the Domain A {a,b} are both mapped to to the Range(output) B {3,4}
the Relation:
R = {(a,3),(b,3),(c,3)(c,4)} is NOT a function. Why is this true?
Becuase the Domain A maps c –>4, and c–>3.
Given the domain A(c) CAN NOT hold two outputs of (c–>3, c–>4)