<s>[INST] Modulus function: finding set of values. I didn't learn this in my syllabus but it is in some past papers. I need a small explanation for how to find the possible values for p to give 0, 1 or 2 roots.
Here is an example question: $f(x)=6-|x+2|$ with roots (-8,0) and (4,0)
Find the set of values for p for which the equation $f(x)=px+5$ has 0 solutions or 1 solution or 2 solutions.
I tried to equate both versions of the modulus to the second definition of the function but it didn't really get me anywhere.
 [/INST] I think what you mean it to find the values for which $6-|x+2| = px + 5$ have $0, 1$ or $2$ solutions.  The solutions, not roots, are when $6-|x+2|$ and $px+5$ both equal the same number which might not and probably will not be $0$.  $6-|x+2|$ has two roots; $x=4$ and $x = -8$ and $px +5$ will have one root if $p\ne 0$ and that is $x =-\frac 5p$.  But we are not looking for when they are both $0$ (which can only happen if $-\frac 5p =-8$ or if $-\frac 5p = 4$) but when they are both equal to .... something.
If $6-|x+2| = px + 5$ then we have two possible cases and two equations to solve.

*

*$x+2 \ge 0$.  That is $x\ge -2$.  Then

$6 -(x+2) = px + 5$
$4 -x = px + 5$
$-1 = px + x= x(p+1)$
$x = -\frac 1{p+1}$.  But this can only be a solution if a) $p+1\ne 0$ that is $p \ne -1$ and b) $x \ge -2$.  And if $x =-\frac 1{p+1} \ge -2$ then
$\frac 1{p+1} \le 2$
If $p< -1$ then $\frac 1{p+1} < 0 < 2$ so this will always be true.
But if $p > -1$ then we need $0< \frac 1{p+1} < 2$ or $1 < 2(p+1)$ so $p>-\frac 12$.

$x =-\frac 1{p+1}$ will be one solution if $p < -1$ or $p>-\frac 12$.



*$x+2 < 0$. That is $x < -2$. then

$6 -(-(x+2)) = px + 5$
$6 + x+2 = px+5$
$8 + x= px + 5$
$3 = px -x= x(p-1)$
$x = \frac 3{p-1}$
But this can only be a solution if a) $p-1\ne 0$ or $p =1$.  and $b) x = \frac 3{p+1} < -2$.
If $p > 1$ then $\frac 3{p-1} > 0 > -2$ and this can never happen.
If $p < 1$ then we have $\frac 3{p-1} < 0$ and we need
$\frac 3{p-1} < -2$
$3 > -2(p-1)= -2p +2$
$1 > -2p$
$p > -\frac 12$.

$x = \frac 3{p-1}$ will be one solution if $-\frac 12 < p < 1$.

Putting those two results together:

if $p < -1$  then $x=-\frac 1{p+1}$ will be the only solution.
if $-1 \le p \le -\frac12$ then there will be no solutions.
if $-\frac 12 < p < 1$ there there will be two solutions.  $x =-\frac 1{p+1}$ and $x = \frac 3{p-1}$.
if $x \ge 1$ then $x=-\frac 1{p+1}$ will be the only solution.

</s>