Piecewise Function
A function that is defined by different formulas or rules on distinct subintervals of its domain is called a piecewise function.
Example:
In the piecewise function
\[
f(x) =
\begin{cases}
g(x), & \text{if } x \le r,\\
h(x), & \text{if } x > r,
\end{cases}
\]
we use $f(x) = g(x)$ when $x \le r$ and $f(x) = h(x)$ when $x > r$.
Example:
Given the piecewise function:
\[
f(x) =
\begin{cases}
x^2, & \text{if } x \le 1,\\
x + 1, & \text{if } 1 < x < 3,\\
2x, & \text{if } x \ge 3,
\end{cases}
\]
let us find the values of $f(0)$, $f(2)$, and $f(5)$.
\[
\text{For } x = 0, \text{ since } x \le 1 \quad\Longrightarrow\quad f(x) = x^2
\quad\Longrightarrow\quad f(0) = 0
\]
\[
\text{For } x = 2, \text{ since } 1 < x < 3
\quad\Longrightarrow\quad f(x) = x + 1
\quad\Longrightarrow\quad f(2) = 3
\]
\[
\text{For } x = 5, \text{ since } x \ge 3
\quad\Longrightarrow\quad f(x) = 2x
\quad\Longrightarrow\quad f(5) = 10
\]
Example:
Given:
\[
f(3x + 1) =
\begin{cases}
2x + 1, & \text{if } x \ge -\tfrac{1}{3},\\
-x + 1, & \text{if } x < -\tfrac{1}{3},
\end{cases}
\]
let us find $f(0)$ and the general expression for $f(x)$.
To find $f(0)$, we substitute $x = -\tfrac{1}{3}$ into both sides of the equation:
\[
f(3x + 1) = 2x + 1 \]
\[f\bigl(3\cdot(-\frac{1}{3}) + 1\bigr) = 2\cdot\bigl(-\frac{1}{3}\bigr) + 1
= \frac{1}{3}\]
\[f(0) = \frac{1}{3}
\]
To find the general expression for $f(x)$, we substitute $x$ with $\tfrac{x – 1}{3}$ on both sides:
\[
f\!\Bigl(3\,\bigl(\tfrac{x – 1}{3}\bigr) + 1\Bigr) =
\begin{cases}
2\!\bigl(\frac{x – 1}{3}\bigr) + 1, & \text{if } \frac{x – 1}{3} \ge -\frac{1}{3},\\
-\!\bigl(\frac{x – 1}{3}\bigr) + 1, & \text{if } \frac{x – 1}{3} < -\frac{1}{3},
\end{cases}
\]
Simplifying the terms and interval constraints:
\[
\begin{cases}
\frac{2x + 1}{3}, & \text{if } x \ge 0,\\
\frac{-x + 4}{3}, & \text{if } x < 0,
\end{cases}
\]
which yields the final rule:
\[
f(x) =
\begin{cases}
\dfrac{2x + 1}{3}, & \text{if } x \ge 0,\\
\dfrac{-x + 4}{3}, & \text{if } x < 0.
\end{cases}
\]
Example:
Given the function:
\[
f(x) =
\begin{cases}
x^2, & \text{if } x < 0,\\
1 + x, & \text{if } x \ge 0,
\end{cases}
\]
let us evaluate the composite function $(f \circ f)(x)$.
Case 1: For $x < 0$, we have $f(x) = x^2$, so $(f \circ f)(x) = f\bigl(f(x)\bigr) = f(x^2)$.
\[
x < 0 \;\;\Longrightarrow\;\; x^2 > 0
\quad\Rightarrow\quad
f\bigl(x^2\bigr) = 1 + x^2
\]
Case 2: For $x \ge 0$, we have $f(x) = 1 + x$, so $(f \circ f)(x) = f\bigl(f(x)\bigr) = f(1 + x)$.
\[
x \ge 0
\;\;\Longrightarrow\;\;
1 + x \ge 0
\quad\Rightarrow\quad
f(1 + x) = 1 + (1 + x) = 2 + x
\]
Combining both cases gives the piecewise composite function:
\[
(f \circ f)(x) =
\begin{cases}
1 + x^2, & \text{if } x < 0,\\
2 + x, & \text{if } x \ge 0.
\end{cases}
\]
Example:
Consider the functions:
\[
f(x) =
\begin{cases}
1 – x, & \text{if } x < 1,\\
x^2 + 1, & \text{if } x \ge 1,
\end{cases}
\quad\text{and}\quad
g(x) =
\begin{cases}
x + 1, & \text{if } x < 0,\\
1 – x^2, & \text{if } x \ge 0.
\end{cases}
\]
Let us find the sum function $(f + g)(x)$ by finding the intersection of the subintervals.
Interval 1: For $x < 0$:
\[
x < 0
\quad\Longrightarrow\quad
f(x) = 1 – x, \quad g(x) = x + 1
\quad\Rightarrow\quad
(f + g)(x) = (1 – x) + (x + 1) = 2.
\]
Interval 2: For $x \ge 1$:
\[
x \ge 1
\quad\Longrightarrow\quad
f(x) = x^2 + 1, \quad g(x) = 1 – x^2
\quad\Rightarrow\quad
(f + g)(x) = (x^2 + 1) + (1 – x^2) = 2.
\]
Interval 3: For the middle region $0 \le x < 1$:
\[
0 \le x < 1
\quad\Longrightarrow\quad
f(x) = 1 – x, \quad g(x) = 1 – x^2
\quad\Rightarrow\quad
(f + g)(x) = (1 – x) + (1 – x^2) = 2 – x – x^2.
\]
Thus, the piecewise sum is:
\[
(f + g)(x) =
\begin{cases}
2, & \text{if } x < 0,\\
2 – x – x^2, & \text{if } 0 \le x < 1,\\
2, & \text{if } x \ge 1.
\end{cases}
\]
Example:
Given the functions:
\[
f(x) =
\begin{cases}
2x + 1, & \text{if } x \le 0,\\
1 – x, & \text{if } 0 < x < 2,\\
1, & \text{if } x \ge 2,
\end{cases}
\quad \text{and } \quad
g(x) =
\begin{cases}
2, & \text{if } x \le -2,\\
1 – 2x, & \text{if } x > -2.
\end{cases}
\]
Let us find the expression for $(f – g)(x)$ specifically for the interval $-1 < x < 0$.
\[
\text{For } -1 < x < 0, \text{ the component rules are:}
\quad\Longrightarrow\quad
f(x) = 2x + 1 \quad \text{and} \quad g(x) = 1 – 2x
\]
\[
(f-g)(x) = f(x) – g(x) = (2x + 1) – (1 – 2x) = 4x
\]
Example:
Let us find the inverse of the following function:
\[
f(x) =
\begin{cases}
\sqrt{x} + 1, & \text{if } x \ge 0,\\
x^2, & \text{if } x < 0.
\end{cases}
\]
Part 1: For $x \ge 0$, the function maps its domain to the codomain as follows:
\[
f: [0,\infty)\to[1,\infty), \quad y = \sqrt{x} + 1 \]
\[ \Rightarrow
y – 1 = \sqrt{x}
\quad\Longrightarrow\quad
(y – 1)^2 = x = f^{-1}(y).
\]
Therefore, on this piece:
\[
f^{-1} : [1,\infty) \to [0,\infty),
\quad
f^{-1}(x) = (x – 1)^2.
\]
Part 2: For $x < 0$:
\[
f: (-\infty,0)\to(0,\infty), \quad y = x^2 \]
\[ \Rightarrow\quad
\sqrt{y} = \sqrt{x^2} = |x|.
\]
Since $x < 0$ in this piece, we have $|x| = -x$, and thus:
\[
\sqrt{y} = -x \quad\Longrightarrow\quad -\sqrt{y} = x = f^{-1}(y).
\]
This gives us:
\[
f^{-1} : (0,\infty) \to (-\infty,0),
\quad
f^{-1}(x) = -\sqrt{x}.
\]
Combining the sub-relations:
\[
f^{-1}(x) =
\begin{cases}
(x – 1)^2, & \text{if } x \ge 1,\\
-\sqrt{x}, & \text{if } x > 0.
\end{cases}
\]
As can be seen, because the original function $f$ is not bijective (both one-to-one and onto), $f^{-1}$ is not a true function but merely a relation.
Example:
Let us find the inverse of the function:
\[
f(x) =
\begin{cases}
2x, & \text{if } x \ge 0,\\
-x^2,& \text{if } x < 0.
\end{cases}
\]
Part 1: For $x \ge 0$:
\[
f: [0,\infty)\to[0,\infty), \quad y = 2x \quad \Rightarrow \quad \frac{y}{2} = x = f^{-1}(y).
\]
Thus:
\[
f^{-1}: [0,\infty)\to[0,\infty),
\quad
f^{-1}(x) = \frac{x}{2}.
\]
Part 2: For $x < 0$:
\[
f : (-\infty,0) \to (-\infty,0),
\quad y = -x^2
\quad\Longrightarrow\quad
-y = x^2
\quad\Longrightarrow\quad
\sqrt{-y} = \sqrt{x^2} = |x|.
\]
Since $x < 0$, we substitute $|x| = -x$:
\[
\sqrt{-y} = -x
\quad\Longrightarrow\quad
-\sqrt{-y} = x = f^{-1}(y).
\]
Thus:
\[
f^{-1} : (-\infty,0) \to (-\infty,0),
\quad f^{-1}(x) = -\,\sqrt{-x}.
\]
Combining the rules yields:
\[
f^{-1}(x) =
\begin{cases}
\dfrac{x}{2}, & \text{if } x \ge 0,\\[6pt]
-\sqrt{-x}, & \text{if } x < 0.
\end{cases}
\]
Since $f$ is a bijective function across its domain, its inverse $f^{-1}$ is also a valid function.
Example:
Given:
\[
f(2 – x) =
\begin{cases}
x + 2, & \text{if } x \le 0,\\
-x + 1, & \text{if } x > 0.
\end{cases}
\]
Let us find the expression for $f(x)$.
To solve for $f(x)$, we replace $x$ with $(2 – x)$ across the entire piecewise rule:
\[
f\bigl(2 – (2 – x)\bigr) = f(x).
\]
Performing this substitution component-by-component:
\[
f(2 – (2 – x)) =
\begin{cases}
(2 – x) + 2, & \text{if } 2 – x \le 0,\\
-\,(2 – x) + 1, & \text{if } 2 – x > 0.
\end{cases}
\]
Rearranging the inequalities for $x$:
\[
\Longrightarrow
f(x) =
\begin{cases}
4 – x, & \text{if } x \ge 2,\\
x – 1, & \text{if } x < 2.
\end{cases}
\]
QUESTION 34
Consider the functions:
\[
f(x) =
\begin{cases}
x + 3, & \text{if } x > 4,\\
2, & \text{if } x \le 4,
\end{cases}
\qquad
g(x) =
\begin{cases}
x^2, & \text{if } x > 2,\\
1 – x, & \text{if } x \le 2.
\end{cases}
\]
What is the value of the triple composition $(f \circ g \circ f)(4)$?
\[
\text{A) } 1 \quad
\text{B) } 2 \quad
\text{C) } 3 \quad
\text{D) } 4 \quad
\text{E) } 5
\]
Solution:
We evaluate the nested composition from the inside out:
\[
(f \circ g \circ f)(4) = f\bigl(g\bigl(f(4)\bigr)\bigr).
\]
Step 1: For the input argument $x = 4$, the condition $x \le 4$ applies:
\[
f(4) = 2.
\]
Step 2: We pass this value into $g(x)$. For the argument $x = 2$, the interval condition $x \le 2$ applies:
\[
g(2) = 1 – 2 = -1.
\]
Step 3: Finally, we pass $-1$ into the outer function $f(x)$. Since $-1 \le 4$ is true:
\[
f(-1) = 2.
\]
Therefore, the result of the composition is:
\[
(f \circ g \circ f)(4) = 2.
\]
\(\textbf{Answer: B} \)