# Difference between revisions of "2019 AMC 10B Problems/Problem 9"

## Problem

The function $f$ is defined by $$f(x) = \lfloor|x|\rfloor - |\lfloor x \rfloor|$$for all real numbers $x$, where $\lfloor r \rfloor$ denotes the greatest integer less than or equal to the real number $r$. What is the range of $f$? $\textbf{(A) } \{-1, 0\} \qquad\textbf{(B) } \text{The set of nonpositive integers} \qquad\textbf{(C) } \{-1, 0, 1\} \qquad\textbf{(D) } \{0\} \qquad\textbf{(E) } \text{The set of nonnegative integers}$

## Solution

There are 4 cases we need to test here:

Case 1: x is a positive integer. WLOG, assume x=1. Then f(1) = 1 - 1 = $0$.

Case 2: x is a positive fraction. WLOG, assume x=0.5. Then f(0.5) = 0 - 0 = $0$.

Case 3: x is a negative integer. WLOG, assume x=-1. Then f(-1) = 1 - 1 = $0$.

Case 4: x is a negative fraction. WLOG, assume x=-0.5. Then f(-0.5) = 0 - 1 = $-1$.

Thus the range of function f is $\boxed{\textbf{(A) } \{-1, 0\}}$

## Solution 2

It is easily verified that when $x$ is an integer, then $f(x)$ is zero. We need only to consider the case when $x$ is not.

When $x$ is a positive number, $\lfloor x\rfloor \geq 0$, so $$f(x)=\lfloor|x|\rfloor-|\lfloor x\rfloor|$$ $$=\lfloor x\rfloor-\lfloor x\rfloor$$ $$=\textbf{0}$$

When $x$ is a negative number, let $x=-a-b$ be composed of integer part $a$ and decimal part $b$ (both $\geq 0$): $$f(x)=\lfloor|-a-b|\rfloor-|\lfloor -a-b\rfloor|$$ $$=\lfloor a+b\rfloor-|-a-1|$$ $$=a-(a+1)=\textbf{-1}$$

Thus, the range of f is $\boxed{\textbf{(A) } \{-1, 0\}}$

Note: One could solve the case of $x$ as a negative non-integer this way: $$f(x)=\lfloor|x|\rfloor-|\lfloor x\rfloor|$$ $$=\lfloor -x\rfloor-|-\lfloor -x\rfloor-1|$$ $$=\lfloor -x\rfloor-(\lfloor -x\rfloor+1) = \textbf{-1}$$

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. 