GeoGebra Tutorial 32 – Graphing Piecewise Functions

In this tutorial, we are going to learn how to graph piecewise functions. In our example, we will graph the piecewise function

f(x) = \begin{cases} 1-x, x \leq 1 \\x^2, x > 1 \end{cases}.

The output of our tutorial is shown below.  GeoGebra has not yet developed a way to construct piecewise functions, however, its features is more than good enough for improvisation. In the construction below, we will use the function command to graph functions with specified domains. We will create manually, the two endpoints of the functions on (1,1) and (1,0). We will also use the vector tool to construct arrows.

Click the image to go to view the applet.

If you want to follow this tutorial step-by-step, you can open the GeoGebra window in your browser by clicking here. The output applet of this tutorial can be viewed here.

Step-by-Step Instructions

1. Open GeoGebra. In this tutorial, we will not need the coordinate Axes so be sure that it is displayed. If not, from the menu bar, click View>Axes to display it in the GeoGebra window.
2. In graphing a piecewise function, we will use the function command of GeoGebra. The syntax of the function command is function [f,a,b], where f is the equation of the function, a is the start x-value and b is the end x-value. So to graph y = 1 – x with domain (-∞,1] type function[1-x, -∞,1] and the press the ENTER key. The symbol can is located on the drop-down list box located to the immediate right of the input box.
3. To graph the second function,  y = x2 from with domain (1,∞), type function[x^2,1,∞] and then press the ENTER key. Your drawing should look like Figure 1.

Figure 1

4. Now, using the New Point tool, construct two points with coordinates (1,0) and (1,1).
5. We will now change the color of the point at (1,0) to black and change the color of the point at (1,1) to white. To do this, right click the point and choose the Object Properties from the context menu.
6. In the Object Properties window, select the Color tab and choose the appropriate color.

Figure 2

7. Next, we use the Vector between Two Points on the first graph to construct arrows on the graphs.

Figure 3

8. Next, we hide the vector points.  To do this, right click the points and choose Show Object from the context menu.  Your graph should look like the figure shown above.
9. Next, use the Move Graphics View to adjust the drawing pad such that the line and curve after the vector are not shown.
10.  Save your file by clicking File>Save on the menu bar.

Related Posts Plugin for WordPress, Blogger...

13 thoughts on “GeoGebra Tutorial 32 – Graphing Piecewise Functions

    • On second thought, as far as I know, the latest version of GeOGebra does not support nested ifs yet, so I think, they have to learn the function command to create graphs of piecewise functions with more than two equations. So I think, tutorial 32 will remain as is, for now. 🙂

  1. Nope. What I typed in doesn’t translate to comment properly. I did use a nested if and it works. Let me try one more time.

    if[x < 0, -1, if[ x > 2, 0, 2-x]]

  2. Thanks for this information. I have quiet a few graphing program and none of them show me how to graph piecewise function.
    Thanks agaim.
    Do you have information how to graph greatest integer functon using geogebra?

  3. Pingback: Math and Multimedia 2011 Quarter 1 Top Posts « Mathematics and Multimedia

Leave a Reply