Please enable scripting (or JavaScript) in your web browser, and then reload this page.
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.
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$.
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?
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$.
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$”).
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$.
Compute ${g ∘ f}(1)$.
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
What is a formula for $g ∘ k$?
Click to see the graphs of $\cl"red"{k ∘ g}$ and $\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.
In fact:
If $f$ and $g$ are linear functions, their composition $f ∘ g$ is also a linear function.