A function $g$ is defined as $g(x)=|4-x|$, find the range of $g$ if its domain is $-3\leq x \leq 6$.
My attempt:
I substitute $-3$ and $6$ into the function and I got $2$ and $7$. And the answer is between $0$ to $7$.
What should I do to get the correct answer ? Thanks in advance.
$\endgroup$ 31 Answer
$\begingroup$Let's begin with the graph of the absolute value function $f(x) = |x|$. Since $|x|$ represents the distance of the number $x$ from $0$, $$|x| = \begin{cases} x && \text{if $x \geq 0$}\\ -x && \text{if $x < 0$} \end{cases} $$ Hence, its graph consists of the two rays $y = x, x \geq 0$ and $y = -x, x < 0$. The common endpoint of these two rays is the vertex of the graph, which is located at the origin.
Observe that $|x| = |-x|$ since the points $x$ and $-x$ are equidistant zero. Hence, $$|4 - x| = |-(4 - x)| = |-4 + x| = |x - 4|$$ The graph of $y = |x - 4|$ is obtained from the graph of $f(x)$ by translating the graph of $f(x)$ by four units to the right. You should be able to convince yourself of this by making a table of values for $y = |x|$ and $y = |x - 4|$. Another way to see this is to write the piecewise definition @shn stated in the comments $$|4 - x| = |x - 4| = \begin{cases} x - 4 && \text{if $x \geq 4$}\\ 4 - x && \text{if $x < 4$} \end{cases} $$ then graph the rays $y = x - 4, x \geq 4$ and $y = 4 -x, x < 4$.
Restricting the domain $y = |x - 4|$ to $[-3, 6]$ yields the graph of $g(x) = |x - 4|, -3 \leq x \leq 6$.
From its graph, we see that $g$ has minimum value $0$ at $x = 4$ (its vertex) and maximum value $7$ at $x = -3$. Since the function is continuous, it assumes every value between $0$ and $7$ in the interval $[-3, 4]$ and, consequently, in the interval $[-3, 6]$.
$\endgroup$