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?


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?
