• Skip to secondary menu
  • Skip to main content
  • Skip to primary sidebar
  • My Store
  • Glossary
  • Home
  • About Me
  • Contact Me

Statistics By Jim

Making statistics intuitive

  • Graphs
  • Basics
  • Hypothesis Testing
  • Regression
  • ANOVA
  • Probability
  • Time Series
  • Fun
  • Calculators

Piecewise Function

By Jim Frost

« Back to Glossary Index

What Is a Piecewise Function?

A piecewise function is a function defined by different expressions for different parts of its domain. Instead of a single rule applying everywhere, they apply different formulas in multiple intervals.

A piecewise function is a function that “pieces together” multiple sub-functions. Each sub-function governs the output for specific input values. For example, they might use one formula for all negative numbers and another formula for all positive numbers. This flexibility makes them useful for describing real-world processes that change behavior at certain thresholds.

Example of a Piecewise Function

Imagine a taxi company that charges a flat fee of $5 for rides up to 2 miles, and then charges $2 per mile beyond 2 miles. This situation can be modeled by the following piecewise function:

Piecewise function notation for the example.

Here:

  • The first part, 5, applies when the distance x is 2 miles or less.
  • The second part, 5 + 2(x – 2), applies when the distance is greater than 2 miles.

This function captures the real-world pricing structure: a fixed base fee for short rides and a per-mile rate for longer rides.

How to Graph Piecewise Functions

To graph a piecewise function, follow these steps:

  1. Identify the different rules and their corresponding domains.
  2. Graph each rule only over its specified interval.
  3. Pay attention to open and closed circles at boundary points, which show whether the boundary is included in that interval.
  4. Combine the pieces into a single graph.

These graphs often look “broken” or segmented because different formulas apply to different ranges of x-values.

The graph below depicts this piecewise function for the taxi fare example.

Graph displaying a piecewise function.

Key Characteristics

  • Defined by two or more rules.
  • Different rules apply to different intervals of the input.
  • Graphs are created by combining the pieces.
  • Useful in real-world scenarios with thresholds, limits, or conditional pricing.

In short, a piecewise function is a function that uses different rules for different ranges of inputs. Understanding how to graph them is essential for visualizing situations where relationships change depending on the input.

Related

« Back to Glossary Index

Primary Sidebar

Meet Jim

I’ll help you intuitively understand statistics by focusing on concepts and using plain English so you can concentrate on understanding your results.

Read More...

Buy My Introduction to Statistics Book!

Cover of my Introduction to Statistics: An Intuitive Guide ebook.

Buy My Hypothesis Testing Book!

Cover image of my Hypothesis Testing: An Intuitive Guide ebook.

Buy My Regression Book!

Cover for my ebook, Regression Analysis: An Intuitive Guide for Using and Interpreting Linear Models.

Subscribe by Email

Enter your email address to receive notifications of new posts by email.

    I won't send you spam. Unsubscribe at any time.

    Buy My Thinking Analytically Book!

    Cover for my book, Thinking Analytically: An Guide for Making Data-Driven Decisions.

    Top Posts

    • F-table
    • Cronbach’s Alpha: Definition, Calculations & Example
    • Z-table
    • How To Interpret R-squared in Regression Analysis
    • Interpreting Correlation Coefficients
    • Box Plot Explained with Examples
    • How to Interpret P-values and Coefficients in Regression Analysis
    • Multicollinearity in Regression Analysis: Problems, Detection, and Solutions
    • T-Distribution Table of Critical Values
    • Cohens D: Definition, Using & Examples

    Recent Posts

    • Data Collection Methods: Step-By-Step Guide with Examples
    • ANOVA Calculator
    • Positive Predictive Value: Meaning, Formula, and Interpretation
    • Median Absolute Deviation Calculator
    • Median Absolute Deviation: Definition, Finding & Formula
    • Outlier Calculator

    Recent Comments

    • Skata na fas on Comparing Regression Lines with Hypothesis Tests
    • Jim Frost on Comparing Regression Lines with Hypothesis Tests
    • Skata na fas on Comparing Regression Lines with Hypothesis Tests
    • Skata na fas on Comparing Regression Lines with Hypothesis Tests
    • Jim Frost on Pareto Chart: Making, Reading & Examples

    Copyright © 2026 · Jim Frost · Privacy Policy