Please enable scripting (or JavaScript) in your web browser, and then reload this page.
In this course so far, we’ve mostly studied functions that are defined by a single formula. We’ll now look at some functions that are defined by different formulas at different inputs.
Let $f$ be a function which is defined as follows:
For example, $f(-3)=(-3) - 1=-4$, because $-3<0$. On the other hand, $f(2)=2^2-1=3$, because $2≥0$.
Find the value of $f(x)$ at each value of $x$ in the table below.
Click to see a graph of $f(x)$. Notice that it looks like a line (the graph of $y=x-1$) to the left of the $y$-axis, and like a parabola (the graph of $y=x^2-1$) to the right of the $y$-axis.
Functions like $f$, which have different formulas at different $x$-values, are called piecewise-defined functions.
Let $\cl"red"g$ be defined as follows:
Find the value of $g(x)$ at each value of $x$ in the table below.
Click to see a graph of $g(x)$.
Notice that this is the same shape as the graph of $y={|x|}$. Click to see the graph of $g(x)$ along with the graph of $y={|x|}$.
That is, $g$ can be defined either piecewise, as above, or with the single formula $g(x)={|x|}$.
The function $h$ is defined by
This function $h$ is graphed on the grid to the left. The domain of $h$ does not include all real numbers. Instead, $\cl"red"h$ has the domain $\{x:-3≤x≤3\}$, because there is only a formula that tells you how to get $h(x)$ from $x$ when $-3 ≤ x ≤ 3$.
Notice that $h(0)=0-1=-1$. This is because the formula $x-1$ is used when $0 ≤ x ≤ 3$, which includes $x=0$. The formula $2x+4$ is only used when $-3 ≤ x < 0$, which does not include $x=0$. This is shown graphically by plotting a dot at the point $(0,-1)$ on the $x-1$ piece of the graph.
Click to see the graph of the function $k$ defined by
What is the domain of $k$?
The function $f$ is defined by
This is a special kind of piecewise-defined function where each piece’s formula is a constant (doesn’t change with $x$). A function of this kind is called a step function, because its graph looks like stair steps.
What is the domain of $f$?
Sometimes, you will need to take a number and turn it into a nearby integer (a whole number or the negative of a whole number). We’ll now look at two ways of doing this.
The function that gives the closest integer which is less than or equal to $x$ is called the floor function, written $\floor(x)$. For example, $\floor(2.78)=2$, and $\floor(-2.78)=-3$.
Find the value of $\floor(x)$ for each value of $x$ in the table below.
Click to see a graph of $\floor(x)$.
The function that gives the closest integer which is greater than or equal to $x$ is called the ceiling function, written $\ceiling(x)$. For example, $\ceiling(2.78)=3$, and $\ceiling(-2.78)=-2$. Click to see the graph of $\ceiling(x)$.
Find the value of $\ceiling(x)$ for each value of $x$ in the table below, and compare those values to the values of $\floor(x)$ you found in the previous question.