How to calculate the range of $f(x) = x^2 - 2 | x |$?

Since $f(-x)=f(x)$ it is enough to find $f([0,\infty))$. On the interval $[0,\infty)$ the function decreases up to $x=1$ and then it increases. Hence the minimum value is $f(1)=-1$. The maximum is $\infty$ because $f(x) \to \infty$ as $ x \to \infty$. Hence the range is $[-1,\infty)$. [ For a continuous function the range is an interval].


You say that "the range of $(|x|+1)^2-1$ is also $[-1,\infty)$". This is where you are wrong: the minimum value of this expression is $0$ (when $x=0$).

On the plot, the two functions under scrutiny.

enter image description here


You observed that $$f(x) = x^2 + 2|x| = x^2 + 2|x| + 1 - 1 = (|x| + 1)^2 - 1$$ then claimed falsely that this implies that the range of the function is $[-1, \infty)$. This would be true if $|x| + 1$ could equal zero. However, $|x| \geq 0$ for each $x \in \mathbb{R}$. Therefore, as Anurag A observed in the comments, $|x| + 1 \geq 1$, with equality achieved at $x = 0$. Hence, $$f(x) = x^2 + 2|x| = (|x| + 1)^2 - 1 \geq 1^2 - 1 = 1 - 1 = 0$$ as you observed by inspecting the original function.

Range of $\boldsymbol{f(x) = x^2 - 2|x|}$

Observe that the function $f(x) = x^2 - 2|x|$ is symmetric with respect to the $y$-axis since $$f(-x) = (-x)^2 - 2|-x| = x^2 - 2|x| = f(x)$$
Therefore, to determine its range, it suffices to determine its range on the domain $[ 0, \infty)$ since it will have the same range on $(-\infty, 0]$.

As you observed, $$f(x) = x^2 - 2|x| = x^2 - 2|x| + 1 - 1 = (|x| - 1)^2 - 1$$ If $x \geq 0$, $|x| = x$, so we obtain $$f(x) = (x - 1)^2 - 1$$ which is the equation of a parabola with vertex $(1, -1)$ that opens upwards. As $x \to \infty$, $f(x) \to \infty$. Since $f$ is continuous, every value greater than or equal to $-1$ is obtained by the Intermediate Value Theorem. Hence, the range of the function is $[-1, \infty)$, as you found.

graph of f(x) = x^2 - 2|x|

Range of $\boldsymbol{f(x) = x^2 + 2|x|}$

Similarly, the function $f(x) = x^2 + 2|x|$ is symmetric with respect to the $y$-axis since $$f(-x) = (-x)^2 + 2|-x| = x^2 + 2|x| = f(x)$$
Thus, as in the previous example, to determine its range, it suffices to determine its range on the domain $[ 0, \infty)$ since it will have the same range on $(-\infty, 0]$.

If $x \geq 0$ then $$f(x) = x^2 + 2|x| = (|x| + 1)^2 - 1 = (x + 1)^2 - 1$$ which is a parabola with vertex $(-1, -1)$ that opens upwards. However, we require that $x \geq 0$. Since the function is increasing to the right of its vertex, the function achieves its minimum value at $x = 0$. That value is $f(0) = 0$. Since the function is continuous and $f(x) \to \infty$ as $x \to \infty$, it achieves every nonnegative value as $x$ increases by the Intermediate Value Theorem. Hence, its range is $[0, \infty)$.

graph of f(x) = x^2 + 2|x|

Tags:

Functions