2.4: Transformation of Functions

In this section, we will explore three types of transformations:
1.) Shifting
2.) Reflections (or flips)
3.) Stretches and compressions
Additionally, each of these three types of transformations can impact a function horizontally or vertically.  Thus, there are six basic transformations that must be learned.  And, of course, they can be combined ...

Shifts: Horizontal and Vertical

The follow graphs show examples of what is meant by shifting.

Off[Plot::"plnr"]; Off[Graphics::"gptn"]; 
    Off[ParametricPlot3D::"plld"]
Needs["Graphics`Arrow`"]
Needs["VisualLA`"]

f[x_] := x  + Sin[π x] + 3;
\(\(Show[
        GraphicsArray[{
{Plot[f[x], {x, \(-π\), π}, 
                PlotRange -> {\(-1\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Original Function"]}, 
{Plot[{f[x], f[x] - 1}, {x, \(-π\), π}, 
                PlotRange -> {\(-1\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Vertical Shift", 
                PlotStyle -> {GrayLevel[0.8], Blue}, 
                Epilog -> {Arrow[{\(- .63\), f[\(- .63\)]}, {\(- .63\), 
                        f[\(- .63\)] - 1}]}], 
Plot[{f[x], 
                  f[x - 1]}, {x, \(-π\), π}, 
                PlotRange -> {\(-1\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Horizontal Shift", 
                PlotStyle -> {GrayLevel[0.8], Red}, 
                Epilog -> {Arrow[{0, f[0]}, {1, 
                        f[0]}]}]}
}]];\)\)

Vertical Shifts

To shift vertically,we will add a constant A from the function (A negative in the case where we want subtraction).  

That is, we will consider graphs of f(x) + A for A ∈ ℝ

Example 1: Vertical Shifts

For example, if f(x) is as given below, consider f(x)-1.

Table[
        Plot[{f[x], f[x] + A}, {x, -π, π}, 
          PlotRange -> {-1, 4}, PlotLabel -> "Vertical Shift", 
          PlotStyle -> {GrayLevel[0.8], Blue}, 
          Epilog -> {Arrow[{- .63, f[- .63]}, {- .63, 
                  f[- .63] + A}]}], {A, 
          0, -1, -0.05}];

Example 2: Vertical Shifts

If f(x) is as given below, consider f(x)+2.

Table[
        Plot[{f[x], f[x] + A}, {x, -π, π}, 
          PlotRange -> {-1, 4}, PlotLabel -> "Vertical Shift", 
          PlotStyle -> {GrayLevel[0.8], Blue}, 
          Epilog -> {Arrow[{- .63, f[- .63]}, {- .63, 
                  f[- .63] + A}]}], {A, 0, 2, 0.1}];

Summary: Vertical Shifts

Given a function f(x) and a constant A, then:

The graph of f(x) + A is a shifting of f(x) up by A if A > 0 and down by A if A < 0

Horizontal Shifts

To shift horizontally, we will subtract a constant A from the function (A negative in the case where we want addition).  

That is, we will consider graphs of f(x - A) for A ∈ ℝ

Example 3: Horizontal Shifts

If f(x) is as given below, consider f(x - 2).

Table[
        Plot[{f[x], f[x - A]}, {x, -π, π}, 
          PlotRange -> {-1, 4}, PlotLabel -> "Horizontal Shift", 
          PlotLabel -> "Horizontal Shift", 
          PlotStyle -> {GrayLevel[0.8], Red}, 
          Epilog -> {Arrow[{0, f[0]}, {A, f[0]}]}], {A, 0, 2, 
          0.1}];

Example 4: Horizontal Shifts

If f(x) is as given below, consider f(x + 1)=f(x - (-1)).

Table[
        Plot[{f[x], f[x - A]}, {x, -π, π}, 
          PlotRange -> {-1, 4}, PlotLabel -> "Horizontal Shift", 
          PlotLabel -> "Horizontal Shift", 
          PlotStyle -> {GrayLevel[0.8], Red}, 
          Epilog -> {Arrow[{0, f[0]}, {A, f[0]}]}], {A, 
          0, -1, -0.05}];

Summary: Horizontal Shifts (Counter-intuitive)

Given a function f(x) and a constant A, then:

The graph of f(x - A) is a shifting of f(x) right by A if A > 0 and left by A if A < 0

Reflections: About the y-axis and about the x-axis

The follow graphs show examples of what is meant by shifting.

g[x_] := (Sqrt[x]);
\(\(Show[
        GraphicsArray[{
{Plot[g[x], {x, \(-4\), 4}, 
                PlotRange -> {\(-3\), 3}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Original Function"]}, 
{Plot[{g[x], g[\(-x\)]}, {x, \(-π\), π}, 
                PlotRange -> {\(-3\), 3}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Flip about the y axis", 
                PlotStyle -> {GrayLevel[0.8], 
                    Blue}], 
Plot[{g[
                    x], \(-g[x]\)}, {x, \(-π\), π}, 
                PlotRange -> {\(-3\), 3}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Flip about the x axis", 
                PlotStyle -> {GrayLevel[0.8], 
                    Red}]}
}]];\)\)

Example 5: Reflections: About the y-axis

To reflect or flip about the y-axis, we negate the argument of the function.  That is, we graph f(-x)

dq = Pi/25;
fctcurve[q_] := 
        ParametricPlot3D[{{t Cos[q], t Sin[q], g[t]}, {2  t - 5, 0, 0}, {0, 
              0, t}}, {t, 0, 5}, 
          PlotRange -> {{-5, 5}, {-5, 0}, {0, 3}}, 
          Boxed -> False, Axes -> False, 
          ViewPoint -> {1.001,  -3.137,  0.779}, 
          DisplayFunction -> Identity];
arrowshaft[q_] := 
        ParametricPlot3D[{{Cos[u], Sin[u], 1}}, {u, 0, q + 2 dq}, 
          PlotRange -> {{-5, 5}, {-5, 0}, {0, 3}}, 
          Boxed -> False, Axes -> False, 
          ViewPoint -> {1.001,  -3.137,  0.779}, 
          DisplayFunction -> Identity];
arrowhead[q_] := 
        DrawVector3D[{{{Cos[q], Sin[q], 1}, {Cos[q] - dq, Sin[q] - dq, 1}}}, 
          HeadLength -> 0.1, 
          DisplayFunction -> Identity];
Table[
        Show[{fctcurve[q], arrowshaft[q], arrowhead[q]}, 
          DisplayFunction -> $DisplayFunction], {q, 
          0.1, -Pi, -dq}];

Example 6: Reflections: About the x-axis

To reflect or flip about the x-axis,we negate function .   That is,we graph-f(x)

g[x_] := (Sqrt[x]);
dq = Pi/25;
fctcurve[q_] := 
        ParametricPlot3D[{{t , g[t] Cos[q], Sin[q] g[t]}, {2  t - 5, 0, 
              0}, {0, 0, 2  t - 5}}, {t, 0, 5}, Boxed -> False, 
          Axes -> False, ViewPoint -> {1.001,  -3.137,  0.779}, 
          DisplayFunction -> Identity];
arrowshaft[q_] := 
        ParametricPlot3D[{{1, Cos[u], Sin[u]}}, {u, -1.5 Pi, q - 2 dq}, 
          Boxed -> False, Axes -> False, 
          ViewPoint -> {1.001,  -3.137,  0.779}, 
          DisplayFunction -> Identity];
arrowhead[q_] := 
        DrawVector3D[{{{1, Cos[q], Sin[q]}, {1,  Cos[q] - dq, 
                Sin[q] - dq}}}, HeadLength -> 0.1, 
          DisplayFunction -> Identity];
Table[
        Show[{fctcurve[q], arrowshaft[q], arrowhead[q]}, 
          DisplayFunction -> $DisplayFunction, 
          PlotRange -> {{-5, 5}, {-5, -5}, {-5, 
                5}}], {q, -1.5 Pi, - 0.5 Pi, dq}];

Summary: Reflections (or Flips)

Given a function f(x), then:

The graph of f(-x) is a reflection (or flip) of f about the y-axis and the graph of -f(x) is a reflection of f about the x-axis.

Stretches and Compressions: Vertical and Horizontal

The follow graphs show examples of what is meant by stretching and compressing.

h[x_] := 
        0.15 (x + 2) (x + 1) (x - 1) (x - 
              2);
\(\(Show[
        GraphicsArray[{
{Plot[h[x], {x, \(-π\), π}, 
                PlotRange -> {\(-1\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Original Function"]}, 
{Plot[{h[x], 3  h[x]}, {x, \(-π\), π}, 
                PlotRange -> {\(-1\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Vertical Stretch", 
                PlotStyle -> {GrayLevel[0.8], Blue}, 
                Epilog -> {Arrow[{1.58, h[1.58]}, {1.58, 3\ h[1.58]}], 
                    Arrow[{ .5, h[ .5]}, { .5, 3\ h[ .5]}], 
                    Arrow[{\(-2.35\), h[\(-2.35\)]}, {\(-2.35\), 
                        3\ h[\(-2.35\)]}]}], 
Plot[{h[x], 
                  h[2  x]}, {x, \(-π\), π}, 
                PlotRange -> {\(-1\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Horizontal Compression", 
                PlotStyle -> {GrayLevel[0.8], Red}, 
                Epilog -> {Arrow[{2.5, h[2.5]}, {1.25, h[2.5]}], 
                    Arrow[{\(-2.5\), h[\(-2.5\)]}, {\(-1.25\), 
                        h[\(-2.5\)]}]}]}
}]];\)\)

Vertical Stretches and Compressions (Squashes)

To stretch or compress vertically, we will multiply the f  by a positive constant A.  

That is, we will consider graphs of A f( x) for A > 0 and A ≠ 1 (why A≠1)

Example 7: Vertical Stretches

If f(x) is as given below, consider 3 f(x).

Table[
        Plot[{h[x], A h[x]}, {x, -π, π}, 
          PlotRange -> {-1, 4}, PlotLabel -> "Vertical Stretch", 
          PlotStyle -> {GrayLevel[0.8], Blue}, 
          Epilog -> {Arrow[{1.58, h[1.58]}, {1.58, A h[1.58]}], 
              Arrow[{ .5, h[ .5]}, { .5, A h[ .5]}], 
              Arrow[{-2.35, h[-2.35]}, {-2.35, 
                  A h[-2.35]}]}], {A, 1, 3, 0.1}];

Example 8: Vertical Compressions (Squashes)

If f(x) is as given below, consider (1/2)f(x).

Table[
        Plot[{h[x], A h[x]}, {x, -π, π}, 
          PlotRange -> {-1, 4}, 
          PlotLabel -> "Vertical Compression", 
          PlotStyle -> {GrayLevel[0.8], Blue}, 
          Epilog -> {Arrow[{1.58, h[1.58]}, {1.58, A h[1.58]}], 
              Arrow[{ .5, h[ .5]}, { .5, A h[ .5]}], 
              Arrow[{-2.35, h[-2.35]}, {-2.35, 
                  A h[-2.35]}]}], {A, 1, 
          (1/2), -0.025}];

Summary: Vertical Stretches and Compressions

Given a function f(x) and a constant A, then:

The graph of A f(x) is a stretching  of f(x) about the x-axis if A > 1 and a compression if 0 < A < 1.

Horizontal Stretches and Compressions (Squashes)

To stretch or compress horizontally, we will multiply the argument of f  by a positive constant A.  

That is, we will consider graphs of f(A x) for A > 0 and A ≠ 1 (why A≠1)

Example 9: Horizontal Stretches

If f(x) is as given below, consider f((1/2) x).

Table[
        Plot[{h[x], h[A x]}, {x, -5, 5}, PlotRange -> {-1, 4}, 
          PlotLabel -> "Horizontal Stretch", 
          PlotStyle -> {GrayLevel[0.8], Red}, 
          Epilog -> {Arrow[{2.5, h[2.5]}, {(2.5/A), h[2.5]}], 
              Arrow[{-2.5, h[-2.5]}, {((-2.5)/A), 
                  h[-2.5]}]}], {A, 1, 0.5, -0.05}];

Example 10: Horizontal Compressions (Squashes)

If f(x) is as given below, consider f(3  x).

Table[
        Plot[{h[x], h[A x]}, {x, -5, 5}, PlotRange -> {-1, 4}, 
          PlotLabel -> "Horizontal Compression", 
          PlotStyle -> {GrayLevel[0.8], Red}, 
          Epilog -> {Arrow[{2.5, h[2.5]}, {(2.5/A), h[2.5]}], 
              Arrow[{-2.5, h[-2.5]}, {((-2.5)/A), 
                  h[-2.5]}]}], {A, 1, 3, 0.1}];

Summary: Horizontal Stretches and Compressions (Counter-intuitive)

Given a function f(x) and a constant A, then:

The graph of f(A x) is a stretching  of f(x) about the y-axis if 0 < A < 1 and a compression if  A > 1.

Conclusion of Basic Transformations

We explored the three types of transformations:

1.) Shifting
2.) Reflections (or flips)
3.) Stretches and compressions

Shifting

Given a function f(x) and a constant A, then:

The graph of f(x) + A is a shifting of f(x) up by A if A > 0 and down by A if A < 0
The graph of f(x - A) is a shifting of f(x) right by A if A > 0 and left by A if A < 0

Reflections (or flips)

Given a function f(x), then:

The graph of f(-x) is a reflection (or flip) of f about the y-axis and the graph of -f(x) is a reflection of f about the x-axis.

Stretches and compressions

Given a function f(x) and a constant A, then:

The graph of A f(x) is a stretching  of f(x) about the x-axis if A > 1 and a compression if 0 < A < 1.
The graph of f(A x) is a stretching  of f(x) about the y-axis if 0 < A < 1 and a compression if  A > 1.

A Quiz on Transformations

Off[Plot::"plnr"]; Off[Solve::"ifun"]; 
    Off[LessEqual::"nord"];
$TextStyle = {FontSize -> 12}; $FormatType = 
      TraditionalForm;
g[x_] = 
        If[-1 ≤ x ≤ 1, (Sqrt[(1/2) (x + 1)]) + 
            1, If[1 ≤ x ≤ 2, 2  x]];
QQQ = {}; 
    For[i = -4, i ≤ 4, i++, 
      For[j = -3, j ≤ 5, j++, 
        AppendTo[QQQ, {i, j}]]];
G[FCT_, LABEL_: ""] := 
        Module[{PLOT}, 
          PLOT = Plot[FCT, {x, -5, 5}, PlotPoints -> 200, 
              DisplayFunction -> Identity]; 
          Show[{Graphics[Point /@ QQQ], PLOT}, Axes -> True, 
            AxesLabel -> {x, ""}, PlotLabel -> LABEL, 
            AspectRatio -> 1, 
            DisplayFunction -> Identity]];

Show[G[{g[x]}, y], 
        DisplayFunction -> $DisplayFunction];

An Introduction to Symmetry

Mathematicians are notoriously lazy.  By this, I do not mean that we are unwilling to work hard (far be it).  But rather, that we are unwilling to work hard if there is an easier way.

Symmetry is a nice example.  Symmetry allows us to understand a whole situation with half the work by simply recognizing the symmetry.

Two famous symmetries are known as odd and even symmetry.

Odd and Even Symmetry

The following graphs show no symmetry, odd, and even symmetry.

\(\(Show[
        GraphicsArray[{
{Plot[\@x, {x, \(-3\), 3}, 
                PlotRange -> {\(-1\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "No Symmetry"]}, 
{Plot[{\(x\^2\) Sin[π\ x]}, {x, \(-3\), 3}, 
                PlotRange -> {\(-7\), 7}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Odd Function", 
                PlotStyle -> {Blue}], 
Plot[{0.5 
                       Cos[π\ x] + 1.5\/\(x\^2 + 1\)}, {x, \(-3\), 3}, 
                PlotRange -> {\(-1\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "Even Symmetry", 
                PlotStyle -> {Red}]}
}]];\)\)

Odd Functions

Odd functions are symmetric about the origin.  To see odd symmetry, rotate the graph about the origin by 180 degrees and see if your resultant graph is identical to the original..

Examples of odd functions include:

\(\(Show[
        GraphicsArray[{
{Plot[x, {x, \(-3\), 3}, 
                PlotRange -> {\(-4\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "y=x"], 
Plot[{x\^3}, {x, \(-3\), 3}, PlotRange -> {\(-4\), 4}, DisplayFunction -> Identity, 
                PlotLabel -> \*""y=(x^3)"", 
                PlotStyle -> {Blue}]}, 
{Plot[{{Sign[
                        x] \((\ x\^2)\)\^\(1\/6\)}}, {x, \(-3\), 3}, 
                PlotRange -> {\(-4\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> \*""y=(x^(1/3))"", 
                PlotStyle -> {Red}], 
Plot[{1\/x}, {x, \(-3\), 3}, PlotRange -> {\(-4\), 4}, DisplayFunction -> Identity, 
                PlotLabel -> \*""y=(1/x)"", 
                PlotStyle -> {Green}]}, 
{Plot[{Sin[
                    x]}, {x, \(-3\), 3}, PlotRange -> {\(-4\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "y=sin(x)", 
                PlotStyle -> {Purple}]}
}]];\)\)

Odd Functions: The Test

For odd functions, f(-x) = -f(x).  (Why?)

Examples

1.) f(x) = (x^2) + x
2.) g(x) = (x^3) - x
3.) h(x) = 3  (x^2) - x

Even Functions

Even functions are symmetric about the y-axis.  To see even symmetry, flip the graph about the y-axis and see if your resultant graph is identical to the original.

Examples of even functions include:

\(\(Show[
        GraphicsArray[{
{Plot[1, {x, \(-3\), 3}, 
                PlotRange -> {\(-4\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "y=1"], 
Plot[{x\^2}, {x, \(-3\), 3}, PlotRange -> {\(-4\), 4}, DisplayFunction -> Identity, 
                PlotLabel -> \*""y=(x^2)"", 
                PlotStyle -> {Blue}]}, 
{Plot[{{Abs[
                      x]}}, {x, \(-3\), 3}, PlotRange -> {\(-4\), 4}, 
                DisplayFunction -> Identity, PlotLabel -> "y=|x|", 
                PlotStyle -> {Red}], 
Plot[{Cos[
                    x]}, {x, \(-3\), 3}, PlotRange -> {\(-4\), 4}, 
                DisplayFunction -> Identity, 
                PlotLabel -> "y=cos(x)", 
                PlotStyle -> {Purple}]}
}]];\)\)

Even Functions: The Test

For odd functions, f(-x) = f(x).  (Why?)

Examples

1.) f(x) = 1 + (x^2)
2.) g(x) = x - 2  (x^3)
3.) h(x) = (x^4) - x

Summary: Symmetry

Two famous kinds of symmetry of functions are odd and even symmetry.

Odd functions are symmetric about the origen and satisfy f(-x) = -f(x).
Even functions are symmetric about the y-axis and satisfy f(-x) = f(x).

Not all functions are symmetric and many symmetric problems can be solved without reference to symmetry.  However, the mathematician who can account for symmetry shows promise.