A piecewise defined function is a function that is defined in parts, or pieces, where the rule used to find the function’s values is determined by the value of the input. For example,
$$
f(x)=\begin{cases}
x^2 & if\ x< 0 \\
2x+1 & if\ 0\leq x\leq 10 \\
x^3 & if\ 10< x
\end{cases}
$$
Thus, in the above case, the function \(f\) will use the rule \(x^2\) if the input is less than 0. If the input is greater than or equal to \(0\) and less than or equal to \(10\), then the function will use the rule \(2x+1\). If the input is greater than 10, then the function will use the rule \(x^3\) to find the function’s correct output. Again, the input determines what function is used to compute the output of the whole thing.
More tangibly, to find, say, the value of \(f(2)\), note that the input \(x=2\) is between 0 and 10, so we use the second rule to get \(f(2)=2(2)+1=5\). To find the value of \(f(20)\), notice that \(20>10\) so the third rule applies here. \(f(20)=8000\). Lots more examples below!
$$
f(x)=\begin{cases}
3x+4 & x<3 \\
0 & 3\leq x
\end{cases}
$$
\(f(1)=7\)
\(f(-3)=-5\)
\(f(5)=0\)
$$
g(x)=\begin{cases}
-4x+2 & x\leq 0 \\
\frac{1}{x} & 0<x<2 \\
x^2 & x\geq 2
\end{cases}
$$
\(g(-4)=18\)
\(g(0)=2\)
\(g(3)=9\)
$$
f(x)=\begin{cases}
0 & x\leq -1 \\
\frac{1}{1-x} & -1< x< 1 \\
x^2+1 & 1\leq x
\end{cases}
$$
\(f(-1)=0\)
\(f(1)=2\)
\(f\left(\frac{1}{2}\right)=2\)
$$
h(x)=\begin{cases}
x^2-3 & x\leq 0 \\
\frac{1}{x} & 2< x< 3 \\
x^2+1 & 3\leq x
\end{cases}
$$
\(h(-4)=13\)
\(h(1)\) Does Not Exist
\(h(4)=17\)