Smart Calculator

Free Online Calculators

Community
About UsContact UsPrivacy PolicyTerms & ConditionsEditorial Guidelines
Loading...

Piecewise Function Definition

Define each piece of your piecewise function with expressions and domains

Piecewise Function Definition
Define each piece of your piecewise function with expressions and domains
Piece1
Piece2
Piece3
Interactive Graph

Rate this Tool

How useful was this calculator for you?

4.5
3.6K Reviews
Tap stars to rate
4.5/ 5
3.6KReviews

How to Use This Calculator

Step-by-step guide to get accurate results

1

Piecewise Function Calculator & Grapher: What It Is and How to Use It

A Piecewise Function Calculator & Grapher is an online tool that allows you to define, evaluate, and graph functions made of multiple pieces, each valid over a specific interval.
2

How to Use the Calculator

Open the Calculator

Access it directly in your browser.

Define Function Pieces

Enter each expression along with its interval (e.g., x < 0, 0 ≤ x < 2, x ≥ 2).

Enter x-Values

Specify points where you want to evaluate the function.

Set Graph Range

Optionally choose the domain for plotting.

Click Calculate / Graph

Instantly see function values and a graph.

Check Results

Verify boundary points for accuracy.
3

Key Features

Supports Multiple Pieces

Add as many sub-functions with different intervals as needed.

Instant Evaluation

Quickly compute f(x) for any x-value.

Graphing Functionality

Visualize all pieces, including jumps and endpoints.

Mobile-Friendly

Works on desktops, tablets, and smartphones.

Handles Complex Functions

Supports polynomials, trigonometric, exponential, absolute values, and more.

Free & Easy

No downloads or registration required.
4

Who Can Benefit

Students & Homework Help

Understand piecewise functions faster.

Teachers

Create clear, visual classroom demonstrations.

Function Analysis

Explore how functions change across intervals.

Real-World Modeling

Apply to pricing tiers, tax brackets, or step functions.

Quick Graphing

Save time compared to manual plotting.
5

Example Calculations

Example 1 – Basic Piecewise Function

f(x) defined as: x² for x < 0; 2x + 1 for 0 ≤ x < 3; 5 for x ≥ 3. Evaluation: f(-2)=4, f(1)=3, f(4)=5.

Example 2 – Trigonometric Piecewise Function

f(x) defined as: sin(x) for x < π/2; cos(x) for x ≥ π/2. Evaluation: f(π/4)≈0.707, f(π/2)=0, f(π)=-1.

Frequently Asked Questions

What is a Piecewise Function Calculator & Grapher?

It lets you define, evaluate, and graph piecewise functions with multiple intervals.

Is this calculator free?

Yes, it’s completely free online.

Do I need software?

No, it works directly in any browser.

Can I graph my piecewise functions?

Yes, it generates accurate graphs with correct intervals.

Can I add multiple pieces?

Yes, you can define as many sub-functions as needed.

Does it support trig, exponential, or absolute value functions?

Yes, all standard mathematical expressions are supported.

Is it suitable for students?

Yes, it’s ideal for learning, homework, and practice.

Can it handle discontinuities?

Yes, jumps and endpoint conditions are represented accurately.

Can I evaluate at any point?

Yes, simply enter x-values and it will compute f(x).

How accurate is it?

It provides precise function values and graphs for standard piecewise functions.

Related Other Calculators

Explore these related calculation tools

GPA Calculator
Calculate GPA based on course grades and credits.
IP Subnet Calculator
Calculate subnets and IP ranges.
What is a Piecewise Function?

A piecewise function is a function that is defined by different expressions over different intervals of its domain. Each "piece" of the function applies to a specific range of input values, allowing for complex behaviors like discontinuities, different growth rates, and varied mathematical relationships.

Piecewise functions are commonly used to model real-world situations where different rules apply under different conditions, such as tax brackets, shipping costs, or physical phenomena with distinct phases.

How to Use the Calculator
  1. Define each piece by entering a mathematical expression (use x as the variable)
  2. Specify the domain for each piece using inequality notation (<=, <, >, >=)
  3. Choose colors for each piece to distinguish them on the graph
  4. Set the viewing window by adjusting Min/Max X and Y values
  5. Configure graph options (grid, axes, labels)
  6. Click "Plot Function" to visualize your piecewise function
  7. Use "Example" to load a sample piecewise function
Piecewise Function Formula & Rules
f(x) = {
f₁(x),   if domain 1
f₂(x),   if domain 2
  ⋮
fₙ(x),   if domain n
}

Domain Notation:

  • Closed interval:a <= x <= b (includes endpoints)
  • Open interval:a < x < b (excludes endpoints)
  • Half-open:a <= x < b or a < x <= b
  • Unbounded:x > a, x <= b, etc.
  • Point domain:x = a (single point)

Endpoint Behavior:

  • Filled circle:Point is included (<=, >=, =)
  • Open circle:Point is excluded (<, >)
  • Discontinuities:Gaps where no piece is defined
  • Asymptotes:Vertical lines where function approaches ±∞
Example

Example piecewise function:

f(x) = {
x²,          for -2 <= x < 0 (red)
sin(x),      for 0 <= x <= 3 (blue)
1/(x-2),   for 3 < x <= 5 (green)
}

Steps:

  1. Parse domain intervals and check for validity
  2. Plot each expression in its specified color within its domain
  3. Show filled circles at included endpoints, open circles at excluded endpoints
  4. Handle discontinuity at x=2 for the third piece (vertical asymptote)
  5. Display graph with legend showing expression → domain mapping

Output:Interactive graph showing three distinct pieces with proper endpoint markers, plus a table of sample evaluation points demonstrating which piece applies at different x-values.

FAQ

What is a piecewise function?

A piecewise function is a function defined by multiple sub-functions, each applying to a specific interval of the domain. It allows for different mathematical behaviors across different ranges of input values.

How do you graph piecewise functions?

Graph each piece separately within its specified domain, paying careful attention to endpoint inclusion/exclusion. Use filled circles for included endpoints and open circles for excluded endpoints. Connect continuous pieces and leave gaps for discontinuities.

What's the difference between open and closed intervals?

Closed intervals (<=, >=) include their endpoints, shown with filled circles. Open intervals (<, >) exclude their endpoints, shown with open circles. Half-open intervals include one endpoint but not the other.

Can piecewise functions be discontinuous?

Yes, piecewise functions can have discontinuities where pieces don't connect, have different values at boundaries, or where no piece is defined. They can also have vertical asymptotes where function values approach infinity.