Piecewise Functions
A piecewise function is a function that is defined by different rules for different ranges of input values.
Instead of using one formula everywhere, piecewise functions change behavior based on conditions. This makes them extremely powerful for modeling real life, technology, and decision-based systems.
Why Piecewise Functions Are Needed
Many real-world situations do not follow a single rule. The rule changes when conditions change.
Piecewise functions allow mathematics to match reality.
Examples:
- Electricity billing slabs
- Income tax brackets
- Phone data plans
- Traffic rules based on speed
What Is a Piecewise Function?
A piecewise function is written using multiple formulas, each valid over a specific interval.
Each input value uses only one rule.
General form:
f(x) =
{ expression 1, if condition 1
expression 2, if condition 2
expression 3, if condition 3 }
Simple Example of a Piecewise Function
Consider the following function:
f(x) =
{ x + 2, if x < 0
x², if x ≥ 0 }
This means:
- For negative x → use x + 2
- For zero or positive x → use x²
Understanding Piecewise Functions Conceptually
Think of a piecewise function like a set of instructions.
First, check the condition. Then, apply the correct rule.
This is very similar to if–else logic in programming.
Evaluating a Piecewise Function
To evaluate a piecewise function:
- Identify where the input value belongs
- Select the correct rule
- Compute the result
Example:
Given:
f(x) = { 2x, if x < 1
x + 3, if x ≥ 1 }
Find f(−2):
−2 < 1 → use 2x → f(−2) = −4
Piecewise Functions and Graphs
Graphs of piecewise functions are made of separate parts.
Each part corresponds to one rule and is drawn only on its valid interval.
Open and Closed Points in Piecewise Graphs
Endpoints of intervals are shown using:
- Open circle → value not included
- Closed circle → value included
This is critical for correct graph interpretation.
Piecewise Functions vs Absolute Value
Absolute value functions are actually piecewise functions written in compact form.
Example:
|x| =
{ x, if x ≥ 0
−x, if x < 0 }
Understanding piecewise form explains why |x| works.
Continuity in Piecewise Functions
A piecewise function can be continuous or discontinuous at the boundary points.
If both pieces meet at the same value, the function is continuous.
If not, a jump occurs.
Real-Life Example: Electricity Billing
Suppose electricity charges follow this rule:
- First 100 units → ₹3 per unit
- Above 100 units → ₹5 per unit
This is a classic piecewise function used in real-world billing systems.
Piecewise Functions in Daily Life
Piecewise thinking is everywhere.
- School grading systems
- Parking fees by time
- Shipping charges by weight
- Loan interest slabs
Piecewise Functions in Business & Economics
Businesses rely heavily on rule-based models.
- Tax calculations
- Discount rules
- Commission structures
Piecewise functions make these models precise.
Piecewise Functions in Technology & IT
Piecewise functions directly map to programming logic.
- If–else statements
- Pricing engines
- AI decision rules
- Validation systems
Understanding this math improves coding clarity.
Piecewise Functions in Competitive Exams
Exams commonly test:
- Correct rule selection
- Value substitution
- Graph interpretation
Careful reading of conditions is crucial.
Common Mistakes to Avoid
Most mistakes happen due to ignoring conditions.
- Using the wrong formula
- Ignoring equality signs
- Wrong open/closed endpoint
Practice Questions
Q1. Given f(x) = { x², if x < 0; x + 1, if x ≥ 0 }, find f(−3).
Q2. Find f(2) for the same function.
Q3. Is |x| a piecewise function?
Quick Quiz
Q1. Do all x-values use the same formula in a piecewise function?
Q2. What determines which rule is used?
Quick Recap
- Piecewise functions use different rules
- Conditions decide which formula applies
- Graphs are made of separate pieces
- Absolute value is a special case
- Used widely in real life and technology