By:  Sandy Emerick

Functions and their Inverses

Brief Description:
This lesson allows the student to discover and use the Ordered Pair Test and the Vertical Line Test for functions.  The last part of the lesson deals with the graphing of the inverse.

Function and their Inverses

Initialization Cell

<<Graphics`Colors`
Off[General::Spell];
Off[General::Spell1];

A function is a set of ordered pairs that assigns to every element in the domain exactly one element in the range.
Recall: 
        the domain is the set of first coordinates 
        the range is the set of second coordinates

Function Tests

Ordered Pair Test for a Function

Using the definition of a function, can you determine if set A is a
function?

A = {{2,3}, {4,-5}, {-7,0}, {-3,-8}}

Observe that        2 is paired with  3
                   4 is paired with -5
                  -7 is paired with  0
                               -3 is paired with -8

These ordered pairs clearly satisify the definition of a function
since each first coordinate is paired with exactly one second coordinate.

Conclusion:  Set A is a function

Now, take a look at the set B.

B = {{2,3}, {4,5}, {-7,5}, {-3,-8}}

Do you think the set B represents a function?  (Don't forget to use the function definition)

Again observe that                2 is paired with  3
                                4 is paired with  5
                               -7 is paired with  5
                               -3 is paired with -8

Potential problem here!   4 and -7 are each paired with 5.

Actually, this is not a problem since each first coordinate has exactly one second coordinate assigned to it; and thus, satisifies the definition.

Conclusion: Set B is a function

Look at one more set of ordered pairs set C

C = {{2,3}, {2,5}, {-7,1}, {-3,-8}}

What do you think?  Does this set of ordered pairs satisify
the conditions given for a function?

Observe that       2 is paired with both 3 and 5
                  
                You need look no further!!!  The condition that each element in the domain have exactly one "partner" from the range is violated.  Hence, the conclusion -------

set C is not a function               

We have just used what is commonly known as the

                    ORDERED PAIR TEST

This test tells us whether a set of ordered pairs is a function.  You need only observe the first coordinatesof your ordered pairs. 
If you can find two ordered pairs with the same first coordinate, then the set does not represent a function.

Vertical Line Test for a Function

Let's look at the graph of each of the sets that we just examined.
Begin with set A.    

         A = {{2,3}, {4,-5}, {-7,0}, {-3,-8}}

code

seta = {{2,3}, {4,-5}, {-7,0}, {-3,-8}};
ListPlot[seta,
        AxesLabel->{x,y},
        AspectRatio->1,
        PlotStyle->{Blue, PointSize[0.05]}];

Recall that we decided earlier that this set was a function. 

Note:   nothing seems to be really unusual here.

Now take a look at set B.     
B = {{2,3}, {4,5}, {-7,5}, {-3,-8}}

setb = {{2,3}, {4,5}, {-7,5}, {-3,-8}};
ListPlot[setb,PlotStyle->{PointSize[0.05],Blue},
        AxesLabel->{x,y},
        AspectRatio->1];

Recall that this set was also a function. 
Again, nothing really unusual here.

We need to look at one more set, set C.  

        C = {{2,3}, {2,5}, {-7,1}, {-3,-8}}

setc = {{2,3}, {2,5}, {-7,1}, {-3,-8}};
ListPlot[setc,PlotStyle->{PointSize[0.05],Blue},
        AxesLabel->{x,y},
        AspectRatio->1];

Ahah!!!

Do you notice anything unusual about the position of these points? 
Check the other graphs again for a similar situation. 
This set of points differs from the two preceding graphs because two of these points lie on the same vertical line. 
Sure enough these were the two points, (2,3) and (2,5) that caused set C  not  to satisify the function definition.

Since the two points (2,3) and (2,5), which lie on the same vertical line, caused the definition of a function to fail, wouldn't it seem logical to conclude :
If you are testing a graph to determine if it is a function, then all you need do is to observe when a vertical line can be drawn through two (or more)  points on the graph.  If such a vertical line can be drawn then the graph is NOT a function.  On the other hand, if each possible vertical line can intersect in at most one point on the graph, then the graph is a function.  This is called

The Vertical Line Test

Before we use the VERTICAL LINE TEST  to determine if the following graphs are functions, maybe we should decide if a single vertical line is a function. 
What do you think?  (Hint: take a look at the graph of a vertical line)    Explain you decision.

Click in the next cell and enter to see the result.

code

Clear[f,x]
vert = Show[Graphics[{Blue,Thickness[.01],
Line[{{1,-20},{1,20}}]}],
Axes->True,AxesLabel->{"x","y"},
DisplayFunction->Identity];
vertpts = ListPlot[{{1,6},{1,-5},{1,1}},
           PlotStyle->{PointSize[0.03],Red},
           PlotRange->{{-2,5},{-2,5}},
           DisplayFunction->Identity];
Show[{vert,vertpts},
      Graphics[{Text["(1,6)",{1,6},{1,0}],
                Text["(1,-5)",{1,-5},{1,0}],
                Text["(1,1)",{1,1},{1,0}]}],
                DisplayFunction->$DisplayFunction];

Is a vertical line, itself, a function?  The answer is never!!  
Notice that every point on this line has the same first coordinate.    This clearly violates the definition of a function. 
                     Recall:  
A set of points is a function if every element of the domain is paired with exactly one element in the range ( i.e. each unique point has a different first coordinate ).

Do you think that the next graphic is a function?  Give a brief explanation to support your conclusion?

code

f[x_] = x^2;
para1 = Plot[f[x],{x,-3,3},PlotRange->{{-5,5},{-5,5}},
PlotStyle->{{Green,Thickness[.01]}}];

Have you made a decision? 
Is this an example of a function? 
Please support you decision with a small explanation.


If you need some help, take a look in the next graph.

code

Show[para1, vert];

Notice that a vertical line intersects the graph in exactly one point.  This agrees with the conditions for a function. 
Will this happen for any vertical line that you could choose?
Take a look.    Double click on the box to the right of the actual code

code

vertfunc[w_]:= Graphics[{Blue,Thickness[.01],
Line[{{w,-20},{w,20}}]}]
Do[Show[vertfunc[q], para1,
Axes->True,AxesLabel->{"x","y"},AspectRatio->1,
PlotRange->{{-2.1,2.1},{-4,4}}],{q,-2,2,.5}];

Select the above cells and press apply-y to animate.

This graph meets the criteria for the Vertical Line Test.  The graph is a function since any vertical line that we might choose will intersect the graph in no more than one point.

Check out the following graphs.  Are they functions?

code

Clear[x,av];
 
av[x_]:= N[Abs[x]]
 
absvalue= Plot[av[x],{x,-3,3},PlotRange->{{-5,5},{-3,3}},
Axes->True,AxesLabel->{"x","y"}, 
     PlotStyle->{{Thickness[0.01],Yellow}},
     PlotLabel->absolute value];

What do you think?  Is this a function?  If you need more evidence, double click on the box below

code

vertfunc[w_]:= Graphics[{Blue,Thickness[.01],
Line[{{w,-20},{w,20}}]}]
Do[Show[vertfunc[w], absvalue,
Axes->True,AxesLabel->{"x","y"},AspectRatio->1,
PlotRange->{{-3,3},{-3,3}}],{w,-2.5,2,.5}];

Sure enough, the graph passes the Vertical Line Test
This yellow graph is called the Absolute Value function

Let's look at another graph.  Is this representative of a function?

code

Clear[x]
vertfunc[w_]:= Graphics[{Blue,Thickness[.01],
Line[{{w,-20},{w,20}}]}]
circ = ParametricPlot[{Sin[x],Cos[x]},{x,0,2 Pi},
PlotStyle->{{Thickness[0.01],Green}},
                AspectRatio->Automatic];

Is the circle above a function?  Remember to use the vertical line test.
Click on the box if you want to see the vertical line 
along with the circle

code

Do[Show[vertfunc[w], circ,
Axes->True,AxesLabel->{"x","y"},AspectRatio->1,
PlotRange->{{-1.5,1.5},{-1.5,1.5}}],{w,-.5,1.5,.5}];

Notice that there exists at least one vertical that intersects the circle in more than one point.  This means that the vertical line fails; and therefore, the graph is not a function

																Therefore, a circle is not a function

Let's look at one more graph.  Is the following a function?  Explain

code

Clear[x] 
wave = Plot[Sin[x],{x,-2 Pi,2 Pi}, 
      PlotStyle->{{Thickness[0.01],Purple}},
      PlotLabel->sin];

I think that we have another function.  This curve certainly passes the Vertical Line Test. 
              In fact, this function is called the Sine Function

It's time to try something new.  Let's investigate inverses.

Inverses

A relation is defined to be any set of ordered pairs.  Remember that an inverse may be found by 
              1) interchanging the x and y values in your set of  
                 ordered pairs
        or      
              2) interchanging the x and y in your equation and then
                solving for that new "y"
              
Once we have found the inverse, we can then answer the following 
               1) is the original relation a function
               2) is the inverse a function

Look at the following relation.
Observe the following point  (2,3)  and its inverse point  (3,2)

code

Clear[a,inva,P]
P[x_,y_]:=Max[Abs[x],Abs[y]]+4
inva[x_,y_] := ListPlot[{{y,x}},
    AspectRatio->1,
    PlotStyle->{PointSize[0.03],Blue},
    PlotRange->{{-P[x,y],P[x,y]},{-P[x,y],P[x,y]}},
    DisplayFunction->Identity];
a[x_,y_]:= ListPlot[{{x,y}},
    AspectRatio->1,
    PlotStyle->{PointSize[0.03],Orange},
    PlotRange->{{-P[x,y],P[x,y]},{-P[x,y],P[x,y]}},
    Axes->True,AxesLabel->{"x","y"},AspectRatio->1,
    DisplayFunction->Identity];
    
    
sh[x_,y_]:=Show[inva[x,y],a[x,y],
           Axes->True,AxesLabel->{"x","y"},AspectRatio->1,       
           DisplayFunction->$DisplayFunction]

sh[-4,5];

If you want to see another point and its inverse highlight the next cell, and enter.

code

sh[2,3];

Look at the next picture.  What seems to be true about the
two points and the dashed line?

code

ident= Show[Graphics[{Dashing[{0.02,0.02}],
                     Line[{{-20,-20},{20,20}}]}],
            DisplayFunction->Identity];
Clear[a,inva,P]
P[x_,y_]:=Max[Abs[x],Abs[y]]+4
inva[x_,y_] := ListPlot[{{y,x}},
    AspectRatio->1,
    PlotStyle->{PointSize[0.03],Blue},
    PlotRange->{{-P[x,y],P[x,y]},{-P[x,y],P[x,y]}},
    DisplayFunction->Identity];
a[x_,y_]:= ListPlot[{{x,y}},
    AspectRatio->1,
    PlotStyle->{PointSize[0.03],Orange},
    PlotRange->{{-P[x,y],P[x,y]},{-P[x,y],P[x,y]}},
    DisplayFunction->Identity];
    
sh[x_,y_]:=Show[inva[x,y],a[x,y],ident,
          Axes->True,AxesLabel->{"x","y"},AspectRatio->1,
                DisplayFunction->$DisplayFunction]

sh[-3,4];

Try several different ordered pairs.  To experiment, just type your ordered pair in the [  ] that you see above the graph, and click in the
cell to your right.  (Be careful not to leave out the comma or the brackets) 
What is happening with these points in reference to the dotted line?

This is called reflection in the line. 
Do you have any idea what the equation of this line would have to be?

You might look at some of the ordered pairs for a clue.
i.e.  (2,3)->(3,2)
      (-3,4)->(-3,4)   Keep looking!!

Now let's observe several points and their inverses
Now notice graph of the set of inverse points 
                  A = {(1,2), (3,5), (-3,3)}
 The inverse of A = {(2,1), (5,3), (3,-3)}

code

Clear[a,inva]
apt = ListPlot[{{1,2},{3,5},{-3,3}},
    AspectRatio->1,
    PlotStyle->{PointSize[0.025],Orange},
    PlotRange->{{-7,7},{-7,7}},
    DisplayFunction->Identity];
invapt =  ListPlot[{{2,1},{5,3},{3,-3}},
    AspectRatio->1,
    PlotStyle->{PointSize[0.025],Blue},
    PlotRange->{{-7,7},{-7,7}},DisplayFunction->Identity];
Show[apt,invapt,ident,
Axes->True,AxesLabel->{"x","y"},AspectRatio->1,
DisplayFunction->$DisplayFunction];

There is definitely something going on here.

Continue with the lesson to see several points and their inverses

code

Clear[a,inva,P]
P[x_,y_]:=Max[Abs[x],Abs[y]]+4
inva[x_,y_] := ListPlot[{{y,x}},
    AspectRatio->1,
    PlotStyle->{PointSize[0.025],Blue},
    PlotRange->{{-P[x,y],P[x,y]},{-P[x,y],P[x,y]}},
    DisplayFunction->Identity];
a[x_,y_]:= ListPlot[{{x,y}},
    AspectRatio->1,
    PlotStyle->{PointSize[0.025],Orange},
    PlotRange->{{-P[x,y],P[x,y]},{-P[x,y],P[x,y]}},
    DisplayFunction->Identity];
    
Show[inva[2,3],a[2,3],inva[0,6],a[0,6],inva[1,5],a[1,5],
inva[1,4],a[1,4],inva[-2,5],a[-2,5],
         ident,
         Axes->True,AxesLabel->{"x","y"},AspectRatio->1,
         DisplayFunction->$DisplayFunction];

Do you see the reflection of each point in this line?  
(Some people think that the reflection of a set of points can also be accomplished by first rotating 180 degrees and then doing a flip.  
What do you think ?)
Getting back to business -- instead of graphing lots of points,  wouldn't it be more efficient to graph an entire equation and then reflect it in this magic line? 
Let's do it.

code

Clear[av]
 av[x_]:= N[Abs[x]]
 
absvalue= Plot[av[x],{x,-6,6},PlotRange->{{-5,5},{-3,3}}, 
     PlotStyle->{{Thickness[0.01],CornflowerBlue}},
     PlotLabel->absolute value];

The relation pictured is obviously a function if you apply the Vertical Line Test.  Let's look at the inverse.

code

inabsvalue= Plot[{-x,x},{x,0,6},
PlotRange->{{-4,4},{-4,4}},
     PlotStyle->{{Thickness[0.01],Yellow},
     {Thickness[0.01],Yellow}},
     AspectRatio->1,
     PlotLabel->inverse-absolute value];

Since this is a little difficult to observe, let's put these
graphics side by side

code

ident= Graphics[{Dashing[{0.02,0.02}],
                     Line[{{-20,-20},{20,20}}]}];
absvalue= Plot[av[x],{x,-4,4},PlotRange->{{-4,4},{-4,4}}, 
     PlotStyle->{{Thickness[0.01],CornflowerBlue}},
     AspectRatio->1,
     PlotLabel->absolute value,
            DisplayFunction->Identity];
inabsvalue= Plot[{-x,x},{x,0,6},
PlotRange->{{-4,4},{-4,4}},
     PlotStyle->{{Thickness[0.01],Yellow},
     {Thickness[0.01],Yellow}},
     AspectRatio->1,
     PlotLabel->inverse-absolute value,
            DisplayFunction->Identity];

GraphicsArray[
Show[absvalue,ident,
DisplayFunction->$DisplayFunction,
Axes->True],
Show[inabsvalue,ident,
DisplayFunction->$DisplayFunction,
Axes->True]
];

code

Show[GraphicsArray[{absvalue,inabsvalue}]];

Is the blue graph a function?  Can you support your decision?

Is the yellow graph a function?  Explain
We must conclude that inverses are not necessarily both functions!!!

Now, let's try a straight line and its inverse

code

Clear[f,x];
f[x_]:= -3 x + 6
linegrph= Plot[f[x], {x,-3,10},PlotRange->{{-4,4},{-4,4}},
           PlotStyle->{{Thickness[0.009],Green}},
           DisplayFunction->Identity];
g[x_] := -x/3 + 2
reflect= Plot[g[x],{x,-20,20},PlotRange->{{-4,4},{-4,4}},
             PlotStyle->{{Thickness[0.009]
                        ,Orange}},
             DisplayFunction->Identity];
Show[{reflect,linegrph},
      DisplayFunction->$DisplayFunction];

Do these two lines really reflect in our mystery line?

code

Show[{reflect,ident,linegrph},
      DisplayFunction->$DisplayFunction];

Notice that both of these lines pass the Vertical Line Test; and therefore, are both functions.  We say these are function inverses.

Just as expected, these two lines are inverses of each other.  A really useful idea here is  
    If you are graphing with "pencil and paper",  you can find the inverse of your graph by folding your graph paper at a 45 degree angle in the first quadrant  (the location of the dashed line) . 
By the way, I still do not know the name of the dashing mystery line.  Have you figured it out yet?  If you know, type the equation here.
_

 One last curve and its inverse to inspect.

code

Clear[f,x,incurve1];
f[x_]:= 3^x 
 curve1 = Plot[f[x], {x,-10,10},PlotRange->{{-4,4},{-4,4}},
           PlotStyle->{{Thickness[0.009],Green}},
           DisplayFunction->Identity];
g[x_] := Log[3,x]
incurve1 = Plot[g[x],{x,.000001,10},PlotRange->{{-4,4},{-4,4}},
             PlotStyle->{{Thickness[0.009],Magenta}},
             DisplayFunction->Identity];

ident= Show[Graphics[{Dashing[{0.02,0.02}],
                     Line[{{-20,-20},{20,20}}]}],
            DisplayFunction->Identity];

Show[{curve1,incurve1,ident},
      DisplayFunction->$DisplayFunction];

Are these curves inverses of each other?  Explain your reason.

Is the green curve a function?   Explain


Is the magenta curve a function?   Explain

The graph above is the graph of y = 3˛   and y =  log£ 	x .  These plots will be seen often in your advanced classes.   The green graph is called an Exponential Function, and the magenta graph is called a Log Function.  Since they reflect in our dotted line,  we can clearly see that they are inverses of each other.

One final note:  Since the magenta graph is a function, it has to pass the Vertical Line Test. 
Where would that vertical line be relocated if it were reflected along with the magenta line back into our green function?

The answer to that question will give us a New Test to use to check to see if the inverse of the original relation will be a function.

.

HOMEWORK ASSIGNMENT: 
Using pencil and paper:
1)  Draw a simple graph and then locate the graph of its inverse. 
    Determine if :
   a) the original is a function 
   b)     inverse is a function
2)  Draw some crazy graph and repeat the steps above