# How to solve $|x-5|=|2x+6|-1$?

$|x-5|=|2x+6|-1$.

The answer is $0$ or $-12$, but how would I solve it by algebraically solving it as opposed to sketching a graph?

$|x-5|=|2x+6|-1\\ (|x-5|)^2=(|2x+6|-1)^2\\ ...\\ 9x^4+204x^3+1188x^2+720x=0?$

-
One hard way is to determine for what values of $x$ the absolute value is positive or negative. For example, if $x\geq 5$ then $|x-5|=x-5$. Do the same to the other and take the intersections of intervals. –  Sigur Jan 11 '13 at 17:54

Consider different cases:

Case 1: $x>5$ In this case, both $x-5$ and $2x+6$ are positive, and you can resolve the absolute values positively. hence $$x-5=2x+6-1 \Rightarrow x = -10,$$ which is not compatible with the assumption that $x>5$, hence no solution so far.

Case 2: $-3<x\leq5$ In this case, $x-5$ is negative, while $2x+6$ is still positive, so you get $$-(x-5)=2x+6-1\Rightarrow x=0;$$ Since $0\in[-3,5]$, this is our first solution.

Case 3: $x\leq-3$ In this final case, the arguments of both absolute values are negative and the equation simplifies to $$-(x-5) = -(2x+6)-1 \Rightarrow x = -12,$$ in agreement with your solution by inspection of the graph.

-
I was really preparing an answer like it. Nice and understandable one. +1 –  Babak S. Jan 11 '13 at 18:00

That's not the way, because you're creating extra solutions (new roots) when you put square on both sides. Just separate the options:

$$x-5=2x+6-1\\ 5-x=2x+6-1\\ x-5=-2x-6-1\\ 5-x=-2x-6-1$$

Solve all of them, and you have the solutions

Take into acount that once you get your solutions, you have to check if they're possible, for example, in the first one, you have supposed that bot things inside || are positive, so if you get something for which x-5 or 2x+6 is negative, then you have to throw it away

-

Look for where the expressions inside the absolute values change sign: $x-5$ changes sign at $x=5$, and $2x+6$ changes sign at $x=-3$. Thus, when $x<-3$, $x-5$ and $2x+6$ are both negative, and the equation is $$-(x-5)=-(2x+6)-1\;.$$

When $-3\le x<5$, $x-5$ is negative and $2x+3$ is non-negative, so the equation is

$$-(x-5)=2x+6-1\;.$$

And when $x\ge 5$, both expressions are non-negative, and the equation is

$$x-5=2x+6-1\;.$$

Thus, you need to solve

\left\{\begin{align*} &-x+5=-2x-7&&\text{when }x<-3\\ &-x+5=2x+5&&\text{when }-3\le x<5\\ &x-5=2x+5&&\text{when }x\ge 5\;. \end{align*}\right.\tag{1}

$(1)$ reduces to

\left\{\begin{align*} &x=-12&&\text{and }x<-3\\ &x=0&&\text{and }-3\le x<5\\ &x=-10&&\text{and }x\ge 5\;. \end{align*}\right.\tag{2}

The first two solutions in $(2)$ fall within the intervals on which they are valid; the third does not and therefore is not a solution.

-

I think the sketch approach suggests a solution, which is to partition the domain.

Consider the function $f(x) = |x-5|-|2x+6|+1$. Look at the absolute value part and see that you can split the domain into $I_1= (-\infty, -3]$, $I_2 = (-3,5]$ and $I_3 = (5,\infty)$.

On $I_1$, $f(x) = x+12$, on $I_2$, $f(x) = -3x$, and on $I_3$, $f(x) = -(x+10)$.

Now look for solutions to $f(x) = 0$ on each of these intervals.

For example, on $I_3$, solving $-(x+10) = 0$ yields $x=-10$, but $-10 \notin I_3$, hence $f(x) \neq 0$ for $x \in I_3$.

-
Nice illustration. –  Babak S. Jan 11 '13 at 18:43

You have $|x-5|=|2x+6|-1$.

1)If $x\geq5$, $|x-5|=x-5$ and, $|2x+6|=2x+6$, so you have

$x-5=2x+6-1$

$x-5=2x+5$

$x=-10$ (but is not valid)

2)If $-3/2\leq x<5$, $|x-5|=-(x-5)$ and $|2x+6|=2x+6$, then

$-(x-5)=2x+6-1$

$-x+5=2x+5$

$-x=2x$

$x=0$

3)If $x<-3/2$, $|x-5|=-(x-5)$ and $|2x+6|=-(2x+6)$, then

$-(x-5)=-(2x+6)-1$

$-x+5=-2x-6-1$

$-x+5=-2x-7$

$-x+5=-2x-7$

$x=-12$

So, the answer for $x$ is $x=0$ or $x=-12$

-

hint: at first let $x>5$ then solve it. Then do the same for the intervals $-3<x<5$ and $x<-3$

-