Skip to main content
Mathematics LibreTexts

1.5: Transformation of Functions

  • Page ID
    117100
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Identifying Vertical Shifts

    One simple kind of transformation involves shifting the entire graph of a function up, down, right, or left. The simplest shift is a vertical shift, moving the graph up or down, because this transformation involves adding a positive or negative constant to the function. In other words, we add the same constant to the output value of the function regardless of the input. For a function \(g(x)=f(x)+k\), the function \(f(x)\) is shifted vertically \(k\) units. See Figure \(\PageIndex{2}\) for an example.

    Vertical shift by k=1 of the cube root function f(x)=3√x.
    Figure \(\PageIndex{2}\): Vertical shift by \(k=1\) of the cube root function \(f(x)=\sqrt[3]{x}\).

    To help you visualize the concept of a vertical shift, consider that \(y=f(x)\). Therefore, \(f(x)+k\) is equivalent to \(y+k\). Every unit of \(y\) is replaced by \(y+k\), so the \(y\)-value increases or decreases depending on the value of \(k\). The result is a shift upward or downward.

    Definition: Vertical Shift

    Given a function \(f(x)\), a new function \(g(x)=f(x)+k\), where \(k\) is a constant, is a vertical shift of the function \(f(x)\). All the output values change by \(k\) units. If \(k\) is positive, the graph will shift up. If \(k\) is negative, the graph will shift down.

    Example \(\PageIndex{1}\): Adding a Constant to a Function

    To regulate temperature in a green building, airflow vents near the roof open and close throughout the day. Figure \(\PageIndex{3}\) shows the area of open vents \(V\) (in square feet) throughout the day in hours after midnight, \(t\). During the summer, the facilities manager decides to try to better regulate temperature by increasing the amount of open vents by 20 square feet throughout the day and night. Sketch a graph of this new function.

    alt
    Figure \(\PageIndex{3}\)

    Solution

    We can sketch a graph of this new function by adding 20 to each of the output values of the original function. This will have the effect of shifting the graph vertically up, as shown in Figure \(\PageIndex{4}\).

    alt
    Figure \(\PageIndex{4}\)

    Graphing Functions Using Reflections about the Axes

    Another transformation that can be applied to a function is a reflection over the x- or y-axis. A vertical reflection reflects a graph vertically across the x-axis, while a horizontal reflection reflects a graph horizontally across the y-axis. The reflections are shown in Figure \(\PageIndex{13}\).

    Graph of the vertical and horizontal reflection of a function..
    Figure \(\PageIndex{13}\): Graph of the vertical and horizontal reflection of a function.

    Notice that the vertical reflection produces a new graph that is a mirror image of the base or original graph about the x-axis. The horizontal reflection produces a new graph that is a mirror image of the base or original graph about the y-axis.

    Definitions: Reflections

    Given a function \(f(x)\), a new function \(g(x)=−f(x)\) is a vertical reflection of the function \(f(x)\), sometimes called a reflection about (or over, or through) the x-axis.

    Given a function \(f(x)\), a new function \(g(x)=f(−x)\) is a horizontal reflection of the function \(f(x)\), sometimes called a reflection about the y-axis.

    How To...

    Given a function, reflect the graph both vertically and horizontally.

    1. Multiply all outputs by –1 for a vertical reflection. The new graph is a reflection of the original graph about the x-axis.
    2. Multiply all inputs by –1 for a horizontal reflection. The new graph is a reflection of the original graph about the y-axis.
    Example \(\PageIndex{10}\): Reflecting a Graph Horizontally and Vertically

    Reflect the graph of \(s(t)=\sqrt{t}\) (a) vertically and (b) horizontally.

    Solution

    a. Reflecting the graph vertically means that each output value will be reflected over the horizontal t-axis as shown in Figure \(\PageIndex{14}\).

    Graph of the vertical reflection of the square root function.
    Figure \(\PageIndex{14}\): Graph of the vertical reflection of the square root function.

    Because each output value is the opposite of the original output value, we can write

    \[V(t)=−s(t) \text{ or } V(t)=−\sqrt{t} \nonumber\]

    Notice that this is an outside change, or vertical shift, that affects the output \(s(t)\) values, so the negative sign belongs outside of the function.

    b. Reflecting horizontally means that each input value will be reflected over the vertical axis as shown in Figure \(\PageIndex{15}\).

    Determining Even and Odd Functions

    Some functions exhibit symmetry so that reflections result in the original graph. For example, horizontally reflecting the toolkit functions \(f(x)=x^2\) or \(f(x)=|x|\) will result in the original graph. We say that these types of graphs are symmetric about the y-axis. Functions whose graphs are symmetric about the y-axis are called even functions.

    If the graphs of \(f(x)=x^3\) or \(f(x)=\frac{1}{x}\) were reflected over both axes, the result would be the original graph, as shown in Figure \(\PageIndex{21}\).

    Graph of \(x^3\) and its reflections.
    Figure \(\PageIndex{21}\): (a) The cubic toolkit function (b) Horizontal reflection of the cubic toolkit function (c) Horizontal and vertical reflections reproduce the original cubic function.

    We say that these graphs are symmetric about the origin. A function with a graph that is symmetric about the origin is called an odd function.

    Note: A function can be neither even nor odd if it does not exhibit either symmetry. For example, \(f(x)=2^x\) is neither even nor odd. Also, the only function that is both even and odd is the constant function \(f(x)=0\).

    Definitions: Even and Odd Functions

    A function is called an even function if for every input \(x\)

    \(f(x)=f(−x)\)

    The graph of an even function is symmetric about the y-axis.

    A function is called an odd function if for every input \(x\)

    \(f(x)=−f(−x)\)

    The graph of an odd function is symmetric about the origin.

    How To...

    Given the formula for a function, determine if the function is even, odd, or neither.

    1. Determine whether the function satisfies \(f(x)=f(−x)\). If it does, it is even.
    2. Determine whether the function satisfies \(f(x)=−f(−x)\). If it does, it is odd.
    3. If the function does not satisfy either rule, it is neither even nor odd.
    Example \(\PageIndex{13}\): Determining whether a Function Is Even, Odd, or Neither

    Is the function \(f(x)=x^3+2x\) even, odd, or neither?

    Solution

    Without looking at a graph, we can determine whether the function is even or odd by finding formulas for the reflections and determining if they return us to the original function. Let’s begin with the rule for even functions.

    \[f(−x)=(−x)^3+2(−x)=−x^3−2x \nonumber\]

    This does not return us to the original function, so this function is not even. We can now test the rule for odd functions.

    \[−f(−x)=−(−x^3−2x)=x^3+2x \nonumber\]

    Because \(−f(−x)=f(x)\), this is an odd function.

    Analysis

    Consider the graph of \(f\) in Figure \(\PageIndex{22}\). Notice that the graph is symmetric about the origin. For every point \((x,y)\) on the graph, the corresponding point \((−x,−y)\) is also on the graph. For example, \((1, 3)\) is on the graph of \(f\), and the corresponding point \((−1,−3)\) is also on the graph.

    Graph of \(f(x)\) with labeled points at \((1, 3)\) and \((-1, -3)\)
    Figure \(\PageIndex{22}\): Graph of \(f(x)\) with labeled points at \((1, 3)\) and \((-1, -3)\).

    Graphing Functions Using Stretches and Compressions

    Adding a constant to the inputs or outputs of a function changed the position of a graph with respect to the axes, but it did not affect the shape of a graph. We now explore the effects of multiplying the inputs or outputs by some quantity.

    We can transform the inside (input values) of a function or we can transform the outside (output values) of a function. Each change has a specific effect that can be seen graphically.

    Vertical Stretches and Compressions

    When we multiply a function by a positive constant, we get a function whose graph is stretched or compressed vertically in relation to the graph of the original function. If the constant is greater than 1, we get a vertical stretch; if the constant is between 0 and 1, we get a vertical compression. Figure \(\PageIndex{23}\) shows a function multiplied by constant factors 2 and 0.5 and the resulting vertical stretch and compression.

    Graph of a function that shows vertical stretching and compression.
    Figure \(\PageIndex{23}\): Vertical stretch and compression
    Definitions: Vertical Stretches and Compressions

    Given a function \(f(x)\), a new function \(g(x)=af(x)\), where \(a\) is a constant, is a vertical stretch or vertical compression of the function \(f(x)\).

    • If \(a>1\), then the graph will be stretched.
    • If \(0<a<1\), then the graph will be compressed.
    • If \(a<0\), then there will be combination of a vertical stretch or compression with a vertical reflection.

    Performing a Sequence of Transformations

    When combining transformations, it is very important to consider the order of the transformations. For example, vertically shifting by 3 and then vertically stretching by 2 does not create the same graph as vertically stretching by 2 and then vertically shifting by 3, because when we shift first, both the original function and the shift get stretched, while only the original function gets stretched when we stretch first.

    When we see an expression such as \(2f(x)+3\), which transformation should we start with? The answer here follows nicely from the order of operations. Given the output value of \(f(x)\), we first multiply by 2, causing the vertical stretch, and then add 3, causing the vertical shift. In other words, multiplication before addition.

    Horizontal transformations are a little trickier to think about. When we write \(g(x)=f(2x+3)\), for example, we have to think about how the inputs to the function \(g\) relate to the inputs to the function \(f\). Suppose we know \(f(7)=12\). What input to \(g\) would produce that output? In other words, what value of \(x\) will allow \(g(x)=f(2x+3)=12?\) We would need \(2x+3=7\). To solve for \(x\), we would first subtract 3, resulting in a horizontal shift, and then divide by 2, causing a horizontal compression.

    This format ends up being very difficult to work with, because it is usually much easier to horizontally stretch a graph before shifting. We can work around this by factoring inside the function.

    \[f(bx+p)=f(b(x+\frac{p}{b})) \nonumber\]

    Let’s work through an example.

    \[f(x)=(2x+4)^2 \nonumber\]

    We can factor out a 2.

    \[f(x)=(2(x+2))^2 \nonumber\]

    Now we can more clearly observe a horizontal shift to the left 2 units and a horizontal compression. Factoring in this way allows us to horizontally stretch first and then shift horizontally.

    Combining Transformations
    • When combining vertical transformations written in the form \(af(x)+k\), first vertically stretch by \(a\) and then vertically shift by \(k\).
    • When combining horizontal transformations written in the form \(f(bx+h)\), first horizontally shift by \(h\) and then horizontally stretch by \(\frac{1}{b}\).
    • When combining horizontal transformations written in the form \(f(b(x+h))\), first horizontally stretch by \(\frac{1}{b}\) and then horizontally shift by \(h\).
    • Horizontal and vertical transformations are independent. It does not matter whether horizontal or vertical transformations are performed first.
    Example \(\PageIndex{20}\): Finding a Triple Transformation of a Tabular Function

    Given Table \(\PageIndex{18}\) for the function \(f(x)\), create a table of values for the function \(g(x)=2f(3x)+1\).

    Table \(\PageIndex{18}\)
    \(x\) 6 12 18 24
    \(f(x)\) 10 14 15 17

    Solution

    There are three steps to this transformation, and we will work from the inside out. Starting with the horizontal transformations, \(f(3x)\) is a horizontal compression by \(\frac{1}{3}\), which means we multiply each \(x\)-value by \(\frac{1}{3}\).See Table \(\PageIndex{19}\).

    Table \(\PageIndex{19}\)
    \(x\) 2 4 6 8
    \(f(3x)\) 10 14 15 17

    Looking now to the vertical transformations, we start with the vertical stretch, which will multiply the output values by 2. We apply this to the previous transformation. See Table \(\PageIndex{20}\).

    Table \(\PageIndex{20}\)
    \(x\) 2 4 6 8
    \(2f(3x)\) 20 28 30 34

    Finally, we can apply the vertical shift, which will add 1 to all the output values. See Table \(\PageIndex{21}\).

    Table \(\PageIndex{21}\)
    \(x\) 2 4 6 8
    \(g(x)=2f(3x)+1+1\) 21 29 31 35

    This page titled 1.5: Transformation of Functions is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by OpenStax via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.