Lecture 16: Functions and RelationsWe have already encountered functions many times and we often use functions when we program. Let us formalize what functions are in mathematical terms: Functions
A function Example -1Consider ![]() The function above can be represented explicitly by the mapping or implicitly by the rule/formula Example-2Functions can map many elements of ![]() Example-3: Power Set SignatureWhile discussing power sets, we mentioned a correspondence between
power-sets of a set and binary strings. We can indeed write it as a
function. Let us take The table below shows the elements of the power set and the corresponding
value of
Example-4: Mathematical functionsYou may have seen many examples of functions from your mathematics classes, thus far.
Non-Examples of Functions.It remains to clarify what is not a function. In general, a mapping
from set
If either case occurs then, the mapping fails to be a function. Consider the two mappings shown below. The mapping on the left fails
to be a function because it does not map the elements ![]() Mathematical non functionsStrictly speaking, many functions that we saw in calculus are not quite functions.
RelationsFormally, a relation Example-1Let us take Like functions, we may view the relation as a mapping. However, unlike functions, it is possible that
The relation ![]() Functions are a special case of relations, wherein
Example-2Here is another example of a relation over numbers: Write down some examples of elements of Example-3Consider sets Counting RelationsIf Answer in class. Domains/Co-DomainsLet Similarly, let Relations On a SetA relation Eg., Let The relation has the tuples ![]() The rule is we have nodes or vertices for each element in the set |