Composition of Functions

Definition: ForMath functions 140 f andLectureg, define 6f ◦ g, the compositionWriteof f andeachg functionby, below as a composition Study Practice Exam 1 and the recommended(f ◦ exercises.g)(x) = f (g(x)) f (g(x)) of two simpler functions, Functions can be added and multiplied just like numbers. an outer f and an inner function g. DEFINITION. For functions f, g, define f +g, f - g, f.g, f /g Find the inner function first. by Dom(f ◦ g) = {x ∈ dom(g)|g(x) ∈ dom(f)} `Write x2 26 as a composition fgx . (f + g)(x) = f (x) +g(x), Note: (f +g)(x) is not (f +g).(x) Example: Suppose f(x) = x − 2 and g(x) = x2. x2 26 inner function gxx2 2 (f - g)(x)= f (x)- g(x), The first is function application. (fg)(x) = f (x)g(x), The second is multiplication. „ outer function fx does what remains (a) Find (f ◦ g) and (g ◦ f). 6 (f /g)(x) = f (x)/g(x). x to be done. t fxx6. `If f (x) = x- 2, g(x) = 6, then 2 2 (f ◦ g)(x) = f(g(x)) = f(x ) = x − 2 check: fgx f x2 2x2 26 . (f + g)(x) = f (x) + g(x) = (x- 2) + (6) = x + 4, 2 2 1 (f-g)(x()g =◦ f ()(xx) )- = g(gx()f (=x ))(x =- 2)g(x -− (6)2) = = x ( x- −8,2) = x − 4x + 4`Write 4 x 3 as a composition f gx . 1 1 (fg)(***Note:x) = f (x)g((fx)◦ =g )(6=x- (2)(6)g ◦ f) = 6x-12, 4 x 3 inner function gx x 1 1 (f /g)(x) = f (x)/g(x) = (x-2)/6 = 6 x 3 . „ outer function f x does what remains DEFINITION(b) Find. For (f functions◦ g)(2) and f and (g ◦ gf,)(2). define fog, the 4x 3 to be done. t composition of f and g, by f x4x 3. (f ◦ g)(2) = f(g(2)) = f(22) = f(4) = 4 − 2 = 2 1 1 (fog)(x) = f (g(x)) check: fgx f x 4 x 3 . 2 Apply g to(g ◦x.f Get)(2) g =(xg).(f Apply(2)) = gf(2 to− g2)(x =). gGet(0) f = (g 0(x=)). 0 `Write x 1 as a composition. f is the outer function; g is the inner function. x 1 Example: For f(x) = 3x + 4 and 2g(x) = 5, find (f ◦ g) and (g ◦ f). `Suppose f (x) = x-2 and g(x) = x . „ gxx 1 (a) Find f(ofg◦ andg)(x g)o =f. f(g(x)) = f(5) = 3(5) + 4 = 19 2 2 x f x x (fog)(x) = f(g(x)) = f (x ) = x -2. 2 2 check: f gx f x 1 x 1 . (gof)(x) (=g g◦(f(x)())x )= =g(xg-2)(3x =+ (x 4)-2) = = 5 x - 4x + 4. Note that f og = gof. For composition, order matters. `Write x4 x2 1 as a composition. (b) Example:Find (fog)(2).For f and g below, note that x4 x2 1 x22 x21. 2 2 Since (fofg(−)(x3)) = = x 1,-2,f ((f−og1))(2) = = 2, 2f-2(2) = =4-2 3, =f 2.(4) = 2, and 2 g(−2) = −1, g(−1) = −2, g(1) = −1, g(2) = 2. gxx (b’) Find (fog)(2) and (gof )(2) directly without (fog)(x), 2 Find: f xx x 1 (gof )(x). 2 4 2 (fog)(2) = f(g(2)) = f(22) = f(4) = 4-2 = 2. check: f gx fx x x 1. 2 (gof)(2)( =f g(f(2))◦ g)(2) = = g(2-2)f(g(2)) = g(0) = f =(2) 0 == 0. 3, `Write x /1 x as a composition of 2 functions. 2 `Write as a composition of 3 functions. `If h(x) = c, then h(8) = c, h(y) = c, h(x -1) = c, h(g(x)) = c. 1/1 |x| (g ◦ f)(2) = g(f(2)) = g(3) = undefined, Ans hfgx, gx|x|, fx1 x, hx1/x `For f (x) = 3x+4, g(x) = 5, find fog and gof. f(g(x)) = f(5) = 3.5+4 = 19. g(f(x)) =( fg(3◦ xf+4))(− =1) 5. = f(f(−1)) = f(2) = 3 DEFINITION. id(x) = x is called the . id(x)=x f(x)

g(x) 2 2 Hence id(5) = 5, id(y) = y, id(x -1) = x -1, ... .

For f and g above, note that THEOREM. For any function f (x), foid = f and idof = f. f(-3) = 1, f(-1) = 2, f(2) = 3, f(4) = 2, and PROOF. ( foid)(x) = f (id(x)) = f (x). g(-2) = -1, g(-1) = -2, g(1) = -1, g(2) = 2. (idof )(x) = id(f (x)) = f (x). Find 0 is the identity for , since f + 0 = 0 + f = f . (fog)(2) = f(g(2)) = f(2) = 3. 1 (gof)(2) = g(f(2)) = g(3) = undef. 1 is the identity for muliplication, f .1 = 1. f = f . (fof)(-1) = f(f(-1)) = f(2) = 3. id(x) is the identity for composition, since 1 1 1 1 x `fxx x , ffx x x 1/x x x x x21 foid = idof = f . 1 Example: f(x) = x + x . Find (f ◦ f).

1 1 1 x (f ◦ f)(x) = f(f(x)) = (x + x ) + ( 1 ) = x + x + x2+1 x+ x

Next we want to write a function as a composition of 2 simpler functions. Example: Write (x2 + 2)6 as a composition f(g(x)).

(x2 + 2)6 has an inner function g(x) = x2 + 2.

Then the outer function f(x) does what remains to be done: f(x) = x6. Check: f(g(x)) = f(x2 + 2) = (x2 + 2)6.

1 Example: Write 4 x + 3 as a composition f(g(x)).

1 1 4( x ) + 3 as inner function g(x) = x .

Then the outer function f(x) does what remains to be done: f(x) = 4x + 3. 1 1 Check: f(g(x)) = f( x ) = 4( x ) + 3.

√ Example: Write x + 1 as a composition f(g(x)).

√ x + 1 has inner function g(x) = x + 1 √ So f(x) = x. √ Check: f(g(x)) = f(x + 1) = x + 1.

Example: Write x4 + x2 + 1 as a composition.

x4 + x2 + 1 = (x2)2 + x2 + 1. ⇒ g(x) = x2 ⇒ f(x) = x2 + x + 1. Check: f(g(x)) = f(x2) = (x2)2 + x2 + 2 = x4 + x2 + 1.

1 Example: Write 1+|x| as the composition of 3 functions h(f(g(x))).

1 1+|x| has inner function g(x) = |x|

1 (1+x) has inner function f(x) = 1 + x

1 Thus h(x) = x .

1 Check: h(f(g(x))) = h(f(|x|)) = h(1 + |x|) = 1+|x|

2 -1 `If f (x) = x+3 then f (-1x) = x-3. Math 140 Lecture 7 `If f (x) = x+3 then f (x) = x-3. Math 140 Lecture 7 -1 If g(x) = x/2 then g (-1x) = 2x. Inverse functions If g(x) = x/2 then g (x) = 2x. Inverse functions -1 2 -1 If h(x) = x then h (-1x) = x for2 x > 0. DEFINITION. f ,-1 the inverse of f , is the function, if any, If h(x) = x then h (x) = x for x > 0. DEFINITION. f , the inverse of f , is the function, if any, -1 Note how the graph of f is related to the graph of f .-1 such that, such that, Note how the graph of f is related to the graph of f . -1 -1 f ( f (-1x)) = x when f (-1x) is defined and -1 f ( f (x)) = x when f (x) is defined and g -1 -1 g h f (-1 f (x)) = x when f (x) is defined. h f ( f (x)) = x when f (x) is defined. g -1-1 g -1 -1 f f -1 This says that f and f -1undo each other: f f h This says that f and f undo each other: h -1 f -1undoes what f (x) does and gives you back x. f undoes what f (x) does and gives you back x.

-1 -1 -1

`f(x) =2x, f (-1x)=½x. Verify: f(f (-1x))=x & f ( -1f (x))=x `f (x) = 2x, f (x) = ½x. Verify: f (f (x)) = x & f (f (x)) = x

-1 -1 `g(x) = x +3, g (-1x) = x-3. By the Theorem, y = f (-1x) iff f (y) = x. Thus the graph of `g(x) = x +3, g (x) = x-3. By the Theorem, y = f (x) iff f (y) = x. Thus the graph of -1 1 3 -1 `h(x) = 2x +3, h (-1x) = (x-3)/2 = x1 .3 y = f (-1x) is the graph of f (y) = x which is just the graph `h(x) = 2x +3, h (x) = (x-3)/2 =2 x 2 . y = f (x) is the graph of f (y) = x which is just the graph -1 2 2 Verify that h (-1h(x)) = x. of f (x) = y with x and y interchanged. Interchanging x Verify that h (h(x)) = x. of f (x) = y with x and y interchanged. Interchanging x To undo a of operations, you must undo them in and y reflects the plane around the major diagonal y = x. To undo a sequence of operations, you must undo them in and y reflects the plane around the major diagonal y = x. 1 1 thethe reverse reverse order: order: the the inverse inverse of of g gffxxisisf f 1gg1xx . . HenceHence Inverse Functions-1 THEOREM. The graph of y = f (-1x) is the of the f THEOREM. The graph of y = f (x) is the reflection of the f −1 yx Definition:graph off y, = the f (xinverse) acrossof thef, ismajor the function, diagonal if y any, = x such. that yx graph of y = f (x) across the major diagonal y = x. f -1-1 f (f ◦ f −1)(x) = x when f −1(x) is defined and For each function,−1 draw the three graphs y = f (x), y = x, -1 For each function,(f ◦ f)( xdraw) = x the three graphs y = f when(x), yf =( x), is defined THEOREM. y = f (-1x) iff f (y) = x. -1 THEOREM. y = f (x) iff f (y) = x. y = f (-1x) on the same coordinate system.

-1 y = f (x) on the same coordinate system. To find f (-1x) for complicated functions: 3 To find f (x) for complicated functions: `f (x) = x 3 x Start with f (y) = x. Example:`f (x)f =( x) = 2x, g(x) = 2 Start with f (y) = x. 3 x x 2x -1 `Considerf (x) = -fx( g (3x)) = f( ) = 2( ) = x and g(f(x)) = g(2x) = = x. Thus, g(x) is Solve for y to get y = f (-1x). `f (x) = -x 2 2 2 Solve for y to get y = f (x). an inverse function of f(x). I can write f −1(x) = g(x) = x . 3 1 2 `f xx , 3find f 1x . DEFINITION. f is 1-1 (“one-to-one”) iff `f xx , find f x . DEFINITION. f is 1-1 (“one-to-one”) iff f fyyx x x = y implies f (x) = f (y). 3 Definition:x = y impliesf is 1-1 (”one-to-one”)f (x) = f (y). ⇐⇒ x1 6= x2 implies f(x1) 6= f(x2). ty 3 x ty x `f (x) = 3x is 1-1 x = y ˆ 3x = 3y 3 1 3 `f (x) = 3x is 1-1 x = y ˆ 3x = 3y t y x3 .f 1x x3 2 2 2 t y x .f x x Example:f (x) = fx (x is2) =not 3x is 1-1 1 but = -1 but (-1) =2 1 . 2 -1 -1 f (x) = x is2 not 1 = -1 but (-1) = 1 . 2 2 WARNING. f (-1x) and (f (x)) -1are not the same. g(x) = x is not 1-1 since 1 6= −1 but (−1) = 1 . WARNING. f (x) and (f (x)) are not the same. -1 f (-1x) = the inverse HEOREM f (x) = the inverse T . The following are equivalent: -1 THEOREM. The following are equivalent: (f (x)) -1= the reciprocal = 1/f (x) . f has an inverse (f (x)) = the reciprocal = 1/f (x) . Horizontalv Line Test: If every horizontal line intersects the graph of a function f in at 3 v f has an inverse If f (x) = x 3 If f (x) = x mostv one f is point, 1-1 the f is one-to-one. -1 -1 v f is 1-1 f (-1x) = 3 x f (0)-1 = 0 f (x) = 3 x f (0) = 0 v no horizontal line intersects its graph more than once. -1 3 -1 v no horizontal line intersects its graph more than once. (f (x)) =-1 1/x 3 (f (0)) -1= undefined. (f (x)) = 1/x (f (0)) = undefined. Example:``WhichWhichWhich of of the the of following the following following functions functions has an inverse?has has an an inverse? inverse? xx11 1 ``f fxx= =x 1 . Find . Find f f 1xx . . x1 y1 f yx, y1 x, y 1 xy 1 f yx,yy11 x, y 1 xy 1 y 1 xy x, y xy x 1 y 1 xy x, y xyx1 x x11 x1 x1 y1 xx 1, y 1x x1 y1 xx 1, y 1x x1 1 x1 tf 1x x1 tf xxx11 2 7 1 `gxx 2 7x for x .7 Find g 1x . Answer: The first graph has an-1 inverse and the second graph doesn’t. `gxx 7x for x 2 . Find g x . THEOREM. The domain of f -1is the range of f. The range of 2 7 2 THEOREM. The domain of f is the range of f. The range of y 2 7y x for y 7 -1 y 7y x for y 2 f -1is the domain of f . 2 2 2 f is the domain of f . y 2 7y x 0, ay 2 by c 0 for a 1, b 7, c x . y 7y x 0, ay by c 0 for a 1, b 7, c xTheorem: . ProofProof. The. The reflection functionreflectionf around hasaround an the inverse the major major if and diagonal diagonal only if fwhich whichis 1-1. -1 2 carries the graph of f to the graph of f -1also carries the 7 7 241x 7 494x carries the graph of f to the graph of f also carries the 7 7 41x 7 494x -1 y 2 1 2 domain of f to the range of f -1and the range of f to the y domain of− 1 f to the range of f and the range of f to the 21 2 Theorem: y = f -1(x) ⇐⇒ f(y) = x. domain of f .-1 7 494x 7 domain of f . 7 494x 7 y 2 . Choose “-” not “+” since y 2 . y 2 . Choose “-” not “+” since y 2 . StatedStated in in full, full, the the inverse inverse is is the the compositional compositional inverse inverse. . 7 494x ToFor find addition,f −1(x) for the complicated inverse in functions: negation. 1 7 494x For addition, the inverse in negation. ttgg1xx 2 (1)For Switch multiplication,x and y in y the= finverse(x), i.e. is write the xreciprocal.= f(y). 2 (2)For Solve multiplication, for y. After that the you inverse can replace is they reciprocal.by f −1(x).

Example: f(x) = x3, find f −1(x). 3 1 −1 1 f(y) = x ⇐⇒ y = x ⇐⇒ y = x 3 ⇐⇒ f (x) = x 3 .

***Note: f −1(x) 6= (f(x))−1.

−1 −1 1 f (x) is the inverse of f(x) and (f(x)) = f(x) is the reciprocal of f(x).

3 2x+1 −1 Example: f(x) = x−1 , find f (x).

2x+1 y = x−1 2y+1 x = y−1 x(y − 1) = 2y + 1 xy − x = 2y + 1 xy − 2y = x + 1 y(x − 2) = x + 1 x+1 y = x−2 Now let’s look at how the graph of f is related to the graph of f −1. -1 Math 140 Lecture 7 `If f (x) = x+3 then f (x) = x-3. Since y = f −1(x) ⇐⇒ f(-1y) = x. Thus the graph of y = f −1(x) is the graph of f(y) = x Inverse functions If g(x) = x/2 then g (x) = 2x. which is just the graph of f(x)-1 = y with2 x and y interchanged. Interchanging x and y reflects -1 DEFINITION. f , the inverse of f , is the function, if any, If h(x)= x then h (x)=x for x>0. the plane around the major diagonal y = x. -1 such that, Note how the graph of f is related to the graph of f . -1 -1 f ( f (x)) = x when f (x) is defined and g-1 -1 h f ( f (x)) = x when f (x) is defined. -1 g -1 f f -1 This says that f and f undo each other: h -1 f undoes what f (x) does and gives you back x.

-1 -1 -1 `f (x) = 2x, f (x) = ½x. Verify: f (f (x)) = x & f (f (x)) = x

-1 Theorem: The graph of y -1= f −1(x) is the reflection of the graph of y = f(x) across the `g(x) = x +3, g (x) = x-3. By the Theorem, y = f (x) iff f (y) = x. Thus the graph of -1 1 3 major diagonal-1 y = x. `h(x) = 2x +3, h (x) = (x-3)/2 = 2 x 2 . y = f (x) is the graph of f (y) = x which is just the graph -1 Verify that h (h(x)) = x. of f (x) = y with x and y interchanged. Interchanging x −1 −1 To undo a sequence of operations, you must undo them inTheorem:and y Thereflects domain the ofplanef aroundis the range the major of f. The diagonal range ofy =f x. is the domain of f. the reverse order: the inverse of gf x is f 1g1x . Hence -1 THEOREM. The graph of y = f (x) is the reflection of the f yx graph of y = f (x) across the major diagonal y = x. f -1

-1 For each function, draw the three graphs y=f (x), y=x, THEOREM. y = f (x) iff f (y) = x. -1 y = f (x) on the same coordinate system. -1 To find f (x) for complicated functions: 3 `f (x) = x Start with f (y) = x. 3 -1 `f (x) = -x Solve for y to get y = f (x). 3 1 `f xx , find f x . DEFINITION. f is 1-1 (“one-to-one”) iff f yx x = y implies f (x) = f (y). ty3 x `f (x) = 3x is 1-1 x = y ˆ 3x = 3y 3 1 3 t y x .f x x 2 2 2 f (x) = x is not 1 = -1 but (-1) = 1 . -1 -1 WARNING. f (x) and (f (x)) are not the same. -1 f (x) = the inverse THEOREM. The following are equivalent: -1 (f (x)) = the reciprocal = 1/f (x) . v f has an inverse 3 If f (x) = x v f is 1-1 -1 -1 f (x) = 3 x f (0) = 0 v no horizontal line intersects its graph more than once. -1 3 -1 (f (x)) = 1/x (f (0)) = undefined. `Which of the following functions has an inverse? x1 1 `f x= x1 . Find f x . y1 f yx, y1 x, y 1 xy 1 y 1 xy x, y xy x 1 x1 x1 y1 xx 1, y 1x x1 4 1 x1 tf xx1 2 7 1 `gxx 7x for x . Find g x . -1 2 THEOREM. The domain of f is the range of f. The range of 2 7 for y -1 y 7y x 2 f is the domain of f . 2 2 y 7y x 0, ay by c 0 for a 1, b 7, c x . Proof. The reflection around the major diagonal which -1 7 7241x 7 494x carries the graph of f to the graph of f also carries the -1 y 21 2 domain of f to the range of f and the range of f to the -1 domain of f . 7 494x 7 y 2 . Choose “-” not “+” since y 2 . Stated in full, the inverse is the compositional inverse. 7 494x For addition, the inverse in negation. 1 tg x 2 For multiplication, the inverse is the reciprocal.