Piecewise Function Examples in Math

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Piecewise Function.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in Math.

Concept Recap

A piecewise function is defined by different formulas on different non-overlapping intervals of its domain, with the applicable formula determined by the input value.

A piecewise function is like a rulebook: look up which rule applies to your input value, then use only that rule to compute the output.

Read the full concept explanation โ†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: Each piece has its own formula valid only on its own sub-domain. The complete function is the union of all pieces โ€” no input uses more than one rule.

Common stuck point: Always check which piece to use before computing โ€” substituting into the wrong formula gives the wrong answer even if the algebra is perfect.

Sense of Study hint: Write down which interval your x-value falls in first, then use only that piece's formula. Check both sides at boundary points.

Worked Examples

Example 1

easy
Evaluate f(x) = \begin{cases} x^2 & x < 0 \\ 2x + 1 & x \geq 0 \end{cases} at x = -3, x = 0, and x = 4.

Solution

  1. 1
    For x = -3: since -3 < 0, use f(x) = x^2. So f(-3) = (-3)^2 = 9.
  2. 2
    For x = 0: since 0 \geq 0, use f(x) = 2x+1. So f(0) = 2(0)+1 = 1.
  3. 3
    For x = 4: since 4 \geq 0, use f(x) = 2x+1. So f(4) = 2(4)+1 = 9.

Answer

f(-3)=9,\; f(0)=1,\; f(4)=9
In a piecewise function, the domain is partitioned into intervals, each with its own rule. The key skill is identifying which interval the input belongs to before applying the corresponding formula.

Example 2

medium
Determine whether f(x) = \begin{cases} x + 1 & x < 2 \\ 3 & x = 2 \\ 2x - 1 & x > 2 \end{cases} is continuous at x = 2.

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
Given g(x) = \begin{cases} -x & x < -1 \\ x^2 & -1 \leq x \leq 2 \\ 5 & x > 2 \end{cases}, evaluate g(-2), g(1), and g(3).

Example 2

hard
Find the value of c so that f(x) = \begin{cases} cx + 1 & x \leq 3 \\ x^2 - 2 & x > 3 \end{cases} is continuous at x = 3.

Background Knowledge

These ideas may be useful before you work through the harder examples.

function definitiondomain