# How can I plot this function that has a fraction that has an absolute value in the denominator?

I have this piecewise function:

$$f(x)=\begin{cases} \dfrac{x^2-x-2}{|x-2|}, & x \neq 2 \\ 0, & x = 2\text{.} \end{cases}$$

I can't figure out how to graph it. I punched these numbers into my calculator, and it created a parabola, but I haven't been able to get there on my own without the calculator.

So far I have plotted the point $(2,0)$ on my graph, and I factored the first function to $\dfrac{(x-2)(x+1)}{|x-2|}$ and now I am stuck. I tried multiplying both the top and bottom by $x+2$, but after simplifying I ended up with $x+1$, which I am pretty positive is not correct.

Where did I go wrong?

Hint: recall (ignoring the $x = 2$ case): $$|x-2| = \begin{cases} x-2, & x-2 > 0 \\ -(x-2), & x-2 < 0 \end{cases} = \begin{cases} x-2, & x > 2 \\ -(x-2), & x < 2\text{.} \end{cases}$$ So $$\dfrac{x^2-x-2}{|x-2|} = \begin{cases} \dfrac{x^2-x-2}{x-2} = \dfrac{(x-2)(x+1)}{x-2} = x+1, & x > 2 \\ \dfrac{x^2 - x - 2}{-(x-2)} = -(x+1), & x < 2\text{.} \end{cases}$$

• Do I ignore the x=2 case when I graph this function? – matryoshka Jun 14 '15 at 20:08
• @Grace When $x = 2$, $f(x) = 0$. This is by definition in the problem. – Clarinetist Jun 14 '15 at 20:09

Dividing the two cases: $$x-2>0 \iff x>2 \Rightarrow |x-2|=x-2$$ and

$$x-2<0 \iff x<2 \Rightarrow |x-2|=2-x$$ your function become: $$f(x)= \begin {cases} y=-x-1 \quad , \quad x<2\\ y=0 \quad,\quad x=2\\ y=x+1\quad,\quad x>2 \end{cases}$$

the graph is done by two open half-lines ( decreasing for $x<2$ and crescent for $x>2$) and an isolated point $(2,0)$.

Note that $\frac{x}{|x|}=1$ for $x>$ and $\frac{x}{|x|}=-1$ for $x<0$. Thus,

$$\bbox[5px,border:2px solid #C0A000]{\frac{(x-2)(x+1)}{|x-2|}=\text{sgn}(x-2)(x+1)}$$

where $\text{sgn}(x-2)=1$ for $x>2$ and $\text{sgn}(x-2)=-1$ for $x<2$. We can define the sign function as $0$ when its argument is $0$. And we're done!