Piecewise Defined Functions
[latex]g(x) = \left\{ \begin{array}{lr} x-1 & x \leq 2 \\ \frac{1}{2}x- 1 & x > 2 \end{array} \right.[/latex]
How do you do it? Well, you have to graph two different lines: [latex]y_1 = x-1[/latex] and [latex]y_2 = \frac{1}{2}x - 1[/latex]:
But then you need to “cut off” the graph of [latex]y_1[/latex] after [latex]x = 2[/latex], and “cut off” the graph of [latex]y_2[/latex] before [latex]x = 2[/latex]:
That’s the graph of [latex]g(x)[/latex]! It is called a piecewise defined function. Since each piece is linear, sometimes it is called a piecewise linear function.
There is one more detail to clear up. What is the value of the function at [latex]x=2[/latex]?
Well, going back to the original function, we see that [latex]g(x)[/latex] was defined as [latex]x-1[/latex] for [latex]x \leq 2[/latex], and this includes [latex]x=2[/latex]. So we should use the blue line to determine the y-coordinate for [latex]x=2[/latex]. To indicate this on the graph, a filled in dot can be added to the blue graph (indicating the endpoint is included), and an open or not-filled-in dot is added to the green graph (to indicate the endpoint is not included).