2. Functions

Piecewise Functions

Piecewise Functions

Introduction: Why one rule is not always enough πŸ‘€

students, in real life, many situations do not follow just one smooth rule. A tax system may charge one rate for the first part of an income and a different rate after that. A phone plan may cost one amount up to a certain number of gigabytes and another amount after that. A temperature control system may switch behavior depending on the time of day. These are all examples of piecewise functions, which are functions defined by different formulas on different parts of their domain.

In this lesson, you will learn how to read, write, graph, and interpret piecewise functions. You will also see how they connect to the broader study of functions in IB Mathematics: Applications and Interpretation HL. By the end, you should be able to explain what the function is doing in context, identify where the rule changes, and use technology or algebra to analyze the graph and its behavior.

Learning goals

  • Understand the meaning of a piecewise function and its key vocabulary
  • Use piecewise definitions to model real-world situations
  • Graph piecewise functions and identify important features
  • Interpret continuity, jumps, and endpoints in context
  • Connect piecewise functions to function notation, transformations, and modeling

What is a piecewise function?

A piecewise function is a function made from two or more formulas, each used on a specified part of the domain. Instead of one equation working everywhere, different rules apply in different intervals.

A general piecewise definition might look like this:

$$

$f(x)=$

$\begin{cases}$

$\text{rule 1,}$ & \text{if } x \text{ is in one interval} \\

$\text{rule 2,}$ & \text{if } x \text{ is in another interval} \\

$\text{rule 3,}$ & \text{if } x \text{ is in a third interval}

$\end{cases}$

$$

The most important idea is that each input $x$ must use exactly one rule. That is what makes it a function. If the same $x$ had two different outputs, it would not be a function.

Key vocabulary

  • Domain: the set of input values allowed
  • Range: the set of output values produced
  • Interval: a section of numbers such as $x<2$ or $3\le x\le 5$
  • Endpoint: a boundary value where the rule changes
  • Closed dot: included endpoint, often shown with a filled circle
  • Open dot: excluded endpoint, often shown with an empty circle

In piecewise graphs, endpoints matter a lot because they show whether a value belongs to one interval or the next. A correct graph must show these choices clearly.

Reading and writing piecewise rules πŸ“˜

students, to understand a piecewise function, first identify the condition next to each formula. The condition tells you when that formula is used. For example:

$$

$f(x)=$

$\begin{cases}$

2x+1, & x<0 \\

$x^2, & 0\le x\le 3 \\$

7, & x>3

$\end{cases}$

$$

This means:

  • If $x<0$, use $2x+1$
  • If $0\le x\le 3$, use $x^2$
  • If $x>3$, use $7$

If you want to find $f(-2)$, use the first rule because $-2<0$. So $f(-2)=2(-2)+1=-3$.

If you want to find $f(2)$, use the second rule because $0\le 2\le 3$. So $f(2)=2^2=4$.

If you want to find $f(5)$, use the third rule because $5>3$. So $f(5)=7$.

Why the conditions matter

The conditions are not decoration. They define the function. Without them, the formula would be incomplete because you would not know which rule applies where. This is one reason piecewise functions are closely tied to the idea of domain restriction in function notation.

A useful habit is to check:

  1. Which interval contains the input?
  2. Which formula matches that interval?
  3. Does the endpoint belong to the left side, right side, or neither?

Graphing piecewise functions with care πŸ“ˆ

When graphing a piecewise function, you graph each rule only on the part of the domain where it is valid. This is similar to drawing a road map with different speed limits in different zones: the rule changes depending on location.

Consider the function

$$

$f(x)=$

$\begin{cases}$

-x+2, & x<1 \\

$1, & x\ge 1$

$\end{cases}$

$$

To graph it:

  • Draw the line $y=-x+2$ only for $x<1$
  • At $x=1$, the first rule is not included, so place an open dot at the point on the line where $x=1$
  • Draw the horizontal line $y=1$ for $x\ge 1$
  • At $x=1$, the second rule is included, so place a closed dot at $(1,1)$

This graph has a jump at $x=1$ because the two pieces meet at different $y$-values. If the values matched exactly and the function connected without a break, the graph would be continuous at that point.

Continuity and discontinuity

A piecewise function can be:

  • Continuous at a point if the pieces connect without a gap or jump
  • Discontinuous if there is a break, jump, or missing point

For IB analysis, you should describe these features using clear mathematical language. For example, saying β€œthe function jumps from $2$ to $5$ at $x=3$” is better than saying β€œit changes suddenly.”

A good graph interpretation includes:

  • where the function starts and ends
  • where the rule changes
  • whether endpoints are included
  • whether the graph is continuous or discontinuous
  • what the function means in context

Real-world modeling with piecewise functions πŸ’‘

Piecewise functions are powerful because many real systems behave differently in different ranges. Here are some common examples.

Example 1: Taxi fare

A taxi might charge a base fee plus a distance rate, but only after a starting distance. For instance:

$$

$C(d)=$

$\begin{cases}$

$5, & 0\le d\le 2 \\$

5+1.8(d-2), & d>2

$\end{cases}$

$$

This could mean the first $2$ km cost a flat $5$ dollars, and beyond that the cost increases by $1.80$ per km. The piecewise structure reflects a pricing policy.

Example 2: Electricity pricing

An energy company may charge one rate for the first block of usage and another rate after that. A function like this might model the bill depending on $x$, the number of kilowatt-hours used.

Example 3: Temperature or machine behavior

A heater might stay off below a threshold, run at medium power in one temperature range, and run at full power above another. Piecewise functions are useful because they can model systems that switch modes.

In IB Mathematics: Applications and Interpretation HL, you should be able to explain what each piece means in the real context, not just calculate values.

Connecting piecewise functions to the broader topic of functions πŸ”—

Piecewise functions are a direct extension of the idea of a function as a rule that assigns each input exactly one output. They connect to many other parts of the functions topic.

1. Function notation

You still use notation like $f(x)$ or $g(t)$. The difference is that the rule for $f(x)$ changes depending on the value of $x$.

2. Domain and range

Piecewise functions often have restricted domains. You must know which values are allowed and which are not. The range may also depend on each piece.

3. Graph transformations

A piece may look like a familiar graph, such as a linear or quadratic graph, but only on part of the domain. This means transformation ideas still matter. For example, one piece might be $x^2+3$, which is a translated parabola, but only for $x\ge 0$.

4. Regression and fitting

In some data sets, a single model does not fit all the points well. A piecewise model may fit better when the relationship changes after a threshold. This is related to technology-supported analysis, where you may use graphing software to test models and compare fit.

5. Interpretation in context

In IB, mathematics is not only about getting an equation. It is also about explaining what the model means. A piecewise function often tells a story about changing conditions, such as costs, growth, or limits.

Common exam skills and mistakes to avoid 🧠

Here are the most important skills you should practice:

  • Evaluate the correct piece for a given input
  • Sketch each rule only on its valid interval
  • Use open and closed dots correctly
  • Explain what the function represents in context
  • Identify continuity and jumps at endpoints
  • Check that intervals do not overlap in a way that gives two outputs for one input

Common mistakes include:

  • Using the wrong rule because the endpoint condition was ignored
  • Drawing every piece across the whole graph instead of limiting the domain
  • Forgetting that open dots mean the point is excluded
  • Describing the graph without mentioning what happens at the boundary
  • Assuming a piecewise function must be complicated; many are quite simple

Technology can help check your work. A graphing calculator or computer algebra system can show whether your sketch matches the function definition. Still, you must understand the rules yourself because technology does not replace interpretation.

Conclusion

students, piecewise functions are an important part of the study of functions because they show how mathematics can model changing situations in a precise way. They use different formulas on different parts of the domain, so you must pay close attention to intervals, endpoints, and graph behavior. In IB Mathematics: Applications and Interpretation HL, piecewise functions help you analyze real-world contexts, interpret graphs, and use technology to study relationships that do not follow a single rule. When you understand piecewise functions, you are better prepared to read models, build your own models, and explain what they mean.

Study Notes

  • A piecewise function uses different rules on different intervals of the domain.
  • Each input must match exactly one rule, or the relation is not a function.
  • Conditions such as $x<0$ or $x\ge 2$ tell you when each formula applies.
  • Open dots show excluded endpoints; closed dots show included endpoints.
  • To evaluate a piecewise function, first find the correct interval, then use the matching formula.
  • To graph a piecewise function, draw each piece only on its allowed domain.
  • Piecewise functions can be continuous or discontinuous at boundary points.
  • Real-world examples include taxi fares, tax brackets, electricity bills, and machine control systems.
  • Piecewise models connect to domain, range, graphing, transformations, and interpretation.
  • In IB Mathematics: Applications and Interpretation HL, piecewise functions are used to model changing relationships and analyze data with technology.

Practice Quiz

5 questions to test your understanding