A piecewise function uses different formulas on different parts of its domain. The main challenge is not drawing each formula; it is applying the correct interval to each branch and showing whether boundary points are included.
Quick method: add one function object for each branch, restrict each object to its stated interval, and then mark open or closed endpoints when the graph needs to show inclusion explicitly.
1. Read the definition branch by branch
Consider
\[f(x)=\begin{cases}x^2,&x<0,\\2x+1,&x\ge 0.\end{cases}\]
The first branch is the left half of the parabola \(y=x^2\). The second branch is the part of the line \(y=2x+1\) beginning at \(x=0\). Drawing the entire parabola and entire line would be incorrect because each rule is valid only on its own interval.
2. Create one restricted graph for each branch
- Open the Online Graphing Calculator.
- Add the first function and enter
x^2. - Use the function’s interval or condition controls to keep only \(x<0\).
- Add a second function and enter
2*x+1. - Restrict the second branch to \(x\ge0\).
If the current graph mode accepts a condition directly, use the same inequalities there. If not, separate objects with domain restrictions are clearer and easier to edit.
3. Handle open and closed endpoints
At \(x=0\), the first branch approaches \(0\) but does not include it because its condition is strict. The second branch includes \(x=0\), so \(f(0)=1\).
- Place an open point at \((0,0)\) for the excluded endpoint.
- Place a filled point at \((0,1)\) for the included endpoint.
These endpoint markers make the jump visible even when the curve itself is thick or the viewing window is small.
4. Test continuity at every boundary
At a boundary \(x=a\), compare
\[\lim_{x\to a^-}f(x),\qquad \lim_{x\to a^+}f(x),\qquad f(a).\]
For this example, the left-hand limit at zero is \(0\), the right-hand limit is \(1\), and \(f(0)=1\). Because the one-sided limits differ, the function has a jump discontinuity at zero.
5. A continuous piecewise example
Now consider
\[g(x)=\begin{cases}x+2,&x<1,\\x^2,&x\ge1.\end{cases}\]
The left-hand value approaches \(3\), while the right branch begins at \(1\), so this example is not continuous. To make the branches meet, use \((x-1)^2+3\) for the second branch. Then both sides meet at \((1,3)\).
Common mistakes
- Graphing every formula over the full real line.
- Using \(<\) when the definition requires \(\le\), or vice versa.
- Placing the endpoint marker on the wrong branch.
- Assuming two branches are continuous because they look close at the current zoom level.
- Forgetting that the domain may contain gaps where no branch applies.
Export a clear result
Use contrasting colors for adjacent branches, keep endpoint markers large enough to see, and export as SVG when the graph will be enlarged. Save an OGP project as well if you want to revise the intervals later.
Next, read how to distinguish removable, jump, and infinite discontinuities, or review domain and range from a graph.