calculatorplustools.com

Piecewise Function Calculator

Define, evaluate, and graph functions defined on multiple intervals.

Define Your Function


Understanding Piecewise-Defined Functions

A piecewise function is a function built from different "pieces," where each piece is its own function that applies to a specific interval or domain. Instead of a single rule for all inputs, a piecewise function follows different rules for different parts of its domain. This makes them incredibly versatile for modeling real-world scenarios that change based on certain conditions.

How to Read and Evaluate a Piecewise Function

Evaluating a piecewise function is a two-step process. First, you determine which domain interval your input value (x) falls into. Second, you apply the specific function rule associated with that interval. For example, consider the function:

f(x) = x² , if x < 0 2x + 1 , if x ≥ 0

To find f(3), you first check the conditions. Since 3 is greater than or equal to 0, you use the second rule: f(3) = 2(3) + 1 = 7. To find f(-2), you check the conditions again. Since -2 is less than 0, you use the first rule: f(-2) = (-2)² = 4.

Graphing Piecewise Functions

Graphing a piecewise function involves drawing each piece on the same coordinate plane, but only over its specified domain. An important detail is how to mark the endpoints of each interval.

  • A closed circle (●) is used when the interval includes the endpoint (e.g., ≤ or ≥).
  • An open circle (○) is used when the interval does not include the endpoint (e.g., < or >).

The final graph might be continuous, or it could have "jumps" (discontinuities) where one piece ends and another begins. This calculator handles plotting each segment and its endpoints for you.

Real-World Applications

Piecewise functions are excellent for modeling situations that aren't described by a single, simple formula. For example:

  • Utility Bills: A common scenario is electricity pricing, where the cost per kilowatt-hour changes after you exceed a certain usage threshold.
  • Income Tax Brackets: Tax rates are applied piecewise, with different rates for different levels of income.
  • Shipping Costs: The cost to ship a package often depends on its weight, with different pricing tiers for different weight ranges. A package's size might also be a factor, which could be measured with a tool like our surface area calculator.