Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mathematics for Computing Lecture 8: Functions Dr Andrew Purkiss-Trew Cancer Research UK

Similar presentations


Presentation on theme: "Mathematics for Computing Lecture 8: Functions Dr Andrew Purkiss-Trew Cancer Research UK"— Presentation transcript:

1 Mathematics for Computing Lecture 8: Functions Dr Andrew Purkiss-Trew Cancer Research UK e-mail: a.purkiss@mail.cryst.bbk.ac.uk

2 Functions What is a function? Range and other rules Composite functions Inverse of function

3 Formula Functions relate two sets of numbers: Each x gives a value of y so in the first function, x = 2, gives y = 18. In the second function, x = 1, gives y = -1.

4 General form General form use f,g or h to represent function.

5 Functions and Sets Definition: For sets X and Y, A function from X to Y is a rule that assigns each element of X to a single element of Y X is the domain, Y is the codomain If is any element of X. Then each element of Y assigned to is called the image of and written

6 Example f xx2x2

7 Range If f :X  Y is a function then the range is { y  Y: y= f ( x ) for some or all x  X} Example The range of f is { y:y  0}

8 2 4 6 8 B 1 3 5 A Another example A = {1,3,5}, B={2,4,6,8} f :A  B, f (1)=2, f (3)=6, f (5)=2 The range of f = {2,6}

9 More definitions Onto A function is onto if its range is equal to its codomain. One-to-one A function is one-to-one if no two distinct elements of the domain have the same image.

10 Examples of definitions Not one-to-one Not onto One-to-one Not onto Not one-to-one Onto One-to-one Onto Not a function

11 Composite functions Composite function link two functions together Let A,B and C be arbitrary sets: f : A  B and g : B  C Input is { x:x  A} and output g ( f ( x ))  C f x g f(x)f(x) g(f ( x ))

12 Composite Functions 2 Formal definition Let f : A  B and g : B  C. The composite function of f and g is g o f : A  C, ( g o f )( x) = g ( f ( x ))

13 Composite Function Example f : R  R, f (x) = x 2 and g : R  R, g (x) = 2x + 1 f o g : R  R, ( f o g )( x) = f ( g ( x )) = f ( 2 x +1 ) =( 2 x +1 ) 2 g o f : R  R, ( g o f )( x) = g ( f ( x )) = g ( x 2 ) = 2 x 2 +1

14 Identity and Inverse Identity I:A  A, i( x )= x Inverse of a function is the function that ‘reverses’ the effect of the function. It is represented by f –1 for the function f

15 Inverse 2 Let f : A  B and g : B  A be functions If g o f : A  A is the identity function on A and if f o g : B  B is the identity function on B, then f is the inverse of g ( and g is the inverse of f )

16


Download ppt "Mathematics for Computing Lecture 8: Functions Dr Andrew Purkiss-Trew Cancer Research UK"

Similar presentations


Ads by Google