A22-FunctionsGraphs.mws

High School Modules > Algebra by Gregory A. Moore

    Functions & Graphs


The connection between functions and their graphs, the graphs of common functions, and the horizontal line test for function-hood.

[Directions : Execute the Code Resource section first. Although there will be no output immediately, these definitions are used later in this worksheet.]

0. Code

>    restart; with(plots):

Warning, the name changecoords has been redefined

1. Functions & Graphs


Functions can be expressed as graphs too. For each value of x, there is a value of f(x). If we let y = f(x), we have a point (x,y). If we graph all of these points, we have a "picture" of what the function looks like. The graph of a function tells us many thing about the relationship between x and y.

>    f := x -> x^3 - 20*x^2 + 100*x - 40;
plot( f(x), x = -3..18, y = -120..120, thickness = 2, color = green);

f := proc (x) options operator, arrow; x^3-20*x^2+100*x-40 end proc

[Maple Plot]


Functions can take many different forms. Some of these functions are beyond the scope of your algebra class, but you can just back and enjoy the scenery for a moment. You don't have to be a chef to enjoy a great meal.

>    f := x -> sqrt( abs(sin(x) + cos(x) )):
plot( f(x), x = 0..4*Pi, y = 0..1.3, thickness = 2, color = gold);

[Maple Plot]

>    f := x -> exp( x - 3*sqrt(x)*sin(x) ) - exp( x + 3*sqrt(x)*cos(x) );
plot( f(x), x = 0..3,  thickness = 2, color = magenta);

f := proc (x) options operator, arrow; exp(x-3*sqrt(x)*sin(x))-exp(x+3*sqrt(x)*cos(x)) end proc

[Maple Plot]

>    f := x -> floor(1 + sin(8*x)) * x;
plot( f(x), x = 0..10,  thickness = 2, color = aquamarine, discont = true);

f := proc (x) options operator, arrow; floor(1+sin(8*x))*x end proc

[Maple Plot]

>    f := x -> sin( exp(1/cos(x)) );
plot( f(x), x = 0..3,  thickness = 1, color = green);

f := proc (x) options operator, arrow; sin(exp(1/cos(x))) end proc

[Maple Plot]

>    restart: with(plots):

Warning, the name changecoords has been redefined

>    f := x -> floor( 5*tan(x) );
plot( f(x), x = 0..2*Pi, y = -10..10,
             thickness = 3, color = tan, discont = true);

f := proc (x) options operator, arrow; floor(5*tan(x)) end proc

[Maple Plot]

>    f := x -> sqrt( x + abs(sin(x) - cos(x) ));
plot( f(x), x = 0..10*Pi, y = 0..6, thickness = 2, color = blue);

f := proc (x) options operator, arrow; sqrt(x+abs(sin(x)-cos(x))) end proc

[Maple Plot]

>    f := x -> exp( x/3 ) + x*(1 + sin(x))*cos(x^1.5);
plot( f(x), x = 0..10,  thickness = 2, color = sienna);

f := proc (x) options operator, arrow; exp(1/3*x)+x*(1+sin(x))*cos(x^1.5) end proc

[Maple Plot]

>    f := x -> abs(x) - abs(x-3) + abs(x-5) - abs(x-9);
plot( f(x), x = -5..14,  thickness = 2, color = orange, discont = true);

f := proc (x) options operator, arrow; abs(x)-abs(x-3)+abs(x-5)-abs(x-9) end proc

[Maple Plot]

>   

2. Common Functions


Lets examine some of the garden variety functions we'll find sprouting up in the text.

>    restart:

>    f := x -> 3*x - 4;  plot( f(x), x = -3..3,
                        title="(non vertical) lines are functions too!");

f := proc (x) options operator, arrow; 3*x-4 end proc

[Maple Plot]

>    f := x -> x^2;  plot( f(x), x = -3..3, title="Classic Parabola");

f := proc (x) options operator, arrow; x^2 end proc

[Maple Plot]

>    f := x -> -x^2;  plot( f(x), x = -3..3, title="Classic Inverted Parabola");

f := proc (x) options operator, arrow; -x^2 end proc

[Maple Plot]

>    f := x -> 12-(x-3)^2;  plot( f(x), x = -2..7, title="Another Parabola");

f := proc (x) options operator, arrow; 12-(x-3)^2 end proc

[Maple Plot]

>    f := x -> abs(x);  plot( f(x), x = -3..3, title="Classic Absolute Value");

f := abs

[Maple Plot]

>    f := x -> sqrt(x);  plot( f(x), x = -1..16, title="Squareroot");

f := sqrt

[Maple Plot]

>    f := x -> x^3;  plot( f(x), x = -3..3,y = -15..15, title="Classic Cubic");

f := proc (x) options operator, arrow; x^3 end proc

[Maple Plot]

>    f := x -> x^3 - 4*x;  plot( f(x), x = -3..3,y = -10..10, title="Curvy Cubic");

f := proc (x) options operator, arrow; x^3-4*x end proc

[Maple Plot]

>    f := x -> 1/x;  plot( f(x), x = -3..3, y = -10..10,
                     title="Reciprocal", discont = true);

f := proc (x) options operator, arrow; 1/x end proc

[Maple Plot]


 

3. Vertical Line Test


When looking at a graph it is fairly easy to see if its the graph of a function or not.

Vertical Line Test - (tests for a function)

If EVERY vertical line crosses a graph in at most one point, then the graph is the graph of a function. Here are some examples of graphs which FAILS this test. Thus none of these are functions. They are merely relations.

>    restart: with(plots):

Warning, the name changecoords has been redefined

>    expr := 4*x^2 - 3*y^2 + y^3 = 1;
plots[display](
     implicitplot( expr ,x=-2..2, y=-2..4,color = blue, thickness = 2),
     plot( {seq([[k/4,-2],[k/4,4]], k=-8..8)}, x=-2..2, y= -2..4,
                 color = gold));

expr := 4*x^2-3*y^2+y^3 = 1

[Maple Plot]

>    expr := y^2 = x + 1.5;
plots[display](
     implicitplot( expr ,x=-2..2, y=-2..2,color = blue, thickness = 2),
     plot( {seq([[k/4,-2],[k/4,2]], k=-8..8)}, x=-2..2, y= -2..2, color = gold));

expr := y^2 = x+1.5

[Maple Plot]

>    restart: with(plots):

Warning, the name changecoords has been redefined

>    expr := 3*(x)^2 + 9*(y)^4 = 8;
plots[display](
     implicitplot( expr ,x=-2..2, y=-1..1,
                 color = blue, thickness = 2, numpoints = 1000),
     plot( {seq([[k/4,-1],[k/4,1]], k=-8..8)}, x=-2..2, y= -1..1, color = gold));

expr := 3*x^2+9*y^4 = 8

[Maple Plot]

>   


Here are some examples which PASS the Vertical line test - thus they are functions.

>    restart: with(plots):

Warning, the name changecoords has been redefined

>    f := x -> x^2;
plots[display](
     plot( f(x) ,x=-2..2, y=-2..4,color = green, thickness = 2),
     plot( {seq([[k/4,-2],[k/4,4]], k=-8..8)}, x=-2..2, y= -2..4,
           color = tan));

f := proc (x) options operator, arrow; x^2 end proc

[Maple Plot]

>    f := x -> 2+2*sin(Pi*x);
plots[display](
     plot( f(x) ,x=-2..2, y=0..4,color = green, thickness = 2),
     plot( {seq([[k/4,-2],[k/4,4]], k=-8..8)}, x=-2..2, y= 0..4,
           color = tan));

f := proc (x) options operator, arrow; 2+2*sin(Pi*x) end proc

[Maple Plot]

>    f := x -> 1 + abs(x+1)-abs(x-1);
plots[display](
     plot( f(x) ,x=-2..2, y=-2..4,color = green, thickness = 2),
     plot( {seq([[k/4,-2],[k/4,4]], k=-8..8)}, x=-2..2, y= -2..4,
           color = tan));

f := proc (x) options operator, arrow; 1+abs(x+1)-abs(x-1) end proc

[Maple Plot]

>    f := x -> 1/x;
plots[display](
     plot( f(x) ,x=-2..2, y=-5..5,color = green, thickness = 2, discont = true),
     plot( {seq([[k/4,-5],[k/4,5]], k=-8..8)}, x=-2..2, y= -5..5,
           color = tan));

f := proc (x) options operator, arrow; 1/x end proc

[Maple Plot]

>   


         © 2002 Waterloo Maple Inc