In this lesson, further types and combinations of functions and their graphs are explored, including: piecewise-defined functions, composition of functions and the sum, difference, product and quotient of functions.
Piecewise-defined functions, like the name suggests, are functions that are made up of pieces of other functions.
We will take a look at how to graph a piecewise-defined function and also how to find the equation of one.
The important thing to note is that each piece of the function has its own domain and range which influence where and how we graph the pieces.
Graph the function
We can see that this function is composed of a quadratic function and a linear function.
To begin, we can graph the quadratic function, $y=x^2+2$y=x2+2
Using what we know about graphing quadratic functions, we have a minimum turning point at $(0,2)$(0,2).
As we are only graphing the parabola for $x\le1$x≤1 then we need to evaluate this end point.
$y=1^2+2=3$y=12+2=3
So our end point is $(1,3)$(1,3)
We might like at least another point on the curve, so let's use $(-2,6)$(−2,6)
So far we have this piece of the graph drawn.
Now we turn our attention to the second piece, $y=3x$y=3x
The line graph will begin at $x=1$x=1 so we can evaluate this end point and we obtain $(1,3)$(1,3). This means it will connect with the end point of the parabola.
We need two points to draw a straight line so let's use $(3,9)$(3,9).
Adding this to our graph we get the full picture of our piecewise-defined function.
Determine the equation of the piecewise-defined function drawn below.
We can see this time that the function is composed of 3 different functions pieced together.
Working from left to right we can see a linear function, followed by another linear function, and then finally by a quadratic function.
Working with the first linear function (in blue) we can see that the slope is $1$1.
Using any other point we like on the graph, we can calculate the $y$y intercept which is $8$8.
We now have $y=x+8$y=x+8 where $x<-1$x<−1
How did we know to say $x<-1$x<−1 rather than $x\le-1$x≤−1?
We didn't. When we join the pieces of the graph together at the end to define the entire piecewise-defined function, we need a system in place to correctly define the end points. One convention is that when graphing to the left of an $x$x value, we define that portion as less than, rather than less than or equal to.
The second linear graph (in green) is far more straight forward as it's a simple horizontal line.
We have $y=7$y=7 where $-1\le x<2$−1≤x<2
Now let's turn our attention to the final piece of the graph, the parabola.
The parabola connects on to the green linear graph with its turning point (2,7).
It has a maximum turning point and a dilation scale factor of 1.
We therefore have $y=-\left(x-2\right)^2+7$y=−(x−2)2+7 where $x\ge2$x≥2
Putting this all together we have:
Consider the function:
$f\left(x\right)$f(x) | $=$= | $\frac{2}{3}x+4$23x+4, | $x<0$x<0 | |
$x+4$x+4, | $0\le x\le1$0≤x≤1 | |||
$-2x+7$−2x+7, | $x>1$x>1 |
Graph the function.
What is the domain of the function?
$\left(-\infty,0\right)$(−∞,0)$\cup$∪$\left(0,1\right)$(0,1)$\cup$∪$\left(1,\infty\right)$(1,∞)
$\left(5,\infty\right)$(5,∞)
$\left[1,\infty\right)$[1,∞)
$\left(-\infty,\infty\right)$(−∞,∞)
What is the range of the function?
$\left[0,\infty\right)$[0,∞)
$\left(-\infty,\infty\right)$(−∞,∞)
$\left(-\infty,5\right]$(−∞,5]
$\left[5,\infty\right)$[5,∞)
What is the function represented by the graph?
$y$y | $=$= | $\editable{}$, | $x$x$<$<$\editable{}$ | |||
$\editable{}$, | $x$x$\ge$≥$\editable{}$ |
Functions can be added and multiplied; we can find the difference between two functions and we can define their quotient. In this chapter, we explain what these operations mean and what rules or restrictions apply.
Two functions $f$f and $g$g may be combined as a sum $f+g$f+g meaning that for each $x$x in the common domain we add the function values $f(x)$f(x) and $g(x)$g(x) to get $(f+g)(x)$(f+g)(x).
Note that this operation makes no sense unless $x$x belongs to the domains of both $f$f and $g$g. It may be necessary to restrict the domain of one or both functions to meet this requirement.
Let $f(x)=x^2$f(x)=x2 and $g(x)=2x+1$g(x)=2x+1. The domains of both functions are the real numbers. So, the sum function $(f+g)(x)$(f+g)(x) will also have the real numbers for its domain.
We have, $(f+g)(x)=f(x)+g(x)$(f+g)(x)=f(x)+g(x) for each $x$x in the domain. Therefore, $(f+g)(x)=x^2+2x+1$(f+g)(x)=x2+2x+1. The three graphs are shown below.
We combine functions $f$f and $g$g as a product $fg$fg by defining $(fg)(x)=f(x)\cdot g(x)$(fg)(x)=f(x)·g(x) for each $x$x in the common domain of $f$f and $g$g.
Let $f(x)=\frac{3}{x}$f(x)=3x and $g(x)=2x-\frac{1}{3}$g(x)=2x−13.
The product function $(fg)(x)$(fg)(x) is given by $f(x)\cdot g(x)$f(x)·g(x) over the domain $R\text{\}\left\{0\right\}$R\{0}. The domain has to be restricted to the real numbers without zero because this is the domain of $f$f.
Hence, $(fg)(x)=\frac{3}{x}\cdot\left(2x-\frac{1}{3}\right)$(fg)(x)=3x·(2x−13) and so,
$(fg)(x)=6-\frac{1}{x}$(fg)(x)=6−1x
The graphs are shown below.
The function $(fg)(x)=6-\frac{1}{x}$(fg)(x)=6−1x in Example $2$2 can be seen in another way. We have the constant function $h(x)=6$h(x)=6 added to the constant function $r(x)=(-1)$r(x)=(−1) times the function $k(x)=\frac{1}{x}$k(x)=1x.
Multiplying by the constant $(-1)$(−1) is really just an example of function multiplication.
So, we have the combined sum and product $(fg)(x)=h(x)+r(x)k(x)$(fg)(x)=h(x)+r(x)k(x). A difference can always be thought of as a sum where one of the summands has been multiplied by $(-1)$(−1).
Compare the graph below with that in Example $2$2.
We can define a quotient function $h(x)=\frac{f(x)}{g(x)}$h(x)=f(x)g(x) in a similar way to the way we defined the other operations, provided the domains of $f$f and $g$g are the same and we do not include in the domain values of $x$x that make $g(x)=0$g(x)=0.
Such functions are called rational functions when $f$f and $g$g are both polynomials.
A function $y$y is defined as $y=f\left(x\right)-g\left(x\right)$y=f(x)−g(x).
Given the graphs of $f\left(x\right)$f(x) (black line) and $g\left(x\right)$g(x) (grey line), graph $y$y on the same set of axes.
The idea behind the composition of functions is best explained with an example.
Suppose we think about the function given by $f\left(x\right)=2x+1$f(x)=2x+1. We understand that the function takes values of $x$x in the domain and maps them to values, say $y=2x+1$y=2x+1, in the range.
Suppose however that this is only the first part of a "two-stage treatment" of $x$x. Suppose we now take these function values and map them using another function, say $g\left(x\right)=x^2$g(x)=x2. This means that the $y$y values given by $\left(2x+1\right)$(2x+1) become the squared values $\left(2x+1\right)^2$(2x+1)2. The diagram below captures the idea.
The function values $f\left(x\right)$f(x) have become the domain values of $g\left(x\right)$g(x). Thus we could describe the complete two-stage process by the expression $g\left(f\left(x\right)\right)$g(f(x)), sometimes written $g\left[f\left(x\right)\right]$g[f(x)] or $\left(g\circ f\right)\left(x\right)$(g∘f)(x) and spoken of as "$g$g of $f$f of $x$x" or the "gof" of $x$x.
Algebraically, we can write $g\left(f\left(x\right)\right)=g\left[2x+1\right]=\left(2x+1\right)^2$g(f(x))=g[2x+1]=(2x+1)2.
Note that if we reversed the order of the two-stage processing, we would, in this instance, develop a different composite function.
Thus $f\left(g\left(x\right)\right)=f\left(x^2\right)=2\left(x^2\right)+1=2x^2+1$f(g(x))=f(x2)=2(x2)+1=2x2+1. This is known as the "fog" of $x$x.
To find $f\left(g\left(x\right)\right)$f(g(x)) algebraically, we replace all instances of $x$x in $f(x)$f(x) with $g(x)$g(x).
If $f(x)=3x+2$f(x)=3x+2 and $g(x)=2x^2-3x+1$g(x)=2x2−3x+1, evaluate $f\left(g\left(x\right)\right)$f(g(x)) and $g\left(f\left(x\right)\right)$g(f(x)).
Think: To find the composition of two functions, we need to replace all of the $x$x's in the outer function with the inner function.
Do:
$f\left(g\left(x\right)\right)$f(g(x)) | $=$= | $3g(x)+2$3g(x)+2 |
$=$= | $3\left(2x^2-3x+1\right)+2$3(2x2−3x+1)+2 | |
$=$= | $6x^2-9x+3+2$6x2−9x+3+2 | |
$=$= | $6x^2-9x+5$6x2−9x+5 |
$g\left(f\left(x\right)\right)$g(f(x)) | $=$= | $2[f(x)]^2-3f(x)+1$2[f(x)]2−3f(x)+1 |
$=$= | $2\left(3x+2\right)^2-3\left(3x+2\right)+1$2(3x+2)2−3(3x+2)+1 | |
$=$= | $2\left(9x^2+12x+4\right)-3\left(3x+2\right)+1$2(9x2+12x+4)−3(3x+2)+1 | |
$=$= | $18x^2+24x+8-9x-6+1$18x2+24x+8−9x−6+1 | |
$=$= | $18x^2+15x+3$18x2+15x+3 |
Reflect: As with any function, we can draw the composition of functions $y=f\left(g\left(x\right)\right)$y=f(g(x)) and $y=g\left(f\left(x\right)\right)$y=g(f(x)). This is nothing special, as once we obtain the expressions for $f\left(g\left(x\right)\right)$f(g(x)) and $g\left(f\left(x\right)\right)$g(f(x)), we can treat these as ordinary functions themselves.
Consider the functions $f\left(x\right)=-2x-3$f(x)=−2x−3 and $g\left(x\right)=-2x-6$g(x)=−2x−6.
Find $f\left(7\right)$f(7).
Hence, or otherwise, evaluate $g\left(f\left(7\right)\right)$g(f(7)).
Now find $g\left(7\right)$g(7).
Hence, evaluate $f\left(g\left(7\right)\right)$f(g(7)).
Is it true that $f\left(g\left(x\right)\right)=g\left(f\left(x\right)\right)$f(g(x))=g(f(x)) for all $x$x?
Yes
No
Consider the functions $f\left(x\right)=4x-6$f(x)=4x−6 and $g\left(x\right)=2x-1$g(x)=2x−1.
The function $r\left(x\right)$r(x) is defined as $r\left(x\right)=f\left(x^2\right)$r(x)=f(x2). Define $r\left(x\right)$r(x).
Using the results of the previous part, define $q\left(x\right)$q(x), which is $g\left(f\left(x^2\right)\right)$g(f(x2)).
One very important point needs to be made here in terms of the domain of composite functions.
If we consider, say $g\left(f\left(x\right)\right)$g(f(x)), then range of the function $f\left(x\right)$f(x) (which is the function applied first) must be a subset of the domain of the function $g\left(x\right)$g(x) (the function that is applied second).
That is to say, the domain of $g\left(f\left(x\right)\right)$g(f(x)) must only consist of elements that can be mapped by both $f\left(x\right)$f(x) and then by $g\left(x\right)$g(x) without causing an issue in either function.
A similar situation applies for $f\left(g\left(x\right)\right)$f(g(x)).
For example, if $f\left(x\right)=\sqrt{x}$f(x)=√x and $g\left(x\right)=\frac{1}{x}$g(x)=1x, then both $f\left(g\left(x\right)\right)$f(g(x)) and $g\left(f\left(x\right)\right)$g(f(x)) have the restricted domain $x\in R^+$x∈R+. Lets explain why.
If we consider $g\left(f\left(x\right)\right)$g(f(x)), the range of $f\left(x\right)$f(x) includes non-negative real numbers, but we can't use all of these in $g\left(x\right)$g(x). The number zero needs to be deleted.
If we consider $f\left(g\left(x\right)\right)$f(g(x)), the range of $g\left(x\right)$g(x) includes all real numbers other than zero, but only positive reals can be considered for $f\left(x\right)$f(x).
Taking this last example, we have $f\left(g\left(x\right)\right)=f\left(\frac{1}{x}\right)=\sqrt{\frac{1}{x}}=\frac{1}{\sqrt{x}}$f(g(x))=f(1x)=√1x=1√x and $g\left(f\left(x\right)\right)=g\left(\sqrt{x}\right)=\frac{1}{\sqrt{x}}$g(f(x))=g(√x)=1√x and so in this instance the fog and the gof are equal.
The graph of the composition is shown here. Note that the composition is graphed for positive reals only.