Functions as Transformations

You have learned that a function is a relation which has only one output for each input. This means that a function can be thought of as a machine or rule that transforms any element from its domain into a single element of its range. One way to get a function is by evaluating an algebraic expression containing one variable, such as $x$. You can also build functions by composing other functions. You will learn about these methods in this lesson.


Functions defined by a table, formula, or graph

A function can be thought of as a machine or rule that transforms an input to an output. If $f$ is a function, we write $f(x)$ (read as “$f$ of $x$”) for the output value that $f$ produces when given the input $x$.

The function $f$ is given in the table to the right, and graphed on the grid to the left.

Notice that for this function $f(1)=-3$. That is, $f$ transforms $1$ into $-3$. What is $f(3)$? (This is read as “$f$ of 3.”)

When $x$ is not in the domain of $f$ (that is, there is no $f(x)$-value for the input $x$), we say that $f(x)$ “is not defined.” For example, $f(0)$ is not defined. What is another value of $x$ where $f(x)$ is not defined?

$x$$f(x)$

A function can also be specified by a formula. For example, we might define a function $g$ by saying that $g(x)=x^2-2$. This tells you that $g$ transforms each number $x$ into the number $x^2-2$. The function $g$ is graphed on the grid to the left.

If $g(x)=x^2-2$, then $g(1)=1^2-2=1-2=-1$. What is $g(2)$?

What is $g(-1)$?

Another way to specify a function is by giving its graph. For example, the function $h$ is graphed on the grid to the left. If you drag the vertical bar on the grid to $x=1$, you can see that $h(1)=-4$.

Drag the vertical bar to $x=-1$. What is $h(-1)$?
What is $h(2)$?

Composing functions

You can build a new function out of two old functions by first doing one of them to the input, and then doing the other one to the result. If $f$ and $g$ are two functions, their composition is the function which transforms $x$ into $f(g(x))$ (“$f$ of $g$ of $x$”). That is, we first transform $x$ using the function $g$, to get $g(x)$, and then transform $g(x)$ using the function $f$, to get $f(g(x))$. We also write this combined function as $f ∘ g$ (read as “$f$ composed with $g$”).

In this question, we’ll keep using the functions $f$, $g$, and $h$ defined in the previous section. The function $f$ is given by the table to the right, the function $g$ is given by the formula $g(x)=x^2-2$, and the function $h$ is graphed to the left.

To compute ${f ∘ g}(1)$, start by writing it as $f(g(1))$. This can be computed from the inside out: first, notice that $g(1)=1^2-2=-1$. So $f(g(1))=f(-1)$. Now, you can look at the table to see that $f(-1)=1$. So ${f ∘ g}(1)=f(g(1))=f(-1)=1$.

$x$$f(x)$

Compute ${g ∘ f}(1)$.

Is ${g ∘ f}(1)$ equal to ${f ∘ g}(1)$?
Can you compose functions in any order, and always get the same result? (That is, are $g ∘ f$ and $f ∘ g$ the same function?)
The function $h$ is still graphed on the grid to the left. What is ${h ∘ f}(4)$?

If you have two functions that are both defined by a formula, their composition can also be defined by a formula. For example, if the functions $g$ and $k$ are defined by the formulas $g(x)=x^2-2$ and $k(x)=x+3$, then $\cl"red"{k ∘ g}$ is defined by

$$ {k ∘ g}(x) = k(g(x)) = k(x^2-2) = x^2 - 2 + 3 = x^2 + 1 $$

What is a formula for $g ∘ k$?

Click to see the graphs of $\cl"red"{k ∘ g}$ and $\cl"green"{g ∘ k}$.

Are the graphs of $\cl"red"{k ∘ g}$ and $\cl"green"{g ∘ k}$ the same or different?
Is $\cl"red"{k ∘ g}$ the same function as $\cl"green"{g ∘ k}$?

If $\cl"red"{f}$ and $\cl"blue"{g}$ are functions defined by the formulas $\cl"red"{f(x)=2x+1}$ and $\cl"blue"{g(x)=3x-4}$, find a formula for $f ∘ g$.

Just as equations of the form $y=mx+b$ are called linear equations, functions defined by a formula of the form $f(x)=mx+b$ are called linear functions.

Are $\cl"red"{f}$ and $\cl"blue"{g}$ both linear functions?
Is $f ∘ g$ a linear function?
If $\cl"green"{h}$ and $\cl"purple"{k}$ are functions defined by the formulas $\cl"green"{h(x)=x+2}$ and $\cl"purple"{k(x)=4x-3}$, use scratch paper to find a formula for $h ∘ k$.
Notice that $\cl"green"{h}$ and $\cl"purple"{k}$ are both linear functions. Is $h ∘ k$ a linear function?

In fact:

If $f$ and $g$ are linear functions, their composition $f ∘ g$ is also a linear function.