This is a homework question from a precalculus class that I'm a TA for.

Define the functions $$ f(x) = \begin{cases} 2x+12 &\text{if }\; x<0 \\ 5 &\text{if }\; 0\leq x \leq 6 \\ x-7 &\text{if }\; x>6 \\ \end{cases} \quad\text{and}\quad g(x) = \begin{cases} x+4 &\text{if }\; x<2 \\ 8-x &\text{if }\; x\geq 2 \\ \end{cases}\,. $$ Graph on a real number line all solutions to the inequality $f(x) > g(x).$

I wanted to write up a thorough solution to this exercise for my class, and figured I'd post it online to help anyone else who may wander across it.


1 Answer 1


To compare $f$ and $g$, it is helpful to rewrite the two piecewise-defined functions above so that they each have the same number of pieces, and so that their pieces are each defined on matching subsets of their domains. One may feel inclined to say that we want to express the functions on commensurate domains. Anyways, we can write $f$ and $g$ as $$ f(x) = \begin{cases} 2x+12 &\text{if }\; x<0 \\ 5 &\text{if }\; 0\leq x <2 \\ 5 &\text{if }\; 2\leq x \leq 6 \\ x-7 &\text{if }\; x>6 \\ \end{cases} \quad\text{and}\quad g(x) = \begin{cases} x+4 &\text{if }\; x<0 \\ x+4 &\text{if }\; 0\leq x<2 \\ 8-x &\text{if }\; 2 \leq x\leq 6 \\ 8-x &\text{if }\; x > 6 \\ \end{cases}\,. $$ Now we can find where $f(x) > g(x)$ by considering the pieces individually. We'll consider the top piece of each function first. On the subset of the domain where $x<0$, $f(x) = 2x+12$ and $g(x) = x+4$. So, restricted to this subset of the domain, $f(x) > g(x)$ if $$ \begin{align} 2x+12 &> x+4 \\ \iff \quad x &> -8\,. \end{align} $$ But we are only considering the subset of the domain where $x<0$, so in general, $f(x) > g(x)$ for $x$ such that $x<0$ and $x>-8$, which is all $x$ in the interval $(-\infty, 0) \cap (-8, \infty) = (-8,0)$. We can similarly consider the other three pieces. We have $f(x) > g(x)$ where $$ \begin{align} 5>x+4 \;&\text{ and }\; 0 \leq x < 2\,, \\ 5>8-x \;&\text{ and }\; 2 \leq x \leq 6\,, \\ \text{or where}\;\;x-7>8-x \;&\text{ and }\; x>6\,. \end{align} $$ These three intervals where $f(x) > g(x)$ are $[0,1)$, $(3,6]$, and $\left(\frac{15}{2},\infty\right)$ respectively, so $f(x) > g(x)$ for all $x$ in the set $$ \begin{align} (-8,0) \cup [0,1) &\cup (3,6] \cup \left(\frac{15}{2},\infty\right) \\[1em] =\;\; (-8,1) &\cup (3,6] \cup \left(\frac{15}{2},\infty\right)\,. \end{align} $$ Graphed on the real line, this set looks like:

solution graphed on a number line

Then if we wanted to be a bit extra about it, we could graph the functions $f$ and $g$ to visually verify that our solution is correct. In the graph below, $\color{red}{f \text{ is red }}$ and $\color{blue}{g \text{ is blue }}$.

the graphs of the functions f and g


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .