Functions A function is a special type of relation. In particular, here are the rules for a relation to be a function, for an arbitrary relation R A x B : For each element in a A, we must have EXACTLY 1 element in R such that a is the first term of the ordered pair. In English

presenterawfulΗλεκτρονική - Συσκευές

10 Οκτ 2013 (πριν από 4 χρόνια και 1 μήνα)

115 εμφανίσεις

Functions


A function is a special type of relation. In particular, here are
the rules for a relation to be a function, for an arbitrary
relation R


A⁸ 䈠B


䙯爠敡捨c敬em敮琠楮ia


䄬Aw攠m畳u 桡v攠䕘A䍔CY 1 敬eme湴n
楮i删獵捨s瑨慴a i猠瑨攠晩牳琠瑥m f 
桥h牤r牥搠灡楲i 䥮I䕮E汩獨
瑨慴m敡湳n景爠敡捨c敬em敮琠楮i瑨攠獥琠䄠楴iM啓吠䉅 牥污瑥搠瑯
數a捴汹湥⁥汥me湴n楮i瑨⁳整 B.


乯瑥瑨慴瑨楳mea湳nwe m畳琠桡v攠籁|


籂簮 呹灩捡l汹Ⱐw攠ca汬
瑨攠獥琠A⁴桥⁤ 浡楮⁡湤⁴桥⁳整 B 瑨攠捯
-
摯ma楮i


䥴I楳i灯獳楢汥i
瑨慴 a汬l映瑨攠灯獳楢汥 va汵敳l映昨a⤠⡷桥渠a


䄩A
景fm 湬n a 灲pp敲e獵扳整 映B⸠T桵猠瑨 獥s 映灯s獩扬攠va汵敳l
映瑨攠晵湣瑩潮Ⱐ桩捨⁣慮⁢攠m牥r景fma汬l⁷物瑴敮ea猠景汬潷猺


昨A⤠㴠{⁦⡡⤠簠a


䄠素楳Ak湯w渠慳⁴桥⁲慮h攠潦e瑨攠晵湣瑩潮n


H敲e⁩猠慮

數amp汥映愠l畮捴楯u›


䱥琠Lh攠獥e⁁ =⁻⁴桥⁳整h映w牤猠楮⁴桥⁅湧汩獨l湧畡g攠e

䙯爠F汬⁡l


䄬A敦e湥⁦⡡⤠a猠景汬sw猺


昨a⤠=⁴桥 m扥r映汥瑴敲猠 渠nh攠e牤⁡r


周畳Ⱐw攠桡v攠瑨慴瑨 摯ma楮 楳i瑨攠獥琠f a汬l䕮E汩獨lw牤猬
瑨攠捯
-
摯ma楮i楳i桥h
獥琠映a汬l灯獩瑩s攠楮瑥来牳Ⱐa湤n桥h牡湧攠楳i
a汬l 灯獩瑩s攠 楮瑥来牳 汥獳 瑨a渠 29Ⱐ ⡡(獵s楮i 瑨慴
a湴楤楳敳瑡扬楳b浥湴m物r湩nm 楳i瑨 汯湧敳琠w牤r楮i桥h䕮E汩獨l
污湧畡g攩e



However, recall the relation I showed you
in an e
arlier

lecture
:


Cocktails = {(Orange Juice, V
odka), (Cranberry Juice, Vodka),




(Coke, Rum), (Orange Juice, Peach Schnapps) }


This is not a function because Orange Juice is related to more
than one element of the range.


Note that you can define functions on multiple sets, just as you
can defin
e relations on multiple sets. Consider the following:
f(a,b) = a+b.


This is a function of two real number variables. Notice that
different ordered pairs of this function map to the same
element in the domain. For example, f(2,3) = f(4,1).


We have alrea
dy talked about composing relations together.
Now we will introduce function composition.


Consider the following example, which uses the first function
from this lecture:


f(a) = the number of letters in the word a.

g(b) = the sum of the digits in the int
eger b.


Consider inputting the output from f(a) into the function g.
Pictorially, we get something like this:









Composing Functions produces a function


Let f: A


䈠a湤ng㨠䈠


䌠扥b瑷 晵湣瑩潮⸠ 周T cm灯獩瑩s渠
映映a湤ng a猠牥污瑩潮 摥晩湥猠a f
u湣瑩潮ng


映㨠䄠


䌬C獵捨s
瑨慴⁧


f
a⤠=⁧⡦⡡⤩(


坥W湥n搠瑯t獨sw 瑨慴t景爠敡捨 敬em敮琠a


䄬 瑨攠數灲敳p楯渠
⡯爠景fmu污⤠g⡦⡡⤩ a獳楧湳n瑨攠畮楱略u敬em敮琠映䌠牥污瑥搠瑯a
扡獥搠渠瑨攠捯m灯獩瑩s渠映映a湤ng 捯湳楤敲敤na猠牥污瑩潮⸠ 䉹
瑨攠摥晩湩
楯渠潦⁲敬e瑩潮⁣m灯獩瑩測





映㴠{⡡Ⱐ挩c簠a











(




䈠簠⡡Ⱐ戩b





⡢( c⤠


g⥽.


Hw敶敲Ⱐ⡡Ⱐ戩b


映m敡湳n戠㴠映⡡⤠畳楮u 瑨攠晵湣f楯渠湯瑡瑩測n
a湤n⡢( c⤠


g mea湳n挠㴠g⡢( 批 桥h晵湣瑩潮湯瑡楯渮n 周畳,
瑨攠牥污瑩潮g


映捯湴
a楮猠灡楲猠 ⡡Ⱐ挩cw楴栠a


䄠a湤n挠


䌬C
獵捨s 瑨慴 挠 㴠 g⡢( 㴠 g⡦⡡⤩( 批 獵扳瑩u瑩潮⸠ 䙵牴桥hⰠ 瑨楳
敬em敮e 挠瑨慴楳 牥污瑥搠瑯敬emen琠a v楡 瑨攠捯m灯獥搠牥污瑩潮



映楳i畮楱略㬠瑨畳Ⱐ瑨攠牥污瑩潮tg


映摥晩湥猠a 晵湣瑩潮tg


映:






䍯湳楤n
爠a渠數am灬p 晲fm ma瑨捬c獳⸠䱥琠昨x) 㴠x
3

and g(x) =
2x


1. We have the following function compositions :


f


g⡸⤠(

昨g⡸(⤠=⁦⠲(


1) = (2x


1)
3

g


昨x⤠=

g(昨x)⤠=⁧⡸
3
) = 2x
3



1


As can be seen from this example, typically, f(g(x))


g⡦⡸()





Injection, Surjection and Bijection


These definitions are often confusing, but I think some pictures
will help...



A function f is injective, or is one
-
to
-
one, if for all a, b


䄬Aa





f⡡⤠


f⡢(. 䕱畩va汥湴汹Ⱐ瑨楳im敡湳n楦 昨a⤠㴠昨戩b桥渠a =
戮b 坥⁡汳⁳ y⁦⁩猠s渠楮n散瑩潮⁩⁴桩猠捡獥s



映楳i獵牪散瑩癥Ⱐr 楳i湴漬n楦 昨䄩 㴠B⸠ 周T 楳Ⱐi映景f 敶敲礠戠



瑨敲 數楳瑳i a


䄠 獵捨 瑨琠 f⡡⤠ 㴠 b⸠ 坥W a汳l 獡y 映 楳i a
獵牪散s楯n⁩渠瑨楳捡獥s


映楳i扩橥b瑩癥楦i楴ii猠扯瑨楮橥i瑩癥a湤n獵牪散
楶攮e W攠a汳l 獡y 映
楳⁡⁢楪散瑩潮⁩渠瑨楳⁣i獥s


䍯湳楤敲⁴n敳攠煵敳瑩e湳›


䥳 瑨攠晵湣f楯渠昨x⤠㴠x
2

injective, where the domain and co
-
domain are all real numbers?


Is the function f(x) = sin x surjective, where the co
-
domain is
the set of real numbers

in the interval [
-
1,1].


Is the function f(x) = x
3

a bijection?


Consider functions
f
:
A


B

and
g
:
B


C
, and the
composition
g


f

:
A


C
.


(a) If both f and g are injective, then g


映楳⁩湪散瑩癥t

⡢(⁉映扯瑨⁦⁡湤⁧⁡牥⁳畲r散瑩癥e⁴h敮⁧e


映楳⁳
牪r捴cv攮

⡣(⁉映扯瑨⁦⁡湤⁧⁡牥⁢楪散瑩癥e⁴桥渠朠


映楳⁢楪散瑩癥t



To prove g


映楳⁩湪散n楶eⰠw攠湥敤e瑯⁰牯v攠e桡t⁦o爠aⰠ戠


䄬A



楦ig


映⡡⤠㴠朠


映(戩b瑨敮⁡‽e戬b批 t桥⁤敦i湩瑩潮f⁩ 橥捴楯渮†


g⡦⡡⤩‽⁧ 昨戩)


卩湣攠g 楳i 楮橥捴iv攬e瑨t
琠m敡湳n景爠瑨敳攠瑷o 瑯t 扥 敱畡氬l we
m畳琠桡v攠e⡡⤠㴠f⡢(.


How敶敲Ⱐw攠a汳o k湯w 瑨慴t 映楳 楮橥i瑩癥Ⱐt桵猬ht桩猠im灬楥猠
瑨慴⁡t戮



Inverse Functions


A bijection
f
:
A



m
a灳p 敡c栠 敬em敮琠 映

 a 畮楱略u
敬em敮琠f
B
Ⱐan搠捯湶敲獥汹Ⱐ敡c栠敬em敮琠映

ha猠a 畮楱略u
敬em敮e 映
A

a猠楴猠灲p
-
imag攮 周T 景汬fw楮g 瑨敯牥m ma步猠a
灲散楳攠獴p瑥m敮琠映瑨楳⁲敬e瑩潮桩瀮


䱥琠
f




B

扥 a 扩橥捴楯n⸠ 周敮e瑨攠
i湶敲獥e牥污瑩潮


f

摥晩湥搠晲fm
B



a猠{(
b

a
⤠簠
b




a湤n
a



A
Ⱐa湤n
f

(
a
⤠㴠
b
}Ⱐ
楳ia 晵湣f楯渠晲潭
B

瑯
A

獵捨s瑨慴



f
(
a
⤠㴠
a

景爠a汬l
a



A

a湤n



g
(
b
⤠=
b

景爠a汬l
b



B
⸠ 周攠晵f捴楯渠
g

楳 捡汬敤l瑨
楮i敲獥⁦畮捴楯c

映
f
,⁤敮潴敤e
f

1
.


Note that since
f
:
A


B

楳ia 扩橥捴楯測c景爠敡捨c
b




瑨敲攠
數楳瑳i湥na湤n湬n 湥n敬em敮琠
a



A
Ⱐ獵捨s瑨慴
f

(
a
⤠㴠
b
⸠.
周畳Ⱐ瑨攠r敬e瑩潮晲fm
B

瑯
A
Ⱐre污瑩湧
b




瑯楴猠灲p
-
imag攠
a



A

畮摥爠
f
,

楳ia 晵湣f楯渠批 瑨攠摥晩湩楯渠映晵fc瑩潮⸠ 周T琠
楳Ⱐi攠桡e攠摥e楮i搠愠晵湣
瑩潮


g
:
B


A

獵捨c瑨a琠景爠
b



B

g
(
b
) 㴠

楦i
f

(
a
⤠㴠
b






f

(
a
⤠=
g
(
f
(
a
⤩,

††† † †
=⁧⡢


††

a
.






g
(
b
⤠㴠
f
(
g
(
b


††† † †
=⁦⡡)


††
=⁢






Let
f
:
A


B

a湤
g




A

扥b瑷 晵湣瑩潮⸠ 䥦



f
(
a
⤠=
a

景爠
a汬l
a



A
Ⱐa湤n



g
(
b
⤠㴠
b

景爠a汬l
b



B
Ⱐ瑨敮扯瑨
f

a湤n
g

a牥
扩橥捴楯湳n a湤n瑨敹 a牥r楮i敲獥e晵湣瑩潮n 映敡捨c桥爬h桡琠楳,
g


f

1
and
f

=
g

1
.


First, we will show that if
g


f
(
a
⤠=
a
Ⱐ景爠f汬l
a



A

a湤†



g
(
b


b
Ⱐ景爠f汬l
b



䈬B
瑨敮
f

楳⁡⁢ 橥j瑩潮⁡湤n
g


f

1


We first prove that
f

is an injection. That is, suppose
f
(
a
) =
f
(
a
’), for
a
,
a



A
, we want to prove that
a
=
a
’.


Using function
g,


g
(
f
(
a
)) =
g
(
f
(
a’
)), because
g

is a function.

Thus,
a
=
a
’ because
g
(
f
(
a
)) =
a

and
g
(
f
(
a’
)) =
a
’.


We then prov
e that
f

is a surjection; that is, we prove that for
each
b



B
Ⱐ瑨敲 數楳瑳i
a



A

獵捨s瑨慴
f
(
a
⤠=
b



Let
a

=
g
(
b
). Then,
f
(
a
) =
f
(
g
(
b
)) =
b
.


We now prove that
g

=
f

1
. Consider an arbitrary
a



A
⸠ If
f
(
a
⤠ 㴠



B
Ⱐ 瑨敮 a捣潲摩湧 瑯 ⠱⤬(
g
(
b
⤠ 㴠
g
(
f
(
a
)⤠ 㴠
a
⸠.
䍯湶敲獥汹Ⱐ景爠 a渠 a牢楴牡特
b



B
Ⱐ楦i
g
(
b
⤠㴠
a
Ⱐ桥渠
f
(
a
⤠=
f
(
g
(
b
)⤠㴠
b
⸠ 周畳, 瑨楳 im灬楥猠瑨慴
g
(
b
⤠㴠

i晦
f
(
a
⤠=
b
㬠桵猬h
g


f

1
.

By the symmetry between
f

and
g
, we can similarly prove
that
g

is a bijection and
f

=
g

1
. Thus, the theorem is proved.




When two functions
f
:
A


B

an搠
g




A

a牥r楮i敲獥猠f
敡捨c瑨敲 w攠hav攠瑨攠牥污瑩潮桩瀠



f
(
a
⤠㴠
a

景爠a汬l
a



A

爬r 敱畩ea汥湴汹l



f


I
A
, where
I
A

denotes the
identity
function

defined on
A

(i.e.,
I
A

(
a
) =
a

for all
a



A
⤮ 卩m楬i牬rⰠ
w攠桡e攠



g‽
I
B
, the
identity function

defined on
B
.


Computing the inverse of a mathematical function



There is a simple way to c
ompute inverses of mathematical
functions. Whenever you have
a function such as


y = f(x) = 2x + 1,


Place an x where ever you see a y, and a y where ever you see a
x. Then, solve for y as follows:


y = 2x + 1


Inverse function is


x = 2y + 1

2y = x


1

y = (x


1)/2.

Computing the inverse of a function composition


If
f
:
A


B

and
g
:
B


C
are two bijections.

Then (
g


f

)

1

=
f

1



g

1
.


Since both
f

and
g

are bijections,

g


f

is also a bijection and its
inverse exists. To prove (
g


f

)

1

=
f

1



g

1
, it suffices to prove
that




(
g


f

)


(
f

1



g

1
) =
I
C


and (
f

1



g

1
)


(
g


f

) =
I
A




(
g


f

)


(
f

1



g

1
) = ((
g


f

)


f

1
)


g

1
,




= (
g


(
f



f

1
))


g

1
, associative




= (
g


I
B
)


g

1



=
g



g

1

, defn. of identity


=
I
C
,


Let f(x) = 2x+1 and g(x)=3x+4 and the domains and ranges for
both function are the real numbers. So,
we can compute

f


1
(x) = (x


1)/2

g


1
(x) = (x


4)/3


If we want to find (
g


f

)
-
1
, we can compute it as f
-
1


g

1
(x) =



f
-
1
(g

1
(x)) = f
-
1
((x


4)/3) = ((x


4)/3


1)/2


= (x


4)/6


3/6


= (x


7)/6



If
A

and
B

are two finite
sets, we can make the following
claims:


If there is a injection
f
:
A


B
, then |
A
|


|
B
|

If there is a surjection
g
:
A


B
, then |
A
|


|
B
|

If there is a bijection
h
:
A


B
, then |
A
| = |
B
|.


If
f
:
A


B
is an injection, and if we enumerate the elements o
f
A

as
A

= {
a
1
,
a
2
, …,
a
n
}, where
n

= |
A
|, then the images
f
(
a
1
),
f
(
a
2
), …,
f
(
a
n
), are mutually distinct because
f

is one
-
to
-
one.
Thus, |
B
|


n

because
B

contains these
n

elements.



Similarly, if
g
:
A


B

is a surjection, and if we enumerate the
eleme
nts of
B

as
B

= {
b
1
,
b
2
, …,
b
m
}, then
A

must contain the
pre
-
images of the elements of
B
. Suppose we use the notations
a
1
,
a
2
, …,
a
m

to denote, respectively, the pre
-
images of
b
1
,
b
2
, …,
b
m
;

thus,

g
(
a
i
) =
b
i

for 1


i



m
. Since
g

is a function, the
ele
ments
a
1
,
a
2
, …,
a
m

must be mutually distinct (i.e., if
a
i
=


a
j
for some
i


j
, then
b
i
=

g(
a
i
)

=

g(
a
j
)

= b
j
, a contradiction).
Therefore, |
A
|


m

= |
B
|.