Reflections and Transformations.

Mathematica 2. initializations
Book 1

Off[General::spell1];
Off[Plot::plnr];
Off[Interpolation::inhr];
Needs["Miscellaneous`Units`"]
Needs["Graphics`Colors`"]

Reflections

Basic Function Graphs

We need to be familiar with six basic functions and their graphs:

code

Clear[i,s,c,sr,av,r,x];
 i[x_]:= x
 s[x_]:= x^2
 c[x_] := x^3
 sr[x_] := N[Sqrt[x]]
 av[x_]:= N[Abs[x]]
 r[x_]:= N[1/x]

identity= Plot[i[x],{x,-50,50},
     PlotStyle->{{Thickness[0.01],Green}},
     PlotLabel->"identity",
     Ticks->None,
     DisplayFunction->Identity];

absvalue= Plot[av[x],{x,-10,10},
     PlotStyle->{{Thickness[0.01],Yellow}},
     PlotLabel->absolute value,
     Ticks->None,
     DisplayFunction->Identity];

square= Plot[s[x],{x,-10,10},
     PlotStyle->{{Thickness[0.01],Mint}},
     PlotLabel->"square",
     Ticks->None,
     DisplayFunction->Identity];

cube= Plot[c[x],{x,-10,10},
     PlotStyle->{{Thickness[0.01],Turquoise}},
     PlotLabel->"cube",
     Ticks->None,
     DisplayFunction->Identity];

squareroot= Plot[sr[x],{x,0,10},
     PlotStyle->{{Thickness[0.01],Purple}}
     ,PlotLabel->"square root",
     Ticks->None,
     DisplayFunction->Identity];

rational= Plot[r[x],{x,-10,10},
     PlotStyle->{{Thickness[0.01],Violet}},
     PlotLabel->"rational",
     Ticks->None,
     AspectRatio->Automatic,
     DisplayFunction->Identity];

Here are some basic graphs that you should recognize.

code

Show[GraphicsArray[{{identity,square},{cube,
             rational},{squareroot,absvalue}},
               GraphicsSpacing->{0.3,0},
               DisplayFunction->$DisplayFunction]];

Reflect Across X Axis

Let's start with the absolute value function.  I
want to reflect it across the x axis.

code

negabs= Plot[-av[x],{x,-10,10},
     Ticks->None,
     PlotStyle->{{Thickness[0.01],Turquoise}},
     AspectRatio->Automatic,
     DisplayFunction->Identity];

both= Show[{absvalue,negabs},
          DisplayFunction->$DisplayFunction];

Looks like a mirror image of the absolute value 
function.  Exactly what I wanted, the reflection of
av[x].

Look at the following graph, what can you tell me about
the relationships between the ordered pairs of av[x] and
its reflection?

code

abspts=ListPlot[{{-5,5},{-5,-5},{2,2},{2,-2}},
                PlotStyle->{PointSize[0.03],Blue},
                DisplayFunction->Identity];

Show[{both, abspts},
      Graphics[{Text["(-5,5)",{-5,5},{1,0}],
               Text["(-5,-5)",{-5,-5},{1,0}],
               Text["(2,2)",{2,2},{-1,0}],
               Text["(2,-2)",{2,-2},{-1,0}]}],
               DisplayFunction->$DisplayFunction];

Hint: Look at the change in the value of the ordered pairs.
Type your answer here.

It may interest you to note that the way I got the reflection of av[x]
was to graph the function -av[x].

Reflect Across Y Axis

Let's try a different reflection.  How about one across the y axis.
What do you think will change with the coordinates this time?

For this graph I'll use the square root function sr[x].
sr[x] will be in purple and its reflection in red.

code

sqrootref= Plot[sr[-x],{x,-10,0},
                PlotStyle->{{Thickness[0.01],
                             Red}},
                DisplayFunction->Identity];

Show[{squareroot,sqrootref},
      DisplayFunction->$DisplayFunction];

This time you pick an ordered pair and I'll show it and its reflection on the graph.  Just put a value in for x and activate 
the cell below.

code

Clear[x,y];
x :=5

rootpts= ListPlot[{{x,N[sr[x]]},{-x,N[sr[x]]}},
             PlotStyle->{PointSize[0.02],Yellow},
             DisplayFunction->Identity];
             
allroots= Show[{squareroot,sqrootref,rootpts},
      Graphics[{Text[{x,sr[x]},{x,sr[x]},{-1,0}],
             Text[{-x,sr[x]},{-x,sr[x]},{1,0}]}],
             DisplayFunction->$DisplayFunction];

What do you notice about the change in these coordinates?
Here, you should notice that I graphed the reflection across the 
y axis by graphing sr[-x].

Reflect Across The Identity Function Y = X

Let's try one last reflection, across the axis y=x.
Look at the following two graphs and try to guess 
what is happening to the coordinates of the function.

We will use the function f[x]= -3 x + 6.

code

Clear[f,x];
f[x_]:= -3 x + 6

 linegrph= Plot[f[x], {x,-3,10},
           PlotStyle->{{Thickness[0.009],Green}},
           DisplayFunction->Identity];
ident= Show[Graphics[{Dashing[{0.02,0.02}],
                     Line[{{-10,-10},{10,10}}]}],
            DisplayFunction->Identity];
g[x_] := -x/3 + 2
reflect= Plot[g[x],{x,-50,50},
             PlotStyle->{{Thickness[0.009]
                        ,Orange}},
             DisplayFunction->Identity];

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

Now pick some values for x and see what happens with
the ordered pairs.  Just enter the value and activate the cell.

code

x :=10

pts= ListPlot[{{x,f[x]},{f[x],g[f[x]]}},
              PlotStyle->{PointSize[0.03],Red},
              DisplayFunction->Identity];
Show[{reflect,ident,linegrph,pts},
     Graphics[{Text[{x,f[x]},{x,f[x]},{1,0}],
               Text[{f[x],g[f[x]]},{f[x],g[f[x]]}
                     ,{1,0}]}],
               DisplayFunction->$DisplayFunction];

The graph of f[x] has a reflection that turns out to be the inverse of f[x].  You can see this by looking at the coordinates. What is the relationship between the points?

A Quick Review

List the rules you can find about these three special reflections.
        		across the x axis:
        		across the y axis:
        		across the Identity Function:

Translations

Up and Down

Now let,s try some variations on some specific functions.
First we'll use the absolute value function.  av[x]
What happens if we add 4 to the function?
What if we subtract 3?

code

addav= Plot[av[x]+4,{x,-10,10},
        PlotStyle->{{Thickness[0.009],Green}},
        DisplayFunction->Identity];

subav= Plot[av[x]-3,{x,-10,10},
           PlotStyle->{{Thickness[0.009],Blue}},           
           DisplayFunction->Identity];

Show[{addav,absvalue,subav},
      Graphics[{Text["av[x]-3",{5,2},{-1,0}],
      Text["av[x]+4",{2,10},{-1,0}],
      Text["av[x]",{2,5},{-1,0}]}],
      Ticks->{{{-10,-10},{-5,-5},{5,5},{10,10}},
                {{-3,-3},{2,2},{4,4}}},
      DisplayFunction->$DisplayFunction];

Very interesting how the graph went up 4 when we added
4 and went down 3 when we subtracted 3.

Let's try the squaring function.

code

adds= Plot[s[x]+10,{x,-5,5},
        PlotStyle->{{Thickness[0.009],Green}},
        DisplayFunction->Identity];

subs= Plot[s[x]-8,{x,-5,5},
           PlotStyle->{{Thickness[0.009],Yellow}},           
           DisplayFunction->Identity];

Show[{adds,square,subs},
      Graphics[{Text["s[x]-8",{3,-2},{-1,0}],
      Text["s[x]+10",{2,15},{-1,0}],
      Text["s[x]",{2,5},{-1,0}]}],
      Ticks->{{{-5,-5},{7,7}},
                {{-8,-8},{4,4},{10,10}}},
      DisplayFunction->$DisplayFunction];

Looks like we have a rule.  See if you can state it.

Left and Right

This time we will try to add and subtract within the function.

code

addav= Plot[av[x+4],{x,-10,10},
        PlotStyle->{{Thickness[0.009],Green}},
        DisplayFunction->Identity];

subav= Plot[av[x-3],{x,-10,10},
           PlotStyle->{{Thickness[0.009],Blue}},           
           DisplayFunction->Identity];

Show[{addav,absvalue,subav},
      Graphics[{Text["av[x-3]",{5,2},{-1,0}],
      Text["av[x+4]",{2,10},{-1,0}],
      Text["av[x]",{2,5},{-1,0}]}],
      Ticks->{{{-8,-8},{-4,-4},{3,3},{6,6}},
                {{-3,-3},{2,2},{4,4}}},
      DisplayFunction->$DisplayFunction];

Try to guess the rule then verify your guess with the next graph.

code

adds= Plot[s[x+10],{x,-20,20},
        PlotStyle->{{Thickness[0.009],Green}},
        DisplayFunction->Identity];

subs= Plot[s[x-8],{x,-20,20},
           PlotStyle->{{Thickness[0.009],Yellow}},           
           DisplayFunction->Identity];

Show[{adds,square,subs},
      Graphics[{Text["s[x-8]",{10,80},{-1,0}],
      Text["s[x+10]",{-19,90},{-1,0}],
      Text["s[x]",{0.5,20},{-1,0}]}],
      Ticks->{{{-10,-10},{0,0},{8,8}},Automatic},
      DisplayFunction->$DisplayFunction];

Works pretty good doesn't it?

Results

You should have observed that the graph of a function
y= f(x-c)+d is a horizontal and vertical translation of the graph 
of y=f(x).

Horizontal |c| units         			   Vertical |d| units
If c<0,  shift is left                        If d<0,  shift is down
If c>0,  shift is right                      If d>0, shift is up

Test your work on the following graph.  On graph paper, graph  
a function g(x) =  (x+5)‹ - 30

code

Clear[g,x];
g[x_]:=(x+5)^3 - 30
Plot[g[x],{x,-10,10}];

Your graph should look like this.

Dilations

we can have on last affect on these graphs.
We can multiply the function by a number.
Look at the graph of s(x)= x€, 3x€, and 0.6x€

code

Clear[x];
threes[x_]:= 3 x^2
ptsixs[x_]:= 0.6x^2

thrs= Plot[threes[x],{x,-7,7},
           PlotStyle->{{Thickness[0.01],Blue}},
           DisplayFunction->Identity];
           
ptsx= Plot[ptsixs[x],{x,-7,7},
           PlotStyle->{{Thickness[0.01],Red}},
           DisplayFunction->Identity];
           

Show[{thrs,ptsx,square},
      Graphics[{Text[FontForm["3 x€",
                     {"CalcMath",10}],
               {3,30},{1,0}],
                Text[FontForm["0.6x€",
                     {"CalcMath",10}],
                {6,10},{1,0}],
                Text[FontForm["x€",
                     {"CalcMath",10}]
                ,{4.5,25},{1,0}]}],
      DisplayFunction->$DisplayFunction];

What happens to s(x) when we multiply by 3?
When we multiply by a number between 0 and 1?
What might happen if we use a number less than zero?