Piecewise Functions

April 12, 2026

Problem

Graph f(x) = {x² if x<0, 2x+1 if x≥0} and check continuity at the boundary.

Explanation

What is a piecewise function?

A piecewise function uses different formulas on different intervals of xx. To evaluate it at a specific xx, first determine which interval xx falls in, then use that piece's formula.

Example: f(x)={x2if x<02x+1if x0f(x) = \begin{cases} x^2 & \text{if } x < 0 \\ 2x+1 & \text{if } x \geq 0 \end{cases}

At x=3x = -3: use x2x^2f(3)=9f(-3) = 9. At x=2x = 2: use 2x+12x+1f(2)=5f(2) = 5.

Checking continuity at the boundary

At x=0x = 0: left limit = 02=00^2 = 0; right value = 2(0)+1=12(0)+1 = 1. Since 010 \neq 1, there's a jump discontinuity.

Graphing rules

  • Draw each piece only on its interval.
  • Use open circle (∘) at endpoints not included (<< or >>).
  • Use closed circle (●) at endpoints included (\leq or \geq).

Try it in the visualization

Toggle each piece on/off. Open/closed dots at boundaries show ownership. Adjust the second piece's slope and intercept to make the function continuous (dots meet). Continuityrequires the left and right limits to agree at each boundary. Here at x=0x=0: left limit = 02=00^2 = 0, right value = 2(0)+1=12(0)+1 = 1. Gap of 1 → discontinuous.

Interactive Visualization

Parameters

2.00
1.00
0.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Piecewise Functions | MathSpin