Table of contents
Functions
Parent: Discrete Mathematics
Subject: Computer Science
Type: Semester
SL#: 2401201852
Status: Current

A function assigns exactly one element of a set to each element of the other set. Functions are the rules that assigns one input to one output. The function can be represented as f:ABf:A\to B. AA is called the domain, and BB is called the co-domain.

Figure 1: Relation map between domain AA, and co-domain BB:

Figure 1: Relation map between domain A, and co-domain B

Range

The elements of the co-domain that are participating in the function is called range. For example, in the following figure:

Figure 2: Relation map between domain AA, and co-domain BB:

Figure 2: Relation map between domain A, and co-domain B

The range of the function are only those elements participating in the function. The range RR is:

R={a,b}R=\{a,b\}

It is important to note that, any range is a subset of the co-domain, i.e.,

RBR\subseteq B

where, RR is the range, and BB is the co-domain.

Example 1: State if the following are functions or not.

  1. f(x)=1xf(x)={1\over x}, where xRx\in R.

    This is not a function, as for x=0x=0, the function f(x)=f(0)f(x)=f(0) is not defined.

  2. f(x)=xf(x)=\sqrt{x}, where xRx\in R.

    This is not a function, as for any negative value of xx, the function f(x)f(x) is not defined.

  3. f(x)=±x21f(x)=\pm{\sqrt{x^2-1}}, where xRx\in R.

    This is not a function, as there are two possible values for f(x)f(x), A function should only have, or point to one value.

Example 2: Given two sets, A={p,q,r,s}A=p,q,r,sA={p,q,r,s}A=p,q,r,sA=\{p,q,r,s\}A={p,q,r,s}A=\{p,q,r,s\}A={p,q,r,s}, and B={a,b,c}B=a,b,cB={a,b,c}B=a,b,cB=\{a,b,c\}B={a,b,c}B=\{a,b,c\}B={a,b,c}. Draw the function diagram and determine whether, the relation is a function or not. If it is a function, determine the range, domain and co-domain, for the following:

(1) {(p,a),(q,a),(r,a),(s,a)}\{(p,a),(q,a),(r,a),(s,a)\},

(2) {(p,a),(q,b),(p,b),(r,a),(s,b)}\{(p,a),(q,b),(p,b),(r,a),(s,b)\}.

Solution

  1. The relation map for the function is:

    It is a function.

    Range, R={a}R=\{a\}

    Domain, D={p,q,r,s}D=\{p,q,r,s\}

    Co-domain, D={a,b,c}D'=\{a,b,c\}

  2. The relation map for the function is:

    It is not a function, since pp returns two different values.

Types of Functions

One to one function: Injective function

A function f:ABf:A\to B is said to be one to one function if different elements of AA have different images in BB.

Figure 3: Relation map between an one to one function of AA and BB:

Onto function: Subjective function

A function f:ABf:A\to B is said to be onto function if every element of BB is an image of some element of AA, i.e., the range of ff is equal to its co-domain.

Figure 4: Relation map between an onto function of AA and BB:

One to one correspondent function: Bijective function

A function f:ABf:A\to B is called one to one correspondent function if the function is both one to one and onto function.

Figure 5: Relation map between an one to one correspondent function of AA and BB:

Composition of a Function

Let f:ABf:A\to B and g:BCg:B\to C be two function such that range of ff is a subset of domain of gg, then a new function gof:ACgof: A\to C, called the composition of ff and gg may be defined as:

gof(a)=g(f(a))  aAgof(a)=g(f(a))\ \forall\ a\in A

Figure 6: Relation map for composition of a function between AA, BB, and CC:

For fogfog:

  • f(g(a))=f(c)=af(g(a))=f(c)=a

  • f(g(b))=f(b)=bf(g(b))=f(b)=b

  • f(g(c))=f(c)=cf(g(c))=f(c)=c

For gofgof:

  • g(f(a))=g(c)=ag(f(a))=g(c)=a

  • g(f(b))=g(b)=bg(f(b))=g(b)=b

  • g(f(c))=g(a)=cg(f(c))=g(a)=c

Example 3: Let f:RRf:R\to R be a function defined by f(x)=x3f(x)=x^3, and g:RRg:R\to R be a function defined by g(x)=x1g(x)=x-1. Compute fogfog and gofgof and find if they are equal or not.

Solution:

fog=f(g(x))=f(x1)=(x1)3=x33x2+3x1fog=f(g(x))=f(x-1)=(x-1)^3=x^3-3x^2+3x-1

and,

gof=g(f(x))=g(x3)=x31gof=g(f(x))=g(x^3)=x^3-1

It is found that:

foggoffog\neq gof

Example 4: Let f(x)=3x+1f(x)=3x+1, and g(x)=x2g(x)=x^2. Find out fogfog, and gofgof.

Solution:

fog=f(g(x))=f(x2)=3x2+1fog=f(g(x))=f(x^2)=3x^2+1

and,

gof=g(f(x))=g(3x+1)=(3x+1)2=9x2+6x+1gof=g(f(x))=g(3x+1)=(3x+1)^2=9x^2+6x+1

Example 5: Let f(x)=3x2f(x)=3x^2. Find foffof.

Solution:

fof=f(f(x))=f(3x2)=3(3x2)2=27x4fof=f(f(x))=f(3x^2)=3(3x^2)^2=27x^4

Example 6: Let f(x)=xf(x)=x, g(x)=2xg(x)=2x, and h(x)=3xh(x)=3x. Find fogohfogoh, when x=1x=-1.

Solution:

fogoh=f(g(h(x)))=f(g(3x))=f(6x)=6xfogoh=f(g(h(x)))=f(g(3x))=f(6x)=6x

When, x=1x=-1

fogoh=6(1)=6\therefore fogoh=6(-1)=-6
Docs
AnanyaGB
About
© MIT - 2024