Skip to main content

Piecewise Function Evaluator Calculator

Free Piecewise function evaluator Calculator for algebra. Enter values to get step-by-step solutions with formulas and graphs.

Share this calculator

Formula

f(x) = { g(x) if x < c, h(x) if x >= c }

A piecewise function uses different formulas for different intervals of the domain. The breakpoint c divides the domain into regions where different rules apply. Continuity requires g(c) = h(c). Differentiability additionally requires the slopes to match at the breakpoint.

Worked Examples

Example 1: Evaluating a Piecewise Function at Multiple Points

Problem: Given f(x) = 3x + 1 for x < 2 and f(x) = -2x + 9 for x >= 2, evaluate f(-1), f(2), and f(5).

Solution: f(-1): Since -1 < 2, use left piece: f(-1) = 3(-1) + 1 = -2\nf(2): Since 2 >= 2, use right piece: f(2) = -2(2) + 9 = 5\nf(5): Since 5 >= 2, use right piece: f(5) = -2(5) + 9 = -1\n\nContinuity check at x = 2:\nLeft limit: 3(2) + 1 = 7\nRight value: -2(2) + 9 = 5\n7 does not equal 5, so there is a jump discontinuity of size 2.

Result: f(-1) = -2 | f(2) = 5 | f(5) = -1 | Jump discontinuity at x = 2

Example 2: Checking Continuity of a Piecewise Function

Problem: Is f(x) = 2x + 1 for x <= 3 and f(x) = -x + 10 for x > 3 continuous at x = 3?

Solution: Left limit (as x approaches 3 from left):\nlim = 2(3) + 1 = 7\n\nRight limit (as x approaches 3 from right):\nlim = -(3) + 10 = 7\n\nFunction value at x = 3 (left piece applies since x <= 3):\nf(3) = 2(3) + 1 = 7\n\nAll three values equal 7.\n\nDifferentiability: Left slope = 2, Right slope = -1\nSlopes differ, so the function has a corner (not differentiable) at x = 3.

Result: Continuous at x = 3 (f(3) = 7) | Not differentiable (corner point)

Frequently Asked Questions

What is a piecewise function and when is it used?

A piecewise function is a function defined by different formulas or rules for different parts of its domain. Instead of using a single expression for all inputs, the function switches between two or more expressions depending on where the input falls. For example, the absolute value function |x| is piecewise: it equals x when x >= 0 and -x when x < 0. Piecewise functions are used extensively in real-world modeling because many phenomena behave differently under different conditions. Tax brackets, shipping rates, overtime pay, and cell phone plans all use piecewise pricing. In engineering, stress-strain relationships are piecewise because materials behave differently before and after their yield point.

How do you evaluate a piecewise function at a specific point?

To evaluate a piecewise function at a specific x value, first determine which piece of the function applies by checking which condition the x value satisfies. Then substitute the x value into the corresponding formula. For example, given f(x) = 2x + 1 if x < 3 and f(x) = x^2 - 2 if x >= 3, to find f(5): since 5 >= 3, use the second piece: f(5) = 5^2 - 2 = 23. To find f(1): since 1 < 3, use the first piece: f(1) = 2(1) + 1 = 3. At the breakpoint x = 3: since 3 >= 3, use the second piece: f(3) = 9 - 2 = 7. Always pay careful attention to whether the breakpoint uses strict or non-strict inequalities.

What does it mean for a piecewise function to be continuous?

A piecewise function is continuous at a breakpoint if the left-hand limit, right-hand limit, and function value at that point all agree. In practical terms, this means there is no gap or jump in the graph at the transition point. Mathematically, if the breakpoint is at x = c, then lim(x approaches c from the left) f(x) must equal lim(x approaches c from the right) f(x) must equal f(c). For example, f(x) = 2x + 1 for x < 2 and f(x) = 5 for x >= 2 is continuous at x = 2 because 2(2) + 1 = 5 matches the value from the right piece. If these values differ, there is a jump discontinuity and the function has a visible break in its graph.

What is a jump discontinuity in a piecewise function?

A jump discontinuity occurs when the left-hand limit and right-hand limit exist at a breakpoint but do not equal each other. The function literally jumps from one value to another. For example, the Heaviside step function equals 0 for x < 0 and 1 for x >= 0. At x = 0, the left limit is 0 and the right limit is 1, creating a jump of size 1. Jump discontinuities are common in real-world models: an employee's hourly rate jumps at the overtime threshold, water utility rates jump at usage tiers, and tax rates jump at bracket boundaries. The size of the jump equals the absolute difference between the left and right limits. Functions with jump discontinuities are called piecewise continuous.

How do you determine if a piecewise function is differentiable at a breakpoint?

A piecewise function is differentiable at a breakpoint only if it satisfies two conditions: it must be continuous at that point AND the derivatives from both sides must be equal. Continuity alone is not sufficient. For example, the absolute value function f(x) = -x for x < 0 and f(x) = x for x >= 0 is continuous at x = 0 (both sides give f(0) = 0), but the left derivative is -1 and the right derivative is +1, so it is not differentiable at x = 0. The graph has a sharp corner there. For the function to be smooth (differentiable), the pieces must connect without a corner, meaning both the function values and the slopes must match at the breakpoint.

How do you graph a piecewise function?

To graph a piecewise function, graph each piece separately on its own restricted domain, then combine them into one coordinate plane. For each piece, draw the line or curve only over the interval where that formula applies. At breakpoints, use a solid dot (filled circle) to indicate the function value at that point, and an open dot (hollow circle) to indicate a value that is approached but not attained. For example, for f(x) = x + 1 if x < 2 and f(x) = -x + 5 if x >= 2, draw the line y = x + 1 only for x values less than 2 with an open circle at (2, 3), and draw y = -x + 5 for x >= 2 with a filled circle at (2, 3). This visual representation clearly shows continuity, jumps, and corners.

References