Concept:
The function $f(x) = \frac{|x|}{x}$ is known as the signum function (for $x \neq 0$). It outputs $+1$ for all positive numbers and $-1$ for all negative numbers. Because its definition changes at $x = 0$, any definite integral crossing zero must be split into two separate piecewise intervals using the property $\int_a^b f(x) dx = \int_a^c f(x) dx + \int_c^b f(x) dx$.
Step 1: Define the piecewise behavior of the function.
$$f(x) = \frac{|x|}{x} = \begin{cases} \frac{-x}{x} = -1 & \text{for } x<0 \\ \frac{x}{x} = 1 & \text{for } x>0 \end{cases}$$
Step 2: Split the definite integral at the critical point $x=0$.
$$\int_{-2}^{1} \frac{|x|}{x} dx = \int_{-2}^{0} \left(\frac{|x|}{x}\right) dx + \int_{0}^{1} \left(\frac{|x|}{x}\right) dx$$
Step 3: Substitute the appropriate piecewise values.
For the interval $[-2, 0)$, $x$ is negative, so the function value is $-1$.
For the interval $(0, 1]$, $x$ is positive, so the function value is $1$.
$$= \int_{-2}^{0} (-1) dx + \int_{0}^{1} (1) dx$$
Step 4: Evaluate the definite integrals.
$$= [-x]_{-2}^{0} + [x]_{0}^{1}$$
$$= \left( -0 - (-(-2)) \right) + \left( 1 - 0 \right)$$
$$= (0 - 2) + 1$$
$$= -2 + 1 = -1$$