📐 Mathematics · Topic 96 of 200

Piecewise Functions

A piecewise function uses different rules on different intervals.

Interactive labDrag the sliders and hover over the graph

About this topic

A piecewise function uses different rules on different parts of its domain, written with a brace and conditions such as x less than 0 and x ≥ 0. To evaluate, first decide which condition the input satisfies and then use that rule.

Graphs are made of separate pieces, with open or closed circles marking endpoints. The absolute value function is piecewise, and so are tax brackets, parking fees and shipping costs, where the rate changes as the quantity crosses thresholds.

Worked example: let f(x) = 2x + 1 when x is less than 0, and f(x) = x² when x is 0 or more. To find f(−3), the input is negative so use the first rule: 2(−3) + 1 = −5. To find f(4), use the second rule: 16. At the boundary x = 0, the second rule applies, so f(0) = 0, and the graph has a closed circle there and an open circle on the first piece. A phone plan that charges a flat fee up to 5 GB and then a per-gigabyte rate beyond that is the same idea.

A common mistake is testing the wrong condition or forgetting which piece owns the boundary point. Always check the inequality signs: only one piece may include each endpoint, otherwise the relation would give two outputs for one input and stop being a function. Sketch each piece on its own domain only, and check the graph passes the vertical line test.

Key ideas

  1. Check which interval each input belongs to
  2. Open and closed circles show endpoints
  3. Absolute value is a piecewise function

Quick check

Use cases: where Piecewise Functions helps

Number and algebra skills are used in science, engineering, budgeting and computing.

Frequently asked questions

What is Piecewise Functions?

A piecewise function uses different rules on different intervals.

What will I learn in Piecewise Functions?

Check which interval each input belongs to. Open and closed circles show endpoints. Absolute value is a piecewise function.

Is Piecewise Functions part of Mathematics?

Yes. It is one of 200 Mathematics topics on LearnViz HighSchoolEdu, with 3 key ideas, a live animation and a quick check.

Does the Piecewise Functions lab work on a phone or tablet?

Yes. The animation resizes to fit your screen and supports touch, so you can drag, tap and slide with your finger.

How should I study Piecewise Functions?

Read the summary and key ideas first, play with the interactive lab to see the idea in motion, then answer the quick check. If you get a question wrong, go back to the key idea it tests.

Do I need an account, and is my progress saved?

No account is needed. Marking a topic as learned is saved in your own browser, so it stays on that device and is not sent to a server.

More in Mathematics