Showing posts with label what is a function?. Show all posts
Showing posts with label what is a function?. Show all posts

Monday, June 25, 2012

Learn types functions with examples



What is a Function?
The definition of function is as follows:
“Given two sets, an input set X and an output set Y, a function f from X to Y (f: X->Y) is a set of ordered pairs (x, y) formed using the function f. It is formed in such a way that for every x (input number) in domain X there is a unique y (output number) in co-domain Y. “F” represents the set of all ordered pairs so formed.”

Domain, Co-domain and Range of a Function
Domain is the set of all possible inputs to the function f and Co-domain is the set of all possible outputs to the function f. The set of all outputs that match the inputs in the domain as per the function f form the range or image of the function calculated by the equation y = f(x).  So, the image or range is usually a subset of co-domain.

Function Example
An example of a function will clearly answer the question: What is a function?
Function:  f(x) = 2x where x: R -> {1, 2}. “R” represents that x is a real number
From this we can calculate the output as shown below:
f(1) =  2(1) = 2
f(2) = 2(2) = 4

Thus, F = {(1, 2), (2, 4)}
Domain = 1, 2
Range = 2, 4
               
Types of Function
The different types of functions are:
• Injections or One-to-One Function: The one-to-one function is based on the property that:  “a” must equal “b” if f(a) is equal to f(b) denoted as f(a) = f(b).

• Surjections or Onto Function: In case of onto function, for each and every number y in the co-domain Y, there is an input x in Domain X formed by the function f where f(x) = y.

• Bijections: A function is said to be a bijective function if it is both one-to-one and onto.

• Inverse function: A function that is formed from co-domain to domain i.e., f: Y->X is termed as Inverse function. For instance, conversion of temperature from centigrade to fahrenheit and vice versa is an example of inverse function.

• Identity function: When every input x in domain X maps to itself, it is called Identity function. It is represented by the function y=f(x) = x. In such case X=Y. For example, f (1) = 1, f(2) = 2.