Complicated question, please help me out I'm not able to get a proper defined function and not able to determine it's nature, pls help

Let the function $f:[0,1] \longrightarrow \Bbb R$ be defined by
$$f(x) = \max\left\{\frac{|x-y|}{x+y+1}\, :\, 0\leqslant y \leqslant 1\right\}.$$
Then what are the intervals on which the function is strictly increasing and strictly decreasing?

 A: It might help to view it as $$f(x)=\max \left \{ \max \left \{ \frac{x-y}{x+y+1} : y \in [0,x] \right \},\max \left \{ \frac{y-x}{x+y+1} : y \in [x,1] \right \} \right \}.$$
My hint for finishing the actual question is to look at $\frac{\partial}{\partial y} \left ( \frac{x-y}{x+y+1} \right )$ and examine its sign behavior, that will tell you what the first maximum is as a function of $x$. The second one works out in pretty much the same way. Then to deal with the outer "max" you just need to set the two maxima equal to each other to find where the crossover point(s) is/are.
A: For each $x\in [0,1]$, the $y\in [0,1]$ which maximizes $\frac{|x-y|}{x+y+1}$ also maximizes ${\left(\frac{|x-y|}{x+y+1}\right)}^2$.
Because $|x-y|^2 = (x-y)^2$, we may apply calculus techniques to the second one.
We could also not square, and consider when $y\leqslant x$ and when $y>x$, but squaring does away with cases.
Hence the maximum occurs when $y=0$, when $y=1$ or when $y$ is a root of the derivative
$$\frac \partial{\partial y}\left(\frac{{(x-y)}^2}{{(x+y+1)}^2}\right) = \frac{-2(2x+1)(x-y)}{(x+y+1)^3}.$$
This is $0$ only when $y=x$, but we see that in this situation the original functions attains its lowest value $(0)$, and hence the maximum occurs when $y=0$ or when $y=1$.
So the maximum is either $x/(x+1)$ or $(1-x)/(x+2)$.
Now, we have
$$\begin{align}
\frac x{x+1} > \frac {1-x}{x+2}
&\iff x(x+2) > (1+x)(1-x)
\\&\iff x^2 + 2x > 1-x^2
\\&\iff 2x^2+2x - 1 > 0 \iff x<\frac{-1-\sqrt3}2 \,\,\text{ or }\,\, x>\frac{-1+\sqrt3}2
\end{align}$$
It follows that
$$f(x)=\begin{cases}
\frac{1-x}{x+2}&;&x\in\left[0, \frac{-1+\sqrt3}2\right]\\
\frac{x}{x+1}&;&x\in\left(\frac{-1+\sqrt3}2, 1\right]\\
\end{cases}$$
Do you think you can take it from here?
A: For any fixed $x\in[0,1]$, if $x\le y\le1$ then
$${|x-y|\over x+y+1}={y-x\over x+y+1}={x+y+1-(2x+1)\over x+y+1}=1-{2x+1\over x+y+1}\le1-{2x+1\over x+1+1}={1-x\over2+x}$$
while if $x\ge y\ge0$ then
$${|x-y|\over x+y+1}={x-y\over x+y+1}\le{x-0\over x+0+1}={x\over1+x}$$
Consequently
$$f(x)=\max\left\{{1-x\over2+x},{x\over1+x} \right\}$$
The graph of $y=(1-x)/(2+x)$ is a decreasing hyperbola, while the graph of $y=x/(1+x)$ is an increasing hyperbola.  They cross when $(1-x)/(2+x)=x/(1+x)$, i.e., when $1-x^2=x^2+2x$, which is to say when $2x^2+2x-1=0$, which occurs (on $[0,1]$) at $x=(-1+\sqrt3)/2$. So the function $f(x)$ is decreasing for $0\le x\le(\sqrt3-1)/2$ and increasing for $(\sqrt3-1)/2\le x\le1$.
