How to Solve Piecewise Functions?

How to Solve Piecewise Functions?

A piecewise function is a function defined by two or more separate rules (expressions), each applying to a specific part of the domain. The key is identifying which rule to use based on where the input value falls. Piecewise functions appear throughout Algebra 1 and calculus, and they are also used to model real-world situations like tax brackets and shipping costs. This guide explains how to evaluate and graph piecewise functions step by step.

Quick answer: A piecewise function uses different rules on different parts of its domain. To evaluate it, find the interval that contains your x-value, then use only that rule. Example: f(x) = x + 2 when x < 1, and f(x) = 3x when x ≥ 1. For f(4), 4 is at least 1, so f(4) = 3(4) = 12. For f(0), 0 is less than 1, so f(0) = 2.

Tutor-style math help

Solve Piecewise Functions: what to notice and how to work it

Functions skill
A function is a rule that gives each input exactly one output. Function notation, tables, graphs, and equations are different ways to show the same input-output relationship.

What to notice first

Ask what kind of input you are given. Sometimes you substitute a number, sometimes you read a graph, and sometimes you combine two rules.

Common student mistake

Do not read \(f(4)\) as multiplication. It means the output of f when the input is 4.

Key formulas and cues

\(f(a)\text{ means replace }x\text{ with }a\)
\((f\circ g)(x)=f(g(x))\)
\(f^{-1}(x)\text{ reverses }f(x)\)
inputsoutputs-102137

A reliable path

  1. Identify the inputFind the x-value, expression, or inner function being used.
  2. Apply the ruleSubstitute with parentheses so signs and powers stay clear.
  3. Interpret the outputState the value, point, interval, domain, range, or inverse relationship.

Worked examples

Evaluate a function

Example: \(f(x)=4x-3\), find \(f(2)\)
  1. Replace x with 2.
  2. Compute 4(2) – 3.
  3. Simplify.
Answer: \(5\)

Compose functions

Example: \(f(x)=x+1\), \(g(x)=2x\), find \(f(g(3))\)
  1. Find g(3) = 6.
  2. Use that as the input for f.
  3. f(6) = 7.
Answer: \(7\)
Try one before moving on
Try: If \(h(x)=2x^2\), find \(h(-3)\).
Answer: \(18\). Use parentheses: \(2(-3)^2=18\).
Next step: do the matching worksheet or quiz while the method is still fresh, then come back and explain the first step in your own words.

What Is a Piecewise Function?

A piecewise function is written using a brace notation that lists each rule alongside its domain condition. For example:

Original price was: $27.99.Current price is: $17.99.
f(x) = { \(\color{blue}{2x + 3}\), if x < 0 { 1, if \(\color{blue}{x = 0}\) { \(\color{blue}{x^{2} - 1}\), if x > 0

Need more practice? Algebra II for Beginners 2026 covers Algebra II step by step, with practice problems and answers. Look inside · $17.99

Each piece is a separate formula that applies only when x satisfies the stated condition. The function has one output for each input — you just have to find which piece applies.

How to Work with Piecewise Functions

Evaluating a Piecewise Function

To find f(a) for a specific value a, identify which condition a satisfies, then apply only that formula.

Quick example: For the function above, find f(−2).
−2 < 0, so use the first piece: \(\color{blue}{f(-2) = 2(-2) + 3}\) = −\(\color{blue}{4 + 3}\) = −1

Domain of Each Piece

Each piece is active only over its stated domain interval. The conditions must cover all x-values of interest and must not overlap (each x-value maps to exactly one output).

Graphing a Piecewise Function

Graph each piece over its own domain interval. Use open circles (∘) for strict inequalities (<, >) at the endpoints, and closed circles (•) for ≤ or ≥.

Step-by-Step Summary

  1. Identify the x-value (input) you are working with.
  2. Find which domain condition that x-value satisfies.
  3. Apply only that formula to compute the output.
  4. To graph: for each piece, identify the domain interval, evaluate key points, and draw that segment/curve with the correct open or closed endpoints.

Watch: Graphing Piecewise Functions (Video Lesson)

The Organic Chemistry Tutor covers piecewise functions including graphing, domain, range, and continuity:


Piecewise Functions – Worked Examples

Example 1: Evaluate f(x) at x = −2, −1, 0, 1, and 3 for:

f(x) = { \(\color{blue}{2x + 3}\), if x < 0 { 1, if \(\color{blue}{x = 0}\) { \(\color{blue}{x^{2} - 1}\), if x > 0

x = −2: x < 0 → \(\color{blue}{2(-2)+3}\) = −1 → f(−2) = −1
x = −1: x < 0 → \(\color{blue}{2(-1)+3 = 1}\) → f(−1) = 1
\(\color{blue}{x = 0}\): \(\color{blue}{x = 0}\) → f(0) = 1
\(\color{blue}{x = 1}\): x > 0 → 1²−\(\color{blue}{1 = 0}\) → f(1) = 0
\(\color{blue}{x = 3}\): x > 0 → 3²−\(\color{blue}{1 = 8}\) → f(3) = 8

Example 2: Evaluate g(x) at x = −3, −1, 0, and 2 for:

g(x) = { −\(\color{blue}{x + 2}\), if x ≤ −1 { \(\color{blue}{3x - 1}\), if x > −1

x = −3: x ≤ −1 → −\(\color{blue}{(-3)+2 = 3+2 = 5}\) → g(−3) = 5
x = −1: x ≤ −1 → −\(\color{blue}{(-1)+2 = 1+2 = 3}\) → g(−1) = 3
\(\color{blue}{x = 0}\): x > −1 → \(\color{blue}{3(0)-1}\) = −1 → g(0) = −1
\(\color{blue}{x = 2}\): x > −1 → \(\color{blue}{3(2)-1 = 5}\) → g(2) = 5

Example 3: Describe how to graph g(x) from Example 2.

Piece 1: Graph y = −\(\color{blue}{x + 2}\) for x ≤ −1. Use a closed circle at (−1, 3).
Piece 2: Graph \(\color{blue}{y = 3x – 1}\) for x > −1. Use an open circle at (−1, −4).
Note: at x = −1 the function equals 3 (\(\color{blue}{\text{ not } -4}\)), so the graph has a jump there.

Example 4: A phone plan charges $0.05 per text for the first 100 texts and $0.02 per text for each additional text. Write a piecewise function C(t) for the total cost of t texts.

C(t) = { 0.05t, if \(\color{blue}{0 \le t \le 100}\) { \(\color{blue}{5 + 0.02(t - 100)}\), if t > 100

At \(\color{blue}{t = 150}\): \(\color{blue}{C(150) = 5 + 0.02(50) = 5 + 1}\) = $6.00

More Practice: Graphing Piecewise Functions – 2 Methods (Video Lesson)

Mario’s Math Tutoring demonstrates two approaches to graphing piecewise functions with full explanations:


Exercises: Piecewise Functions

Use the following function for problems 1–4:

h(x) = { \(\color{blue}{x + 5}\), if x < −2 { −3, \(\color{blue}{\text{ if } -2 \le x}\) < 1 { \(\color{blue}{2x - 4}\), if \(\color{blue}{x \ge 1}\)
  1. Find h(−5).
  2. Find h(0).
  3. Find h(1).
  4. Find h(4).
  5. Write a piecewise function for f(x) = |x|.
  6. A parking lot charges $3 for the first hour and $1.50 for each additional hour. Write a piecewise cost function C(h) for \(\color{blue}{h \ge 1}\) hours.

Answers

  1. x = −5 < −2: h(−5) = −\(\color{blue}{5 + 5}\) = 0
  2. \(\color{blue}{x = 0}\), which \(\color{blue}{\text{ satisfies } -2 \le 0}\) < 1: h(0) = −3
  3. \(\color{blue}{x = 1 \ge 1}\): \(\color{blue}{h(1) = 2(1) – 4}\) = −2
  4. \(\color{blue}{x = 4 \ge 1}\): \(\color{blue}{h(4) = 2(4) – 4}\) = 4
  5. f(x) = { x, if \(\color{blue}{x \ge 0}\); −x, if x < 0 }
  6. C(h) = { 3, if \(\color{blue}{h = 1}\); \(\color{blue}{3 + 1.5(h-1)}\), if h > 1 }
Original price was: $109.99.Current price is: $54.99.

Free Piecewise Function Worksheet

Ready to practice on your own? Download our free Piecewise Function worksheet below, work through each problem at your own pace, and then check your answers. If a few give you trouble, scroll back up to the worked examples and try again, steady practice is the surest way to master Piecewise Function before a quiz or test.

Download Piecewise Functions Worksheet

How to Write a Piecewise Function from a Graph

Reading a rule off a graph uses the same skills as writing the equation of a line. Work one piece at a time.

  1. Find where the graph breaks. Each break point is a boundary between pieces.
  2. For each piece, pick two clear points and find its equation.
  3. Look at the dot at each boundary. A closed dot means that x-value belongs to that piece (≤ or ≥). An open dot means it does not (< or >).
  4. Write each rule next to its interval, making sure every x-value is used exactly once.

Example: A graph shows a line through (−1, 1) that ends with an open dot at (1, 3). A second line starts with a closed dot at (1, 1) and passes through (3, −3).

  • Left piece: slope = (3 − 1) ÷ (1 − (−1)) = 1, so y = x + 2. The open dot means x < 1.
  • Right piece: slope = (−3 − 1) ÷ (3 − 1) = −2, so y − 1 = −2(x − 1), which gives y = −2x + 3. The closed dot means x ≥ 1.

So f(x) = x + 2 when x < 1, and f(x) = −2x + 3 when x ≥ 1. Check: f(1) = −2(1) + 3 = 1, which matches the closed dot.

Is a Piecewise Function Continuous?

A piecewise function is continuous when you can draw it without lifting your pencil. To check, you need two things: each piece must be continuous on its own interval, and the pieces must meet at every boundary.

At each boundary, plug the boundary value into both neighboring rules. If the outputs match, the pieces meet there.

  • g(x) = x² when x < 2, and g(x) = 4x − 4 when x ≥ 2. At x = 2: 2² = 4 and 4(2) − 4 = 4. They match, so g is continuous.
  • In the graph example above, the left rule gives 1 + 2 = 3 at x = 1, but the right rule gives 1. The graph jumps from 3 down to 1, so that function is not continuous at x = 1.

Frequently Asked Questions

What is a piecewise function in math?

A piecewise function is a function made of two or more rules, where each rule applies to a different part of the domain. For example, f(x) = x + 2 when x < 1 and f(x) = 3x when x ≥ 1. The conditions tell you which rule to use for each input. Real-life examples include shipping costs and tax brackets.

How do you evaluate a piecewise function?

Find the interval that contains your x-value, then plug into only that rule. Take g(x) = x² when x ≤ 0 and g(x) = 2x − 1 when x > 0. For g(−3), −3 is at most 0, so g(−3) = (−3)² = 9. For g(4), 4 is greater than 0, so g(4) = 2(4) − 1 = 7. Pay close attention to boundary values like x = 0.

How do you graph a piecewise function?

Graph each rule only on its own interval. Make a small table for each piece, plot the points, and stop at the boundary. Use a closed dot when the endpoint is included (≤ or ≥) and an open dot when it is not (< or >). For f(x) = x + 2 when x < 1, draw an open dot at (1, 3) and extend the line to the left.

How do you write piecewise functions in Desmos?

In Desmos, use curly braces with a condition, a colon and the rule, separating pieces with commas. For example, type f(x) = {x < 1: x + 2, x ≥ 1: 3x}. Desmos draws each piece only where its condition is true. Open and closed endpoint dots are not added automatically, so check the boundaries yourself.

Is a piecewise function continuous?

Sometimes. A piecewise function is continuous at a boundary if the pieces meet at the same point. For f(x) = x + 2 when x < 1 and 3x when x ≥ 1, both rules give 3 at x = 1, so there is no break. But h(x) = x when x < 2 and x + 1 when x ≥ 2 jumps from 2 to 3 at x = 2, so it is not continuous there.

Are piecewise functions Algebra 2?

Piecewise functions are often introduced in Algebra 1 and studied in more depth in Algebra 2, along with absolute value and step functions. They show up again in precalculus and calculus, where you check limits and continuity at the boundaries. Once you can evaluate and graph them, those later topics become much easier.

Related Topics

Related to This Article

What people say about "Piecewise Function: How to Evaluate, Graph, and Write One"?

No one replied yet.

Leave a Reply