what is the function?
- A function is a rule that tells us how to convert an input into an output.
- So, for instance suppose we want a function that given an x returns as x2 , then this is one way to write the rule. The rule: x 7→ x2
- We write symbol which says x maps to x 2 ; given an x it is transformed to x 2 , but more conventionally we also give a name to the function.
- So, in this case we can call it square(x).
- So, square(x) takes a parameter x as input and it produces as output; some value which transforms this parameter, in this case x 2.
- So, we can plot x versus x 2 by putting all the points where the second coordinate is the function value of the first coordinate.
- So, if we look at x 2 for instance, it forms this up you know inverted parabola shape
- And notice that because for instance 2 2 is the same as (-2)2 , there is a symmetry about the y axis.
- So, for instance 2 2 is the same as (-2)2 , and 3 2 would be the same as (-3)2 and so on.
Domain
- when we define a function, we have to be careful about specifying what set we take the input from and what sets the output produces.
- the input set is called the domain.
- So, for instance the domain of square as we have defined it above is a set of reals, so we can take the square of any real number.
- Now the output when we apply square, we know that it is going to be a real number; so the codomain as it is called is the output set of possible values is called the codomain, in this case is the reals.
- But of course, we know that when we square a number; even if the input is negative, the output is going to be positive.
Range
- So, even though the codomain is a set of all reals, we cannot get all reals as output of the square function.
- So, there is a separate name for that called the range.
- So, the range of a function is a subset of the codomain; the range tells us what values the function can actually take.
- So, in this case the range of the square function is the non-negative reals.
- So, this is all real numbers greater than equal to 0 which is sometimes written like this and if you want to explicitly write it out; it is the set of all r in the set of reals such that r >= 0.
- range(sq) = R≥0 = {r | r ∈ R,r ≥ 0}
Notation For The Function
- f : X → Y , domain of f is X, codomain is Y
- So, in order to specify a function abstractly and describe its domain and codomain, we usually write that f which is the name that we give to an arbitrary function is a function from X the domain to Y the codomain.
- So, this notation f : X to Y tells us without telling us what the function is actually doing; it tells us on what sets it operates, what is the input set and what is the output set.
Functions And Relations
- The close connection between functions and relations is that we can associate with every function f a relation Rf
; and Rf is merely all the pairs of inputs and outputs that the function allows. - Rsq = {(x, y) | x, y ∈ R, y = x 2}
- So, for example, with our square functions sq we have Rsqas all pairs (x,y), such that y is equal to x2 .
- So, this is actually sometimes simplified by saying y is equal to x2.
- So, we do not write out f(x) and then say f(x) is y; we just directly say y is equal to x 2 to denote that the output is the square of the input.
- So, this is an implicit notation, where we are implicitly naming the output for each x as y.
- So, notice that if we talk about it as a relation; remember that a relation is a subset of the Cartesian product of two sets.
- So, in this case, the Cartesian product is formed by the domain of the function and the range of the function, and then the relation is a subset of the domain X the range.
what are properties of this relation?
- the function is defined at every possible value in that domain.
- So, for every x and domain of the function f, there must be a valid value f(x); so there must be a y such that (x, y) belongs to the relation Rf .
- For each x ∈ domain(f ), there is a pair (x, y) ∈ Rf
- The other property is that this is a rule for producing an output from an input; so there can be no confusion about what the output is.
- For each x ∈ domain(f ), there is exactly one y ∈ codomain(f ) such that (x, y) ∈ Rf
- So, for each x that we feed in as a domain value to the function, there must be as exactly one output value f(x) that we get out.
- So, there is only one y in the codomain, such that (x,y) belongs to Rf.
- a graph of a function as have parabola, we are actually drawing all the points which satisfy the relation Rf .
- So, plotting a graph is the same for functions and relations; because implicitly we are plotting the relation that corresponds to a given function.
Lines
- mx + c, then this defines a line.
- So, then the like we see a line 3.5x + 5.7.
- the quantity which multiplies x is called the slope and it determines the angle at which the line goes; and the other quantity which is without x determines the intercept.
- So, notice that if you set x = 0, then the first term goes to 0; this gets cancelled out, if x is 0.
- 3.5 is the slope
- 5.7 is intercept where the line crosses the y=axis, whe x = 0
- So, the answer will be 5.7.
- So, when x is 0, you get 5.7.
- So, what the second term tells us is where this line crosses the y axis.
- So, if we change these two values, we get different lines. So, for instance if we change the intercept and keep the slope the same; then we get a line which has the same slope it is parallel, it is at the same angle.
- But now the intercept is -1.2; so it crosses the y axis lower, so the whole line is shifted to the right.
- On the other hand if we keep the intercept the same; but we change the slope, we get a different slanted line. So, here we have reduced the slope from 3.5 to 2; so it is a shallower line and the green line passes through exactly the same point 5.7 as the previous one, but it has a shallower slope.
- And we can change both and in fact, we can put a negative slope; so if you have a negative slope, it comes down rather than going up,
- And notice that it crosses at 2.5, so that is the intercept.
- So, by changing the values of the slope and the intercept, we get many different lines and many different functions.
- And for all of these functions that we have defined the domain is the set of reals, the codomain is the set of reals; but also because we can intuitively see that the line goes from way down -∞ to way up +∞ whether it is going up or down, it can take all values in the real.
- So, not only is the codomain equal to R, it is also the range.
More Functions
- So, here is another function x maps to √x.
- x → √x
- The first question is, is this a function?
- So, remember that for a function, we need it to be defined on every input value and we also needed to have a unique output.
- So, remember that when we square a negative number, we get the same as when we square the positive version; so 52 and (-5)2 are both 25.
- So, technically if we take √25, we cannot determine whether we are talking about +5 or -5.
- So, when we write √x as a function, our convention is that we are taking the positive square root.
- So, the function on the right plots the positive square root; if we were to take the negative square root, then it would be a symmetric curve going below.
- And now if we take both these together, then this is not a function; because if we take any x value, we have two possible outputs for this which is not allowed.
- So, we are taking by convention the positive square root.
what is the domain of this function?
- Well it depends on what we allow the codomain to be.
- We have seen that negative numbers cannot have real square roots; no real number can multiply itself to produce a negative number, because of the law of signs for multiplication.
- So, if we insist that the output should be a real number, then the domain of this function, the function can only be defined when the input is not negative.
- So, we have this set which we defined before; the set of reals bigger than or equal to 0.
- On the other hand, if we move to the set of complex numbers; the set of complex numbers includes √-1 and implicitly through that the square root of all negative numbers.
- So, once we allow complex numbers as the output of our function, then we can define square root on all the real numbers.
- So, the notion of domain and range is kind of flexible depending on how we are going to use the function.
- So, we have to be very clear when we are using a function what context we are using it in.
Types of Functions
1.Injective
- It means is; if I give you different inputs, does the function always produce different outputs?
- If x1 6= x2, f (x1) 6= f (x2)
- So, if we look at the linear function that we saw before the line, then we can see that it is injective; because if we change x, we move along the line to a new point.
- So, no two x points, point to the same y point; so therefore, this is an injective function.
- If on the other hand, we take a parabola as function which of the other form something squared, so 7x 2
for instance. - Then we already saw that f(a) is the same as f (-a), so there will be two points; the plus version and the minus version, both of which has the same output.
- So, it is not the case that distinct outputs produce distinct, inputs produce distinct outputs; so the square function is not injective.
2.Surjective
- On the other side we talked about the distinction between the codomain and the range; we said that the codomain is the set of values into which the function produces answers, but the range is the actual set of values of the functions can take.
- all values in the codomain are actually touched by the
function and this is called surjectivity or onto - So, the range of a surjective function is in fact equal to the codomain, which says that for every y which is in the possible codomain of f; there is actually an x in the domain of f, such that f (x) = y.
- the domain codomain is a set of all reals, but the actual range is only if the reals which are bigger than or equal to 3. Similarly if I take this 7√x function, then we know that even if we take the codomain to be R; so we only take square roots of positive numbers.
- We know that we will never get a negative answer, because by convention we have taken positive square roots.
- So, this is again not a surjective function.
3. Bijective
- So, if you combine these two, you get something called a bijective function.
- So, a bijective function is something with where there is a one to one correspondence between the domain
and the codomain. - So, every x in the domain maps to a distinct y in the codomain and every y in the codomain has a unique x that maps to it.
- So, from the statement it looks clear that this corresponds to injectivity and surjectivity. So, actually this is the theorem that a function is bijectuve if and
only if it is both injective and surjective. - Now this may look obvious, but actually only one direction is obvious, from the definition,
we can see that if a function is bijective; it must be injective, because it says every x maps to a distinct y, so no two x will map to the same y. - It also says it is surjective, because it says every y in the codomain has a unique pre image.
- So, supposing a function is injective and surjective, we have to show that it is bijective.
- So, for this, we have to guarantee first that every x maps to unique y; but this is guaranteed because the function is injective, injectivity says if I have two inputs x1and x2 which are not the same, f (x1 ≠ f (x2 ).
- So, surjectivity says that everything in the output comes from some input not necessarily unique; but if two things map to the same output right, if two things map to the same output, if I have a y such that I have x1and x2mapping to the same y.
- So, if it has even, if a surjective function if the output has two pre images; then these two pre images do not satisfy injectivity.
- So, if I combine surjectivity in the presence of njectivity, I know that the pre image is unique; and therefore these two conditions guarantee that I have a bijection.
Bijections and cardinality
- So, an important use of bijection is to count the items in a set.
- So, remember we said that the cardinality of a set is the number of items and if you have a finite set, we can count them.
- Now supposing somebody gives you two large sacks filled with marbles or balls and ask you to check whether the two sacks have the same number of balls each.
- So, think of these sacks as sets and these balls are a large number of elements.
- Now, you could of course, count the marbles in each sack, but this is a bit tedious; because we know that as we are keeping track of these small objects, we often lose count or miss count or add one or plus one.
- So, at the end, we have to be doubly sure that we have counted correctly, so we will count it a number of times.
- So, counting the marbles in each sack and then checking if the two counts are equal is a tedious process and it is error prone, if we do it manually.
- Now, here is a manual process which is less error prone.
- Supposing we put our hand into each sack and pull out a marble from each sack and put it away somewhere; then we put our hands again in and take out one marble each again and put it away somewhere.
- So, with each move, we are taking out one marble from each sack.
- So, what can we say; well if the two marbles sacks get empty together, then we pulled out one from each.
- So, we have actually established that there is a one to one correspondence between the marbles in the first sack and the marble in the second sack.
- If on the other hand when we find one sack is empty and the other sack is not empty; this means that up to this point, we pulled out an equal number of marbles from both sacks and now one sack has extra marble, so they were not equal.
- So, in this way establishing a bijection is equivalent to saying that two sets have the same cardinality.
- So, for finite sets this is a convenience; but for infinite sets this is the only way in order to establish that the cardinality is the same.
For Infinte sets
- So, for instance supposing we want to know whether the number of lines that we can draw is the same as the number of points on this plane R X R .
- So, R X R is a set of all points that you can draw on this plane and the number of lines we can draw is a number of such straight lines that we can draw
- Now it may not seem obvious how to argue this one way or another; but remember that we said that every line can be represented by a function of the form mx + c.
- And we also said that if you change m, you get a new line and if you change c, you get a new line.
- So, m and c together uniquely define a line.
- So, since m and c together uniquely define line; every pair (m, c) defines a line and every line defines a pair (m, c), so there is a one to one bijection between the lines and the pairs of points on this plane. So, actually the number of lines is the same as R X R.
- So, think about it, because this may not be obvious at first sight; but by establishing a bijection in this way, we can say that the number of lines that we can draw on a plane are equal to the number of points on a plane.
- if we take any two points right, if we take two points say x1andx2 , we can draw a unique line passing through these points.
- So, this is a well known fact from geometry.
- So, we know that the number of lines has the same cardinality as R X R that is what we claimed in the previous argument.
Summary
So, to summarize a function gives us a rule to map inputs to outputs. And with each function
we have to specify three sets; we have to specify the domain, so the function must be defined
on every set in the element of the domain set, the codomain what are the output elements
supposed to look like and the range which was actually the output assumed by the function
once we applied.
So, not all elements in a codomain may actually be attainable by the function; the range is
those elements which you can reach through the function. With each function we can
associate a binary relation consisting of all pairs (x , y), such that y = f (x). Then we saw
some interesting properties that we would like to prove for functions in order to make use of
them; one is injectivity that is every pair of distinct inputs produces distinct outputs, so this is
one is to one. And surjectivity which says actually that the codomain and the range match;
everything that I could possibly generate, can in fact be generated by applying the function.
Then we saw that a bijection combines these two. So, a bijection gives us something which is
an injection and a surjection; something that is one to one and onto. And once we have a
bijection between two sets, we can actually argue that the two sets have the same cardinality
and this is often the only way to prove that two infinite sets have the same cardinality.