Cookmath

Piecewise Advanced · Functions

f(x)=x² if x<0; f(x)=x+1 if x≥0. Then f(−2)=4, f(0)=1. The two conditions are disjoint and cover ℝ.

Before you begin

Check: x=2 satisfies x≤2 but does not satisfy x>2. Boundary inequalities decide which rule is used.

What you will learn

Understand the idea

A piecewise function gives different rules on different input regions. Choose the region using the input before doing arithmetic. Nonoverlapping regions prevent conflicting outputs, and endpoint inclusion is part of the function definition rather than a plotting decoration.

Worked example 1

Let f(x)=x² for x<1 and f(x)=2x+1 for x≥1. Find f(−2),f(1),f(3).

  1. −2<1 uses the square rule: f(−2)=4.
  2. The equality belongs to the second branch: f(1)=3.
  3. For 3≥1, f(3)=7; do not average the two formulas at the boundary.

Worked example 2

A taxi charges 6 for the first 2 km, then 2 per additional km. Give C(d) for d≥0.

  1. For 0≤d≤2, C(d)=6.
  2. For d>2, only the distance beyond 2 is charged again: C(d)=6+2(d−2).
  3. At 5 km, C=12; both expressions meet at 6 when d=2.

Diagnose an error

The rule uses x<0 and x>0 only. Is f(0) automatically zero?

Compare your reasoning

The rule uses x<0 and x>0 only. Is f(0) automatically zero?

  1. No branch includes 0, so the function is not defined there.
  2. A point value requires an explicit branch or separate assignment.

Independent practice

Submit your answer in the interactive lesson to unlock the worked solution. Type your reasoning or build it with clickable tiles.

Practice 1

For f(x)=−x when x<0 and x when x≥0, find f(−5).

Solution locked until submission.

Practice 2

At x=2, which endpoint is closed for x<2: y=x, x≥2: y=5−x?

Solution locked until submission.

Practice 3

Can two overlapping branches still define a function?

Solution locked until submission.

Practice 4

A parking lot charges 4 for up to 1 hour and 7 for more than 1 up to 2 hours. Compare costs at 1 and 1.01 hours.

Solution locked until submission.

Connect and reflect

Choose the branch by input, not by whichever formula gives the nicer answer; preserve all boundary inequalities.

Original Cookmath explanations and exercises. Scope reference: OpenStax Advanced · Functions and graphs 2e · scope reference; original Cookmath lesson. Cookmath units are smaller study groups, not publisher chapter counts.

Continue learning

Advanced · Functions