Number of solutions of $\ln(|a-x|)=x$ I don't want to duplicate this question:
which is too similar to post it again
but could you explain to me, how do we determine the number of root in the interval, using the derivative?
I have tried substitution with:
$$ y=a-x\\x=a-y~~for~x>0\\x=y-a~~for~x<0\\x>0\\f(y)=\ln(y)+y-a\\f'(y)=\frac{1}{y}+1\\f'(y)=0~~~y=-1\\\\f'(y)>0~~~y<-1\\\\f'(y)<0~~~y>-1\\min=0$$
Then I substitute:
$$\ f(-1)=a+1$$
Thus $f(-1)=0$ for $a=1$. Similarly I construct the answers for $x<0$. However, how to determine the number of roots for every interval of a?
 A: The equation can be splitted in two parts
$$\ln(a-x)=x,\quad x<a$$
$$\ln(x-a)=x,\quad x>a$$
The first equation has one and only one solution for any value of $a$.
consider $f(x)=\ln(a-x)-x$
Its derivative is $f'(x)=\frac{1}{x-a}-1$ which is negative for $x<a$. Thus $f(x)$ is decreasing and its range is $(-\infty,\infty)$ so for the intermediate value theorem it assumes once and only once the value $f(x)=0$
For the second equation consider $g(x) = \ln(x-a)-x$.
$$  \mathop {\lim }\limits_{x \to a^ +  } \ln \left( {x - a} \right) - x =  - \infty  $$
$$
  \mathop {\lim }\limits_{x \to  + \infty } \ln \left( {x - a} \right) - x =  - \infty 
$$
We have $$g'(x) = \frac{1}{x-a}-1=\frac{1-x+a}{x-a}$$
$g'(x) = 0 $ for $x=1+a$ and we can see that this is a point of maximum since $g'(x)<0$ for $x>1+a$ and $g'(x)>0$ for $a<x<1+a$.
For $a=-1$ we have $x=0, g(0)=0$ and the tangent in $(0,0)$ is $y=0$. One single intersection.
$y$-value of the point of maximum is $g(1+a)=\ln(1+a-a)-1-a=-1-a>0$ for $-1-a>0\to a<-1$.
So $g(x)$ has two roots for $a<-1$ because second derivative is $g''(x)=-\frac{1}{(x-a)^2}$ and is negative for any $x$, which means that concavity is down on all the function's domain. Therefore $g(x)$ must intersect $y$-axis in two points because the limits at $a^+$ and $+\infty$ are both $-\infty$.
Therefore $g(x)$ has no roots for $a>-1$, one root for $a=-1$ and two roots for $a<-1$.
In conclusion we can say that the given equation
$$\ln|a-x|=x$$
has three roots for $a<-1$, two roots for $a=-1$ and one root for $a>-1$.
A: The equation can be rewritten
$$a=x\pm e^x.$$
The branch $x+e^x$ is monotonic, from $-\infty$ to $\infty$ and contributes one root for all $a$.
The branch $x-e^x$ has a maximum at $x=0$, where $a=-1$. For $a<-1$, that makes two roots, and one for $a=-1$.
A: 
Note first that for any $a$, there will always be exactly one point in the decreasing part of $y = ln|x-a|$ (i.e. $x<a$), that intersects the line $y=x$. So it remains to determine how many points of intersection there are of the graph $y = ln|x-a|$ and $y = x$ for the increasing part of the graph $y = ln|x-a|$ (i.e. $x>a$).
Given $a$, we want to find the unique point $(x_1,y_1)$ on the graph of $y = ln|x-a|$ with gradient $1$. Then one of 3 things is possible:

*

*$\bbox[yellow]{x_1 > y_1:}\ (x_1,y_1)$ lies "underneath" the line $y=x$, in which case there is no solution to $ln|x-a| = x$ on the increasing part of the graph.

*$\bbox[yellow]{x_1 = y_1:}\ (x_1,y_1)$ lies "on" the line $y=x$, in which case $(x_1,y_1)$ is the only solution to $ln|x-a| = x$ on the increasing part of the graph  and $(x_1,y_1) = (0,0)$.

*$\bbox[yellow]{x_1 < y_1:}\ (x_1,y_1)$ lies "above" the line $y=x$, in which case there are two solution to $ln|x-a| = x$ on the increasing part of the graph: one is in the first quadrant and one is in the 3rd quadrant.

Now let's get to the differentiation stuff.
$f(x) = ln|x-a| \implies f'(x) = \frac{1}{x-a},\ a \neq 0. \quad f'(x_1) = 1 \implies \frac{1}{x_1-a} = 1 \implies x_1 = 1-a \implies y_1 = ln|1| = 0, \ \therefore \text{point with} \ m = 1 \ \text{on} \ y = ln|x-a| \ \text{is} \ (x_1,y_1) = (1+a,0).$
$$$$

*

*$\bbox[yellow]{x_1 > y_1}\ \implies 1+a >0 \implies a>-1$. From the graph below, we see there is one solution to $ln|x-a| = x $ when $a>-1$.


$$$$


*$\bbox[yellow]{x_1 = y_1}\ \implies a=-1$. From the graph below, we see there are two solutions to $ln|x-a| = x$ when $a=-1$.


$$$$


*$\bbox[yellow]{x_1 < y_1}\ \implies a<-1$. From the graph below, we see there are three solutions to $ln|x-a| = x$ when $a<-1$.


