<s>[INST] For which $a$ does $\lvert x+1\rvert+\lvert 2-x\rvert=a^2 -1$ have exactly two solutions? If it is not a problem, I would really appreciate if someone could explain to me how to solve and graph the following equation:
For which real numbers $a$ does the equation
$$\lvert x+1\rvert +\lvert 2-x\rvert=a^2 -1$$
Have exactly two solutions?
 [/INST] This solution does not use graph or distance between points. We have $4$ cases to look at:
Case 1:
If $x < -1$, then $x+1 < 0$, and $2-x > 0$, so $LHS = -x-1 + 2-x = 1 - 2x = a^2 - 1 \to x = \dfrac{2-a^2}{2}$. This means the equation either has only one solution, or no solution depending on $a$. In particular it has one solution only if $\dfrac{2-a^2}{2} < -1$ or $a<-2$ or $a>2$
Case 2:
If $-1 < x < 2$, then $x+1 > 0$, and $2-x > 0$, so $LHS = x+1 + 2-x = 3 = a^2 - 1 \to a = \pm 2$, and the equation has infinitely many solutions on this interval $(-1,2)$ or it has no solution depending on $a$.
Case 3:
If $x > 2$, then $x+1 > 0$, and $2-x < 0$, so $LHS = x+1+x-2 = 2x-1 = a^2- 1 \to x = \dfrac{a^2}{2}$ which is one solution or no solution depending on $a$. In particular it has one solution only when $\dfrac{a^2}{2} > 2$, so $a<-2$ or $a > 2$
Case 4:
If $x = -1$ or $x = 2$, then $LHS = 3 = a^2 - 1 \to a = \pm 2$. This takes us back to case 2 which gives additional solutions. 
Observe that if $a < -2$ or $a > 2$, then we have one solution $x < -1$, and another solution $x > 2$. So in total there are $2$ solutions. For other values of $a$, we have either one or no solution or more than two solutions. Thus the answer is : $a < -2$ or $a > 2$.
</s>