Piecewise Function Calculator

Build clear rules using intervals, endpoints, and expressions. Check values, discontinuities, overlaps, and matching pieces. See each boundary decision before plotting confident mathematical results.

Configure your function

Use x in expressions. Blank bounds represent negative or positive infinity.

Supported: +, −, ×, ÷, ^, sin, cos, tan, sqrt, abs, ln, log, exp, min, max, and more.

Rule 1

Interval: lower bound to upper bound. Check endpoints for [ or ].

Rule 2

Interval: lower bound to upper bound. Check endpoints for [ or ].

Rule 3

Interval: lower bound to upper bound. Check endpoints for [ or ].

Rule 4

Interval: lower bound to upper bound. Check endpoints for [ or ].

Rule 5

Interval: lower bound to upper bound. Check endpoints for [ or ].

Rule 6

Interval: lower bound to upper bound. Check endpoints for [ or ].

Evaluation and graph settings

Example data

This default set uses three continuous-looking pieces with endpoint decisions.

RuleDefinitionIntervalExample xResult
1x² − 1(−∞, 0)−23
22x + 1[0, 3]01
3√x + 2(3, ∞)44

Formula used

f(x) = fᵢ(x) whenever x belongs to the interval assigned to rule i.

For a closed boundary, use ≤ or ≥. For an open boundary, use < or >.

The calculator first finds every interval containing x. It evaluates the first matching rule. If no interval contains x, the function is undefined at that point. When two intervals overlap, the earliest rule receives priority and the result is flagged.

How to use this calculator

  1. Enable each piece you need. Enter its expression using x.
  2. Set the lower and upper bounds. Leave a bound empty for infinity.
  3. Choose whether each boundary is included or excluded.
  4. Enter an x value, sample values, and a graph range.
  5. Select Calculate and graph to show the result above the form.
  6. Download a CSV file or create a PDF after results appear.

Understanding piecewise functions

A piecewise function uses different formulas in different parts of its domain. Each formula belongs to one interval. The interval tells you when that formula applies. This structure models rules that change after a threshold. Shipping rates, tax bands, phone plans, and motion segments are familiar examples.

Start by reading the conditions before evaluating any formula. Locate the input on the number line. Then identify the interval that contains it. An endpoint bracket matters. A square bracket includes the boundary. A parenthesis leaves it out. That choice can change the answer at a single point.

For example, suppose one rule applies when x is less than zero. Another rule applies when x is greater than or equal to zero. At x = 0, only the second rule applies. The graph should show an open circle for the first rule and a closed circle for the second. These markers explain the function definition visually.

Graphs reveal important behavior

A graph shows more than output values. It exposes gaps, jumps, and overlaps. A gap occurs when no rule covers an input. A jump occurs when neighboring pieces have different output values at a boundary. A continuous join happens when the left and right behavior meets at the same included point.

Checking several values helps detect typing errors. Use points inside every interval. Also test every boundary from both sides. Compare the table with the plotted segments. When two rules cover the same input, the definition is ambiguous unless a priority order is stated. This calculator uses the earliest listed matching rule and marks the issue.

Build reliable definitions

Keep expressions simple first. Confirm interval endpoints next. Avoid accidental overlaps unless they are deliberate. Use parentheses around long expressions, especially in exponents or denominators. The supported syntax accepts x, numbers, constants such as pi, common functions, parentheses, and standard arithmetic operators.

Set the graph range wide enough to show every transition. Use a smaller graph step for curved functions. Use a larger step for a faster preview. Export the sample table when you need a record for homework, teaching notes, or model checking. A clear piecewise definition always combines a formula, an interval, and precise endpoint logic for future classroom reference.

Frequently asked questions

1. What is a piecewise function?

It is one function defined by several formulas. Each formula applies only on a stated interval or condition. The interval tells the calculator which expression to use for a given x value.

2. How do I enter multiplication?

Use an asterisk. Write 2*x+1, not 2x+1. This avoids ambiguity and lets the parser read the expression safely.

3. What does an empty bound mean?

A blank lower bound means negative infinity. A blank upper bound means positive infinity. The rule can continue in that direction without a finite endpoint.

4. What is the difference between an open and closed endpoint?

A closed endpoint includes the boundary value. An open endpoint excludes it. On the graph, closed endpoints use filled dots and open endpoints use hollow dots.

5. Why is my result undefined?

No enabled interval included your x value, or the selected expression was outside its real-number domain. Check gaps between intervals, endpoint choices, square roots, logarithms, and denominators.

6. What happens when rules overlap?

The calculator uses the first matching rule in display order. It also marks the point as an overlap. Revise intervals when you need a unique function value.

7. Can I use trigonometric functions?

Yes. Use functions such as sin(x), cos(x), and tan(x). Angles are interpreted in radians, as in standard mathematics software.

8. Can I add more than three pieces?

Yes. The form provides six configurable rules. Enable only the rules you need. Disabled rules are ignored during evaluation, graphing, and exports.

9. Why does the graph show a gap?

A gap may be intentional. It appears when no rule covers an x value, when an endpoint is open, or when an expression is undefined at a plotted point.

10. What does CSV export include?

The CSV file includes the selected evaluation, each enabled rule, intervals, and the sample table. It opens in spreadsheet software for checking or record keeping.

11. How do I get a PDF?

Calculate first, then select Download PDF. The page creates a printable result snapshot with the graph and summary tables. Browser printing is also available.


Related Calculators

Inverse Function Finder CalculatorPolynomial Long Division Calculatorroots of cubic equation calculatorquadratic function from 3 points calculatorWeighted linear regression calculatorremainder and factor theorem calculatordivide using long division calculatorsynthetic division remainder calculatorLCM fraction Calculatorfactor polynomials by grouping calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.