Combinations of Functions

Site: Saylor Academy
Course: MA005: Calculus I
Book: Combinations of Functions
Printed by: Guest user
Date: Tuesday, May 7, 2024, 3:15 AM

Description

Read this section for an introduction to combinations of functions, then work through practice problems 1-9.

Multiline Definitions of Functions – Putting Pieces Together

Sometimes a physical or economic situation behaves differently depending on circumstances, and a more complicated function may be needed to describe the situation.

Sales Tax:
Some states have different rates of sale tax depending on the type of item purchased. A "luxury item" may be taxed at 12%, food may have no tax, and all other items may have a 6% tax. We could describe this situation by using a multiline function, a function whose defining rule consists of several pieces. Which piece of the rule we need to use will depend on what we buy. In this example we could define the tax T on an item which costs x to be

T(x) = \left\{ \begin{array}{lll}0 & \mbox { if  
    x  is the cost of a food}\\ 0.12x & \mbox { if  
    x is the cost of a luxury item}\\ 0.06x & \mbox { if 
    x  is the cost of any other item} \end{array} \right.

To find the tax on a $2 can of stew, we would use the first piece of the rule and find that the tax is 0. To find the tax on a $30 pair of earrings, we would use the second piece of the rule and find that the tax is $3.60 . The tax on a $20 book requires using the third rule, and the tax is $1.20 .

Wind Chill Index:
The rate at which a person's body loses heat depends on the temperature of the surrounding air and on the speed of the air. You lose heat more quickly on a windy day than you do on a day with little or no wind. Scientists have experimentally determined this rate of heat loss as a function of temperature and wind speed, and the resulting function is called the Wind Chill Index, WCI . The WCI is the temperature on a still day (no wind) at which your body would lose heat at the same rate as on the windy day. For example, the WCI value for 30o F air moving at 15 miles per hour is 9o F: your body loses heat as quickly on a 30o F day with a 15 mph wind as it does on a 9o F day with no wind.

If T is the Fahrenheit temperature of the air and v is the speed of the wind in miles per hour, then the WCI is a multiline function of the wind speed v (and of the temperature T):

 WCI  = \left\{ \begin{array}{lll}T & \mbox { if  0 ≤ v ≤ 4 }\\ 91.4 – \dfrac{10.45
    + 6.69 \sqrt v – 0.447v}{22}  (91.5 – T) &  \mbox { if 4 ≤ v ≤ 45}\\ 1.60T – 55 & \mbox { if  v > 45} \end{array} \right.

The WCI value for a still day  (0 ≤ v ≤ 4 \; mph) is just the air temperature. The WCI values for wind speeds above 45 mph are the same as the WCI value for a wind speed of 45 mph. The WCI values for wind speeds between 4 mph and 45 mph decrease as the wind speeds increase.

This WCI function depends on two variables, the temperature and the wind speed. However, if the temperature is constant, then the resulting formula for the WCI will only depend on the speed of the wind. If the air temperature is 30o F (T = 30), then the formula for the Wind Chill Index is

 WCI30 = \left\{ \begin{array}{lll}30^o                                    
    & \mbox { if  0  ≤ v  ≤ 4   mph}\\62.19  - 18.70 \sqrt v + 1.25v     & \mbox { if  4 ≤ v ≤ 45   mph}\\-7^o & \mbox {
    if 45 ≤ v   mph} \end{array} \right\}


The graphs of the the Wind Chill Indices are shown on Fig. 1 for temperatures of 40o F, 30o F and 20o F . (From UMAP Module 658, Windchill by William Bosch and L.G. Cobb, 1984).

Practice 1: A motel charges $50 per night for a room during the tourist season from June 1 through September 15, and $40 per night otherwise. Define a multiline function which describes these rates.

Example 1: Define f(x) = \left\{ \begin{array}{lll}   2 & \text { if } x < 0\\ 2x & \text  { if } 0 ≤ x < 2\\ 1 & \text { if } 2 < x    \end{array} \right.

Evaluate  f(–3), f(0), f(1), f(4) and f(2). Graph y = f(x) for –1 ≤ x ≤ 4.

Solution: To evaluate the function for different values of x, we must first decide which line of the rule applies. If x = –3 < 0, then we need to use the first line of the rule, and f(–3) = 2. When x = 0 or x = 1, we need the second line of the function definition, and then f(0) = 2(0) = 0 and f(1)
    = 2(1) = 2. At x = 4 the third line is needed, and f(4) = 1. Finally, at x = 2, none of the lines apply: the second line requires x < 2 and the third line requires 2 < x, so f(2) is undefined. The graph of f(x) is given in Fig. 2. Note the "hole" above x = 2 since f(2) is not defined by this rule for f.

Practice 2: Define g(x) = \left\{ \begin{array}{llll} x & \text { if } x < –1 \\2 & \text { if } –1 ≤ x < 1 \\ –x & \text { if } 1 < x ≤ 3 \\ 1 & \text { if } 4 < x \end {array} \right.

Graph y = g(x) for –3 ≤ x ≤ 6 and evaluate g(–3), g(–1), g(0), g(1/2), g(1), g(π/3), g(2), g(3), g(4) and g(5).


Practice 3: Write a multiline function definition for the function
whose graph is given in Fig. 3 .



We can think of a multiline function definition as a machine which first examines the input value to decide which line of the function rule to apply (Fig. 4).



Source: Dale Hoffman, https://s3.amazonaws.com/saylordotorg-resources/wwwresources/site/wp-content/uploads/2012/12/MA005-1.4-Combinations-of-Functions.pdf
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 License.

Composition of Functions - Functions of Functions

Basic functions are often combined with each other to describe more complicated situations. Here we will consider the composition of functions, functions of functions.

Definition: The composite of two functions f and g , written f \circ g, is f \circ g(x) ≡ f( g(x) ).

The domain of the composite function f \circ g(x) = f( g(x) ) consists of those x–values for which g(x) and f( g(x) ) are both defined - we can evaluate the composition of two functions at a point x only if each step in the composition is defined.

If we think of our functions as machines, then composition is simply
a new machine consisting of an arrangement of the original machines. The composition  f \circ g of the function machines f and g shown in Fig. 5(a) is an arrangement of the machines so that the original input x goes into machine g , the output from machine g becomes the input into machine f, and the output from machine f is our final output. The composition of the function machines f \circ g(x) = f( g(x) ) is only valid if x is an allowable input into g  (x is in the domain of g) and if g(x) is then an allowable input into f . The composition g \circ f involves arranging the machines so the original input goes into f, and the output from f then becomes the input for g (Fig. 5(b) ).


Example 2: For f(x) = x – 2 ,  g(x) = x^2, and h(x) = \left\{ \begin{array}{ll} 3x & \mbox { if  x < 2 } \\ x – 1 & \mbox { if  2 ≤ x }\end{array} \right. , evaluate  f \circ g(3), g \circ f(6), f \circ h(2) and h \circ g(–3). Find the equations and domains of f \circ g(x) and g \circ f(x).

Solution: f \circ g(3) =  f( g(3) )  =  f( 3^2 )  =  f( 9 )  =  \sqrt{9 – 2}   =  \sqrt7   ≈  2.646
g \circ f(6) =  g( f(6) )  = 
    g(\sqrt{6 – 2}  )  =  g( \sqrt 4  )  =  g( 2 ) =  2^2  =  4
f \circ h(2) =  f( h(2) )  =  f( 2 – 1 )  =  f( 1 )  =  \sqrt{1 – 2}   =  \sqrt{–1} which is undefined
h \circ g(–3) = h( g(–3) ) = h( 9 ) = 9 – 1 = 8.

f \circ g(x) = f( g(x) ) = f( x^2 ) = x^2 – 2, and the domain of f \circ g is those x–values for which x^2 – 2 ≥ 0 so the domain of f \circ g is all x such that x ≥ 2 or x ≤ – 2.

g \circ f(x) = g( f(x) ) = g(\sqrt{ x – 2}   ) = { x – 2  }^2 = x – 2, but we can evaluate the first piece, f, of the composition only if f(x) = x – 2 is defined, so the domain of g \circ f is all x ≥ 2.

Practice 4: For f(x) = \frac{x}{x–3} , g(x) = \sqrt{1+x} , and h(x) = \left\{ \begin{array}{ll} 2x & \mbox { if  x ≤ 1}\\ 5 – x & \mbox { if 1 < x}\end{array} \right..
Evaluate  f \circ g(3), f \circ g(8), g \circ f(4), f \circ h(1), f \circ h(3), f \circ h(2) and h \circ g(–1). Find the equations for f \circ g(x) and g \circ f(x).

Shifting and Stretching Graphs

Some compositions are relatively common and easy, and you should recognize the effect of the composition on the graphs of the functions.

Example 3: Fig. 6 shows the graph of y = f(x).
Graph (a) 2 + f(x), (b) 3.f(x), and (c) f(x – 1).


Solution: All of the new graphs are shown below in Fig. 7 .

(a) Adding 2 to all of the values of f(x) rigidly shifts the graph of f(x) 2 units upward.

(b) Multiplying all of the values of f(x) by 3 leaves all of the roots of f fixed: if x is a root of f then f(x) = 0 and 3f(x) = 3(0) = 0 so x is also a root of 3 . f(x). If x is not a root of f, then the graph of 3f(x) looks like the graph of f(x) stretched vertically by a factor of 3.

(c) The graph of f(x–1) is the graph of f(x) rigidly shifted 1 units to the right.


We could also get these results by examining the graph of y = f(x), creating a table of values for f(x)\ and the new functions, and then graphing the new functions.

x f(x) 2+f(x) 3f(x) x-1 f(x-1)
-1 -1 1 -3 -2 f(-2) not definded
0 0 2 0 -1 f(1-1) = -1
1 1 3 3 0 f(1-1) = 0
2 1 3 3 1 f(2-1) = 1
3 2 4 6 2 f(3-1) = 1
4 0
2 0 3 f(4-1) = 2
5 -1 1 -3 4 f(5-1 = 0)

If k is a positive constant, then
  • the graph of y = k + f(x) will be the graph of y = f(x) rigidly shifted up by k units,
  • the graph of y = kf(x) will have the same roots as the graph of f(x) and will be the graph of y = f(x) vertically stretched by a factor of k,
  • the graph of y = f(x – k) will be the graph of y = f(x) rigidly shifted right by k units,
  • the graph of y = f(x + k) will be the graph of y = f(x) rigidly shifted left by k units.


Practice 5: Fig. 8 is the graph of g(x).
Graph (a) 1+g(x), (b) 2g(x), (c) g(x–1) and (d) –3g(x).


Iteration of Functions

There are applications which feed the output from a function machine back into the same machine as the new input. Each time through the machine is called an iteration of the function.

Example 4: Suppose f(x) = \dfrac{5/x +
    x}{2}, and we start with the input  x = 4 and repeatedly feed the output from f back into f (Fig. 9). What happens?


Solution:

Iteration
Input
Output
1
4
f(4) =\dfrac{ 5/4 + 4}{2} = 2.625
2
2.625
f( f(4) ) = \dfrac{5/2.625 + 2.625}{2} = 2.264880952
3
2.264880952
f( f( f(4) ) ) = 2.236251251
4
2.236251251
2.236067985
5
2.236067985
2.236067977
6
2.236067977
2.236067977

Once we have obtained the output 2.236067977, we will just keep getting the same output. You might recognize this output value as \sqrt5. This algorithm always finds ±\sqrt 5 . If we start with any positive input, the values will eventually get as close to \sqrt5 as we want. Starting with any negative value for the input will eventually get us to –\sqrt 5 . We cannot start with x = 0, since 5/0 is undefined.

Practice 6: What happens if we start with the input value x = 1 and iterate the function f(x) =\dfrac{9/x + x}{2} several times? Do you recognize the resulting number? What do you think will happen to the iterates of g(x) = \dfrac{A/x + x}{2} ? (Try several positive values of A).

Two Useful Functions: Absolute Value and Greatest Integer

These two functions have useful properties which let us describe situations in which an object abruptly changes direction or jumps from one value to another value.Their graphs will have corners and breaks.

Absolute Value Function: |x|

The absolute value function of a number x, y = f(x) = | x |, is the distance between the number x and 0. If x is greater than or equal to 0, then | x | is simply x – 0 = x. If x is negative, then | x |  is  0 – x = –x = –1 . x which is positive since –1. (negative number) = a positive number. On some calculators and in some computer programming languages, the absolute value function is represented by ABS(x).

Definition of  | x | : | x | = \left\{ \begin{array}{ll} x & \mbox { if x ≥ 0 }\\ –x & \mbox { if x < 0 }\end{array} \right. or      | x | = \sqrt{x^2}.

The domain of  y = f(x) = | x | consists of all real numbers. The range of f(x) = | x | consists of all numbers larger than or equal to zero, all non–negative numbers. The graph of y = f(x) = | x | (Fig. 10) has no holes or breaks, but it does have a sharp corner at x = 0. The absolute value will be useful later for describing phenomena such as reflected light and bouncing balls which change direction abruptly or whose graphs have corners.


The absolute value function has a number of properties which we will use later.

Properties of |  |: For all real numbers a and b:
(a) | a | ≥ 0. | a | = 0 if and only if a = 0.
(b) | ab | = | a | | b |
(c) | a + b | ≤ | a |  +  | b |

Taking the absolute value of a function has an interesting effect on the graph of the function. Since

 |
    x | = \left\{ \begin{array}{ll} x & \mbox { if x ≥ 0 }\\ –x & \mbox { if x < 0}\end{array} \right. , then for any function  f(x) we have | f(x) | = \left\{ \begin{array}{ll}f(x) & \mbox { if f(x) ≥ 0 }\\–f(x) & \mbox { if f(x) < 0 }\end{array} \right.

In other words, if f(x) ≥ 0, then | f(x) | = f(x) so the graph of | f(x) | is the same as the graph of f(x).  If  f(x) < 0, then | f(x) | = –f(x) so the graph of | f(x) | is just the graph of f(x) "flipped" about the x–axis, and it lies above the x–axis. The graph of | f(x) | will always be on or above the x–axis.

Example 5: Fig. 11 shows the graph of f(x). Graph (a) | f(x) | , (b) | 1 + f(x) | and (c) 1 + | f(x) |.


Solution: The graphs are given in Fig. 12. In (b) we shift the graph of  f up 1 unit before taking the absolute value. In (c) we take the absolute value before shifting the graph up 1 unit.


Practice 7: Fig. 13 shows the graph of g(x). Graph (a) | g(x) | , (b) | g(x – 1) | , and (c) g( | x | ).


Greatest Integer Function: [x] or INT(x)

The greatest integer function of a number x ,  y = f(x) = [ x ], is the largest integer which is less than or equal to x . The value of [ x ] is always an integer and [ x ] is always less than or equal to x. For example, [ 3.2 ] = 3,  [ 3.9 ] = 3, and [ 3 ] = 3. If x is positive, then [ x ] truncates x (drops the fractional part of x) to get [ x ]. If x is negative, the situation is different: [ –4.2 ] ≠ –4 since –4 is not less than or equal to –4.2 :  [ –4.2 ] = – 5,  [ –4.7 ] = –5 and [ –4 ] = –4. On some calculators and in many programming languages the square brackets [  \; ] are used for grouping objects or for lists, and the greatest integer function is represented by INT(x).

Definition of [ x ]: [ x ] = the largest integer which is less than or equal to x

=  \left\{ \begin{array}{ll} x & \mbox { if x is an integer }\\   largest \; integer \; strictly \; less \; than \; x & \mbox { if x is NOT an integer}\end{array} \right.

The domain of The f(x) = [ x ] is all real numbers. The range off(x) = [ x ] is only the integers. The graph of y = f(x) = [ x ] is shown in Fig. 14. It has a jump break, a step, at each integer value of x, and f(x) = [ x ] is called a step function. Between any two consecutive integers, the graph is horizontal with no breaks or holes. The greatest integer function is useful for describing phenomena which change values abruptly such as postage rates as a function of the weight of the letter ("26¢ for the first ounce and 13¢ additional for each additional half ounce"). It can also be used for functions whose graphs are "square waves" such as the on and off of a flashing light.


Example 6: Graph f(x) = INT(1 + .5 sin(x) ).

Solution: One way to create this graph is to first graph y = 1 + 0.5sin(x) , the thin curve in Fig. 15, and then apply the greatest integer function to y to get the thicker "square wave" pattern. 


Practice 8: Sketch the graph of y = INT( x^2 ) for –2 ≤ x ≤ 2.

A Really "Holey" Function

The graph of the greatest integer function has a break or jump at each integer value, but how many breaks can a function have? The next function illustrates just how broken or "holey" the graph of a function can be.

Define h(x) =\left\{ \begin{array}{ll}
2 & \mbox { if  x  is a rational number }\\1 & \mbox { if  x  is an irrational number} \end{array} \right.

Then h( 3 ) = 2, h( 5/3 ) = 2 and h( –2/5) = 2 since 3, 5/3 and –2/5 are all rational numbers. h( π ) = 1, h(\sqrt 7  ) = 1, and h( \sqrt 2  ) = 1 since π, \sqrt7 and \sqrt 2 are all irrational numbers. These and some other points are plotted in Fig. 16 .


In order to analyze the behavior of h(x) the following fact about rational and irrational numbers is useful.


Fact: "Every interval contains both rational and irrational numbers" or, equivalently, "If a and b are real numbers and a < b, then there is

(i) a rational number R between a and b (a < R < b), and

(ii) an irrational number I between a and b (a < I < b)".

The Fact tells us that between any two places where the y = h(x) = 1 (because x is rational) there is a place where y = h(x) is 2 because there is an irrational number between any two distinct rational numbers. Similarly, between any two places where y = h(x) = 2 (because x is irrational) there is a place where y = h(x) = 1 because there is a rational number between any two distinct irrational numbers. The graph of y = h(x) is impossible to actually draw since every two points on the graph are separated by a hole. This is also an example of a function which your computer or calculator can not graph because in general it can not determine whether an input value of x is irrational.


Example 7:
Sketch the graph of  g(x) =  \left\{ \begin{array}{ll}  2 &\mbox { if  x  is a rational number }\\ x
    & \mbox { if  x  is an irrational number } \end{array} \right.

Solution: A sketch of the graph of y = g(x) is shown in Fig. 17 .

When x is rational, the graph of y = g(x) looks like the "holey" horizontal line y = 2. When x is irrational, the graph of  y = g(x) looks like the "holey" line y = x.


Practice 9: Sketch the graph of r(x)  =  \left\{ \begin{array}{ll} 2 & \mbox  { if  x  is a rational number }\\ x & \mbox { if  x  is an irrational number } \end{array}
    \right.

Practice Problem Answers

Practice 1: C(x) is the cost for one night on date x.

C(x) = \left\{ \begin{array} {ll} $50 & \text { x is between June 1 and September 15} \\ $40 & \text { if x is any other date } \end{array} \right.

Practice 2: See Fig. 29


x g(x)
-3 -3
-1 2
0 2
1/2 2
1 undefined

x g(x)
π/3
-π/3
2
-2
3
-3
4
undefined
5
1


Practice 3: f(x)=\left\{ \begin{array} {lll} 1 & \text { if } x ≤ -1 \\1 -x & \text { if } -1 ≤ x ≤ 1 \\ 2 & \text { if } 1 < x \end{array} \right.

Practice 4:

f \circ g(3) = f(2) = 2/–1 = –2 f \circ g(8) = f(3) is undefined g \circ f(4) = g(4) = \sqrt 5
f \circ h(1) = f(2) = 2/–1 = –2 f \circ h(3) = f(2) = –2 f \circ h(2) = f(3) is undefined
h \circ g(–1) = h(0) = 0 f \circ g(x) = f(\sqrt{1 + x} ) = ( \sqrt{1+x} )/( \sqrt{1+x} – 3) , g \circ f(x) = g(\dfrac{x}{x–3} ) =\sqrt{1 +\dfrac{x}{x–3}}


Practice 5: See Fig. 30.



Practice 6: f(x) = \dfrac{9/x + x}{2}.

f(1) = \dfrac{9/1 + 1}{2} = 5, f(5) = \dfrac{9/5 + 5}{2} = 3.4, f(3.4) ≈ 3.023529412,

f(3.023529412) ≈ 3.000091554, and f(3.000091554) ≈ 3.000000001.

These values are approaching 3, the square root of 9.

Putting A = 6, then f(x) = \dfrac{6/x + x}{2}.

f(1) = \dfrac{6/1 + 1}{2} = 3.5, f(3.5) = \dfrac{6/3.5 + 3.5}{2} = 2.607142857,

f(2.607142857) ≈ 2.45425636, f(2.45425636) ≈ 2.449494372,

f(2.449494372) ≈ 2.449489743.

f(2.449489743) ≈ 2.449489743 (the output is the same as the input for 9 decimal places)

These values are approaching 2.449489743, the square root of 6.

For any positive value A, the iterates of f(x) =\dfrac{A/x+x}{2} (starting with any positive x) will approach A.


Practice 7: Fig. 31 shows some of the intermediate steps and final graphs.



Practice 8: Fig. 32 shows the graph of y = x2 and the graph (thicker) of y = INT( x^2 ).



Practice 9: Fig. 33 shows the "holey" graph of y = x with a hole at each rational value of x and the "holey" graph of y = sin(x) with a hole at each irrational value of x. Together they form the graph of r(x).


(This is a very crude image since we can't really see the individual holes which have zero width).