Graphs of piecewise functions
A function can be defined differently for different intervals in a given domain.
The function is defined piecewise on a domain. The function is known as
piecewise function.
Consider the function f defined by
x +1 ,−1 ≤ x <0
,0 ≤ x<1
2
f ( x )=¿ { x
2 ,1 ≤ x ≤2
The graph of f has 3 section or pieces. We say that the function f is piecewise for
the domain [−1, 2].
Note: ⋅ indicates that this point is included.
° indicates that this point is excluded.
Example
Sketch the graph of the function f defined by
,−3 ≤ x<2
2
x
f ( x )=¿ { 5 , x=2
8−x ,2< x ≤ 4
Example
For x ∈ R, [ x ] is defined as the greatest integer not exceeding x , for example, []
5
2
=2
, [ 3 ] =3 and [ −1.2 ] =−2
Sketch the graph of f defined by f ( x )= [ x ] for −2 ≤ x <3
Solution
−2 , −2 ≤ x ←1
−1 , −1 ≤ x <0
f ( x )=¿ { 0, 0 ≤ x<1
1, 1 ≤ x <2
2, 2 ≤ x <3
Question
The functions f and g are defined by f ( x )=2 ln ( x +3 ) , x >−3 and g ( x )=ⅇ kx−3, x ∈ R,
where k is a constant. The function g is the inverse of function f.
(a) Determine the value of k.
(b) Sketch the graphs of f and g on the same axes.
Answer
(a) Let y=f −1 ( x )
f ( y )=x
2 ln ( y +3 )=x
x
ln ( y +3 )=
2
x
y +3=ⅇ 2
x
y= ⅇ −3 2
x
−1
f ( x ) ¿ ⅇ 2 −3
kx
g ( x )=ⅇ −3
Given function g is the inverse of function f.
1
Thus, k = 2
(b) When x = 0, f ( 0 )=2 ln ( 0+3 )
= 2 ln 3
When 2 ln ( x+ 3 )=0
ln ( x +3 )=0
0
x +3= ⅇ
x +3=1
x=−2
Line x=−3 is the asymptote of function f
1
When x= 0, g ( 0 )= ⅇ 2 (0 )−3
= 1−3
= −2
1
When ⅇ 2 x −3=0
1
x
ⅇ 2 =3
1
x
ln ⅇ 2 =ln 3
1
x ln e=ln 3
2
1
x=ln 3
2
x=2 ln 3
Line y=−3 is the asymptote of function g
Question
The function f is defined by
( x +2 )2−9 , x <0
f ( x )=¿ {
2 x−5 , x >0
(a) Sketch the graph of f.
(b) State the range of f.
(c) State whether f is a one-to-one function or not. Given a reason for your
answer.
Answer
(a) Given f ( x )= ( x +2 )2−9 when x <0.
The coordinate of stationary point is (−2 ,−9 ).
When ( x +2 )2−9=0
( x +2 )2=9
x +2=√ 9
x +2=± 3
x=−5 ( 1 is invalid because x <0)
When 2 x−5=0
2 x=5
5
x=
2
(b) The range of f is f ( x ) ≥−9 .
(c) f is not a one-to-one function because a straight line drawn parallel to the x-
axis will cut the graph at two different points.
Question
Functions f and g are defined by f ( x )=ln ( x−1 ), where x >1 and
g ( x )=√ x−2, where x ≥ 2.
(a) Sketch, on separate diagram, the graphs of f and g.
(b) (i) Explain why f −1 exists.
(ii) Hence, determine f −1 and state its domain.
(c) Find the composite function f ∘ g and state its domain and range.
(d) Express √ ln ( x−1 )−2 as a composition of functions which involves f and g.
Answer
Let y = f(x)
When y = 0, ln ( x−1 ) =0
0
x−1= ⅇ
x−1=1
x=2
Let y = g(x)
When y = 0, √ x−2=0
x−2=0
x=2
(b) (i) Since any horizontal line cuts the curve y = f(x) at only one point, f(x) is
one-to-one function. Thus, f −1 ( x ) exists.
(ii) Let y=f
−1
(x)
f ( y )=x
ln ( y −1 )=x
x
y−1=ⅇ
x
y= ⅇ +1
−1
f ( x )= ⅇ x +1
Domain of f −1 ( x ) = Range of f ( x )
= {x: x ∈R}
(c) ( f ∘ g ) ( x ) =f ( √ x−2 )
= ln ( √ x−2−1 )
Domain of f ∘ g
= Domain of g ∩ { x : √ x−2−1>0 }
= { x : x ≥ 2 } ∩ { x : x> 3 }
= { x : x >3 }
Range of f ∘ g = { y : y ∈ R }
(d) √ ln ( x−1 )−2=√ f ( x )−2
= ( g ∘ f ) (x )