The Central Idea

A function may be defined in pieces:

\[ f(x)= \begin{cases} x+2, & x<0,\\ x^2, & x\ge0. \end{cases} \]

Here the formula depends on which part of the domain contains the input.

A function may also be described by an equation such as

\[ x+y=10. \]

This equation does not initially isolate \(y\), but it still determines

\[ y=10-x, \]

so it defines \(y\) as a function of \(x\).

These are two different ways a function can be defined without beginning with one simple expression of the form \(y=f(x)\).

Piecewise-Defined Functions

A piecewise-defined function uses different rules on different subsets of its domain.

General form:

\[ f(x)= \begin{cases} f_1(x), & x\in A_1,\\ f_2(x), & x\in A_2,\\ \vdots\\ f_n(x), & x\in A_n. \end{cases} \]

The conditions tell us which rule applies.

Why Use Piecewise Definitions?

Piecewise functions are useful when a relationship changes under different conditions.

Examples include:

Read the Condition First

Suppose

\[ f(x)= \begin{cases} 2x+1, & x<3,\\ x^2, & x\ge3. \end{cases} \]

To evaluate \(f(2)\), first check the condition:

\[ 2<3. \]

So use

\[ 2x+1. \]

Thus,

\[ f(2)=2(2)+1=5. \]

Boundary Inputs Matter

For the same function, evaluate

\[ f(3). \]

The first condition is

\[ x<3, \]

which does not include \(3\).

The second condition is

\[ x\ge3, \]

so

\[ f(3)=3^2=9. \]

Boundary Symbols Are Part of the Definition

The distinction among

\[ <,\quad \le,\quad >,\quad \ge \]

determines which branch owns a boundary point.

A single equality symbol can change the value of the function at that point.

Branches Should Cover the Intended Domain

If the function is intended to have domain \(\mathbb{R}\), the branch conditions should collectively cover every real input.

For example,

\[ x<0 \]

and

\[ x\ge0 \]

cover all real numbers.

Gaps in Piecewise Domains

Consider

\[ f(x)= \begin{cases} x+1, & x<0,\\ x^2, & x>0. \end{cases} \]

No rule is assigned at

\[ x=0. \]

So \(0\) is not in the domain unless another branch defines it.

Overlapping Branches Can Cause Trouble

Consider

\[ f(x)= \begin{cases} x+1, & x\le2,\\ x^2, & x\ge2. \end{cases} \]

At

\[ x=2, \]

both conditions apply.

The first rule gives

\[ 3, \]

while the second gives

\[ 4. \]

Because one input receives two outputs, this definition is not a function unless the overlap is resolved.

Overlaps Are Allowed If Outputs Agree

An overlap does not automatically break the function.

If both branches give the same output wherever they overlap, the assignment remains single-valued.

For example,

\[ f(x)= \begin{cases} x^2, & x\le0,\\ x^2, & x\ge0 \end{cases} \]

is still well-defined because both branches agree at \(x=0\).

Absolute Value as a Piecewise Function

The absolute-value function is naturally piecewise:

\[ |x|= \begin{cases} -x, & x<0,\\ x, & x\ge0. \end{cases} \]

The rule changes depending on the sign of the input.

Why the Absolute-Value Definition Works

If \(x<0\), then

\[ -x>0, \]

so the output is the nonnegative distance from zero.

If \(x\ge0\), the value is already nonnegative, so the output is simply

\[ x. \]

Sign Function Example

The sign function can be written

\[ \operatorname{sgn}(x)= \begin{cases} -1, & x<0,\\ 0, & x=0,\\ 1, & x>0. \end{cases} \]

Three branches are used because zero receives a special value.

Step Function Example

A simple step function might be

\[ f(x)= \begin{cases} 0, & x<2,\\ 5, & x\ge2. \end{cases} \]

The output jumps from \(0\) to \(5\) at \(x=2\).

Piecewise functions need not be continuous.

Piecewise Functions Can Be Continuous

Consider

\[ f(x)= \begin{cases} x+1, & x<2,\\ 3, & x=2,\\ x^2-1, & x>2. \end{cases} \]

Whether this function is continuous at \(x=2\) depends on how the neighboring branches approach the boundary.

Piecewise form alone does not imply a break.

Piecewise Functions Can Mix Function Families

A piecewise function can combine different types of rules:

\[ f(x)= \begin{cases} 2x+1, & x<0,\\ x^2, & 0\le x<3,\\ \sqrt{x}, & x\ge3. \end{cases} \]

Each branch has its own behavior and possibly its own domain restrictions.

Branch Restrictions and Formula Restrictions Combine

Suppose

\[ f(x)= \begin{cases} \sqrt{x+2}, & x<1,\\ \dfrac{1}{x-4}, & x\ge1. \end{cases} \]

The first branch requires

\[ x+2\ge0, \]

so together with \(x<1\), it applies on

\[ [-2,1). \]

The second branch applies on \(x\ge1\) but excludes

\[ x=4. \]

The Domain Is the Union of Valid Branch Domains

For the previous example, the full domain is

\[ [-2,1)\cup[1,4)\cup(4,\infty). \]

Equivalently,

\[ [-2,4)\cup(4,\infty). \]

Range of a Piecewise Function

To find the range of a piecewise function:

  1. find the range of each branch on its stated domain;
  2. combine those output sets using union;
  3. remove duplicates automatically because range is a set.

Piecewise Range Example

Let

\[ f(x)= \begin{cases} x, & x<0,\\ x+2, & x\ge0. \end{cases} \]

The first branch produces

\[ (-\infty,0). \]

The second branch produces

\[ [2,\infty). \]

So the range is

\[ \boxed{(-\infty,0)\cup[2,\infty)}. \]

Piecewise Models in Real Situations

Suppose a parking garage charges:

A piecewise function is often the cleanest way to describe such a rule because the pricing behavior changes by interval.

Piecewise Functions and Parameters

Branches may contain parameters.

For example,

\[ f(x)= \begin{cases} ax+b, & x<0,\\ cx+d, & x\ge0. \end{cases} \]

The parameters may be chosen to control continuity, slope, or other behavior at the boundary.

Choosing Parameters to Make Branches Meet

Suppose

\[ f(x)= \begin{cases} 2x+1, & x<3,\\ ax-2, & x\ge3. \end{cases} \]

To make the two formulas agree at \(x=3\), require

\[ 2(3)+1=3a-2. \]

Thus,

\[ 7=3a-2, \] \[ 3a=9, \] \[ \boxed{a=3}. \]

Implicitly Defined Relationships

An equation may describe a relationship without solving explicitly for one variable.

For example,

\[ x+y=10 \]

is an implicit relation between \(x\) and \(y\).

Explicit Versus Implicit Form

An explicit definition solves directly for the output:

\[ y=10-x. \]

An implicit definition leaves the variables connected in an equation:

\[ x+y=10. \]

Both can describe the same relationship.

Implicit Does Not Mean Nonfunctional

An implicit equation can still define a function.

For

\[ x+y=10, \]

each real \(x\) determines exactly one \(y\):

\[ y=10-x. \]

So the relation defines \(y\) as a function of \(x\).

An Implicit Relation May Fail to Define a Function

Consider

\[ x^2+y^2=25. \]

Solving for \(y\):

\[ y=\pm\sqrt{25-x^2}. \]

For many inputs, there are two possible outputs.

Therefore, the full circle does not define \(y\) as a function of \(x\).

Vertical-Line Test for Implicit Relations

If an implicit relation is graphed, the vertical-line test still answers whether it defines \(y\) as a function of \(x\).

If some vertical line intersects the relation more than once, one \(x\)-value corresponds to multiple \(y\)-values.

Restricting an Implicit Relation Can Create a Function

For the circle

\[ x^2+y^2=25, \]

restrict to the upper half:

\[ y\ge0. \]

Then

\[ y=\sqrt{25-x^2}. \]

This is a function with domain

\[ [-5,5]. \]

Lower Semicircle

If instead we restrict to

\[ y\le0, \]

then

\[ y=-\sqrt{25-x^2}. \]

This is another valid function on

\[ [-5,5]. \]

Branch Selection

When solving an implicit relation produces several algebraic branches, choosing one branch may be necessary to obtain a function.

For example,

\[ y^2=x \]

gives

\[ y=\pm\sqrt{x}. \]

Selecting

\[ y=\sqrt{x} \]

creates one function; selecting

\[ y=-\sqrt{x} \]

creates another.

Implicit Function Domain

When an implicit relation does define a function, the domain consists of those input values for which a valid output exists.

For the upper semicircle

\[ y=\sqrt{25-x^2}, \]

we require

\[ 25-x^2\ge0. \]

Thus,

\[ -5\le x\le5. \]

Implicit Equations Can Define Several Local Functions

A relation may fail to define one global function but still define separate functions on restricted regions.

The circle is the simplest example: upper and lower semicircles are separate branches.

Relation Versus Function

Every implicit equation defines a relation.

It defines a function only if each allowed input corresponds to exactly one output.

The function test remains the same regardless of how the relation is written.

Implicit Example: Parabola Sideways

Consider

\[ x=y^2. \]

Solving for \(y\):

\[ y=\pm\sqrt{x}. \]

This does not define \(y\) as a function of \(x\) on \(x\ge0\) unless one branch is selected.

However, the same relation does define

\[ x=y^2 \]

as a function of \(y\).

Direction of Dependence Matters

An implicit relation may define:

The answer depends on which variable is chosen as the input.

Example: Hyperbola

Consider

\[ xy=1. \]

Solving for \(y\):

\[ y=\frac1x, \qquad x\ne0. \]

So this implicit relation defines \(y\) as a function of \(x\).

Example: Linear Implicit Function

Consider

\[ 3x+2y=8. \]

Solve for \(y\):

\[ 2y=8-3x, \] \[ y=4-\frac32x. \]

Thus, the implicit relation defines a linear function.

Implicit Equations Can Be Easier to Write

Sometimes the implicit form is more natural than the explicit form.

For example, a circle is compactly written as

\[ x^2+y^2=r^2. \]

Splitting it into two explicit branches requires

\[ y=\pm\sqrt{r^2-x^2}. \]

Implicit Forms Can Preserve Symmetry

The equation

\[ x^2+y^2=25 \]

treats \(x\) and \(y\) symmetrically.

Solving for one variable breaks that symmetry.

Implicit notation can therefore reveal geometric structure more clearly.

Implicitly Defined Functions Need Not Have Simple Formulas

Sometimes an equation determines one output locally even when solving explicitly is difficult or impossible using elementary formulas.

The function may still exist even if we cannot write a simple expression for it.

Implicit Function Theorem Preview

Higher mathematics provides conditions under which an equation

\[ F(x,y)=0 \]

defines \(y\) locally as a function of \(x\).

This is the subject of the Implicit Function Theorem.

The theorem formalizes when an implicit relation behaves like a function near a point.

Implicit Differentiation Preview

Later in calculus, we can differentiate relations without first solving explicitly for \(y\).

For example, from

\[ x^2+y^2=25, \]

implicit differentiation gives a relationship between the rates of change of \(x\) and \(y\).

This technique is useful when explicit isolation is inconvenient.

Piecewise and Implicit Definitions Can Appear Together

A function may be described implicitly on different regions.

For example, one branch might satisfy one equation and another branch a different equation.

The central requirement remains unchanged: each allowed input must have exactly one output.

Composition with Piecewise Functions

If

\[ g(x)= \begin{cases} x+1, & x<0,\\ x^2, & x\ge0, \end{cases} \]

then in a composition

\[ g(f(x)), \]

the correct branch depends on whether

\[ f(x)<0 \]

or

\[ f(x)\ge0. \]

The branch condition applies to the inner output.

Inverse Functions May Produce Piecewise Branches

When reversing a function, algebra may produce more than one branch.

For example, reversing

\[ y=x^2 \]

gives

\[ x=\pm\sqrt{y}. \]

To obtain an inverse function, the original domain must be restricted so only one branch remains.

Piecewise Functions and Inverses

A piecewise function can be invertible if it is one-to-one and its branches fit together without output collisions.

Its inverse may itself be piecewise-defined.

Piecewise Functions and Extrema

Maximum and minimum values may occur:

All branches and boundary values must be checked.

Piecewise Functions and Continuity

To test continuity at a branch boundary, compare:

This is developed more fully in calculus.

Worked Example: Evaluate a Piecewise Function

Let

\[ f(x)= \begin{cases} 2x-1, & x<2,\\ x+4, & x\ge2. \end{cases} \]

Find \(f(1)\):

\[ f(1)=2(1)-1=1. \]

Find \(f(2)\):

\[ f(2)=2+4=6. \]

So

\[ \boxed{f(1)=1,\qquad f(2)=6}. \]

Worked Example: Find the Domain

Let

\[ f(x)= \begin{cases} \sqrt{x+3}, & x<1,\\ \dfrac{1}{x-2}, & x\ge1. \end{cases} \]

For the first branch:

\[ x+3\ge0, \]

so

\[ -3\le x<1. \]

For the second branch:

\[ x\ge1,\qquad x\ne2. \]

Thus,

\[ \boxed{[-3,2)\cup(2,\infty)}. \]

Worked Example: Implicit Linear Function

Consider

\[ 2x+5y=20. \]

Solve for \(y\):

\[ 5y=20-2x, \] \[ y=4-\frac25x. \]

So the relation defines \(y\) as a function of \(x\).

Worked Example: Implicit Relation That Is Not a Function

Consider

\[ x^2+y^2=16. \]

At

\[ x=0, \]

we obtain

\[ y=4 \]

or

\[ y=-4. \]

Therefore, the full relation does not define \(y\) as a function of \(x\).

Worked Example: Select a Branch

Restrict

\[ x^2+y^2=16 \]

to

\[ y\ge0. \]

Then

\[ y=\sqrt{16-x^2}. \]

The domain is

\[ \boxed{[-4,4]}. \]

This upper semicircle is a function of \(x\).

A Reliable Piecewise-Evaluation Workflow

  1. Identify the input.
  2. Check which branch condition contains that input.
  3. Use only that branch formula.
  4. Substitute and simplify.
  5. Pay special attention to boundary symbols.

A Reliable Piecewise-Domain Workflow

  1. Read each branch condition.
  2. Apply any additional formula restrictions within that branch.
  3. Find the valid domain of each branch.
  4. Take the union of all valid branch domains.
  5. Check gaps and overlaps at boundaries.

A Reliable Implicit-Function Workflow

  1. Identify which variable is supposed to be the input.
  2. Ask whether each allowed input determines exactly one output.
  3. Solve explicitly when practical.
  4. If multiple branches appear, determine whether a restriction selects one branch.
  5. Use the vertical-line test when a graph is available.
  6. Identify the resulting domain and range.

Common Errors

Using the Wrong Piecewise Branch

Always test the input against the branch condition before substituting.

Ignoring Equality at Boundaries

The difference between \(<\) and \(\le\) can change the function value.

Allowing Overlapping Branches with Different Outputs

That gives one input more than one output and breaks the function definition.

Forgetting Formula Restrictions Inside a Branch

A branch condition does not override denominator, radical, or logarithm restrictions.

Assuming Every Implicit Equation Defines a Function

Some relations assign several outputs to one input.

Assuming an Implicit Relation Is Not a Function Because \(y\) Is Not Isolated

Implicit form and function status are different questions.

Forgetting That Branch Restrictions Can Create a Function

A relation such as a circle can be restricted to an upper or lower branch.

Practice

1. Piecewise Evaluation

Let

\[ f(x)= \begin{cases} x+3, & x<1,\\ 2x, & x\ge1. \end{cases} \]

Find \(f(0)\) and \(f(1)\).

Check Answer \[ f(0)=0+3=3, \] \[ f(1)=2(1)=2. \]

Answer:

\[ \boxed{f(0)=3,\qquad f(1)=2}. \]

2. Boundary Ownership

For

\[ f(x)= \begin{cases} x^2, & x\le2,\\ x+5, & x>2, \end{cases} \]

which branch defines \(f(2)\)?

Check Answer

The first branch, because

\[ 2\le2. \]

3. Domain of a Piecewise Function

Find the domain of

\[ f(x)= \begin{cases} \sqrt{x}, & x<4,\\ \dfrac{1}{x-5}, & x\ge4. \end{cases} \]
Check Answer

First branch:

\[ 0\le x<4. \]

Second branch:

\[ x\ge4,\qquad x\ne5. \]

Domain:

\[ \boxed{[0,5)\cup(5,\infty)}. \]

4. Implicit Linear Relation

Does

\[ x+2y=8 \]

define \(y\) as a function of \(x\)?

Check Answer

Yes.

\[ 2y=8-x, \] \[ y=4-\frac12x. \]

5. Circle Relation

Does

\[ x^2+y^2=9 \]

define \(y\) as a function of \(x\) on the full circle?

Check Answer

No. Many \(x\)-values correspond to two \(y\)-values.

6. Upper Branch

Restrict

\[ x^2+y^2=9 \]

to \(y\ge0\). Write \(y\) explicitly.

Check Answer \[ \boxed{y=\sqrt{9-x^2}}, \qquad -3\le x\le3. \]

7. Overlapping Branches

Does

\[ f(x)= \begin{cases} x+1, & x\le0,\\ x-1, & x\ge0 \end{cases} \]

define a function?

Check Answer

No. At \(x=0\), the first branch gives \(1\) and the second gives \(-1\).

8. Absolute Value

Write

\[ |x| \]

as a piecewise function.

Check Answer \[ \boxed{ |x|= \begin{cases} -x, & x<0,\\ x, & x\ge0. \end{cases} } \]

Key Ideas

Where This Leads

Piecewise and implicit definitions expand the idea of a function far beyond single closed-form formulas.

These ideas lead naturally into continuity, inverse functions, restricted domains, branch selection, parametric and implicit curves, optimization with constraints, step and floor functions, implicit differentiation, and the Implicit Function Theorem.