TOPIC

Evaluating piecewise functions

MY PROGRESS

Pug Score

0%

Study Points

+0

Overview

Watch

Read

Next Steps


Get Started

Get unlimited access to all videos, practice problems, and study tools.

Unlimited practice
Full videos

Back to Menu

Topic Progress

Pug Score

0%

Videos Watched

0/0

Read

Not viewed


Study Points

+0

Read

Evaluating Piecewise Functions

Evaluating a piecewise function means matching an input value to the correct interval, then substituting it into the matching rule. This lesson walks through the process step by step with fully worked examples, showing how to check domain restrictions and avoid the most common mistakes students make.

What Does It Mean to Evaluate a Piecewise Function?

A piecewise function is really several different rules stitched together, each one valid only over its own slice of the domain. You have likely already studied function notation and how to describe the domain and range of a function; evaluating a piecewise function combines both of those skills. Instead of one formula that works everywhere, you get something like:

\( f(x) = \begin{cases} 2x + 1, & x < 0 \)
\( x^2, & 0 \le x < 3 \)
\( 7, & x \ge 3 \end{cases} \)

To evaluate this at a particular input, say \(f(-2)\), your job is to figure out which line applies to \(x = -2\), and then only use that rule. You never plug a number into every piece; you plug it into exactly one.

Steps for Evaluating a Piecewise Function

Every evaluation problem follows the same short routine:

  1. Look at the x-value you were given.
  2. Compare it against each interval listed for the function until you find the one that contains it.
  3. Pay close attention to whether the boundary uses \(<\), \(\le\), \(>\), or \(\ge\), since that decides which piece "owns" the endpoint.
  4. Substitute the x-value only into the rule that matches that interval.
  5. Simplify the resulting expression to get the final output value.

Worked Example 1: Evaluating at Several Values

Using the function above, \( f(x) = \begin{cases} 2x + 1, & x < 0 \)
\( x^2, & 0 \le x < 3 \)
\( 7, & x \ge 3 \end{cases} \), evaluate \(f(-2)\), \(f(2)\), and \(f(5)\).

Finding \(f(-2)\): Since \(-2 < 0\), this input belongs to the first piece, \(2x + 1\). Substitute to get \(2(-2) + 1 = -4 + 1 = -3\). So \(f(-2) = -3\).

Graph of y = 2x + 1 for x less than 0, with the point at x = -2 marked Plot of y = 2*x + 1 for x in [-5, 0] -5 -4 -3 -2 -1 0 -10 -8 -6 -4 -2 0 2 x y f(-2)
The rule \(y = 2x + 1\) applies only where \(x < 0\), so \(f(-2)\) is read from this branch.

Finding \(f(2)\): Since \(0 \le 2 < 3\), this input belongs to the second piece, \(x^2\). Substitute to get \(2^2 = 4\). So \(f(2) = 4\).

Graph of y = x squared for x between 0 and 3, with the point at x = 2 marked Plot of y = x**2 for x in [0, 3] 0 0.5 1 1.5 2 2.5 3 0 2 4 6 8 10 x y f(2)
The rule \(y = x^2\) applies only where \(0 \le x < 3\), so \(f(2)\) is read from this branch.

Finding \(f(5)\): Since \(5 \ge 3\), this input belongs to the third piece, the constant value \(7\). No substitution is even needed here; the rule simply says the output is \(7\) for every x in that interval. So \(f(5) = 7\).

Worked Example 2: A Boundary Value

Boundary values are where mistakes usually happen, because it looks like two pieces could apply. Consider \( g(x) = \begin{cases} 3x - 1, & x \le 1 \)
\( x + 4, & x > 1 \end{cases} \) and evaluate \(g(1)\).

Even though \(1\) sits right at the edge, the inequality on the first rule includes "\(\le\)", meaning \(x = 1\) belongs there, not to the second rule. Substitute into \(3x - 1\): \(3(1) - 1 = 2\). So \(g(1) = 2\), and the second rule, \(x + 4\), is never used for this input because its condition is a strict "\(>\)" that excludes \(1\).

Common Mistakes to Avoid

Most errors when evaluating piecewise functions come from one of these habits:

  • Substituting into every rule and then guessing which answer looks "right," instead of first checking the interval.
  • Misreading a strict inequality as non-strict (or the reverse), which sends a boundary value to the wrong piece.
  • Forgetting that a constant piece, like \(7\) in the first example, is still a valid rule even though there is nothing to substitute.
  • Mixing up evaluating the function (finding an output for a given input) with graphing it. If you need to sketch the full picture across all intervals, that is covered separately in graphing piecewise linear functions and its non-linear counterpart.

Quick Recap

Evaluating a piecewise function is a matching game before it is a substitution problem: find the interval that contains your x-value, confirm the inequality symbols include or exclude that exact number, then substitute into just that one rule. Once you get comfortable checking boundaries carefully, evaluating these functions becomes no harder than evaluating any ordinary function.

Related lessons