How does this equation always work? $\sqrt{x \times (x+2)+1} = x + 1$ for non-negative $x$, and $=|x|-1$ for negative $x$ When I was playing with new calculator's functions, somehow I managed to get a formula, which works with all real numbers (negative number have a slight change). I had asked my teacher about it, but never figured out why it works:
Non-Negative:
$$\forall x \in \Bbb R_0^+: \sqrt{x \times (x+2)+1} = x + 1$$
Negative:
$$\forall x \in \Bbb R^-: \sqrt{x \times (x+2)+1} = |x| - 1$$

Note that you have a perfect square trinomial.
$$x(x+2)+1 = x^2+2x+1$$
You probably know that by binomial expansion, $(a\pm b)^2 = a^2\pm 2ab+b^2$.
$$(a\pm b)^2 = (a\pm b)(a\pm b) = a^2\pm ab\pm ba +b^2 = a^2\pm2ab+b^2$$
Notice the trinomial $x^2+2x+1$. You can see there are two perfect squares: $x^2$ and $1$. Also, the middle term is twice the product of their squares. Hence, the trinomial is of the form $a^2+2ab+b^2$. Factoring, you get
$$x^2+2(x)(1)+1^2 = (x+1)^2$$
So you have$\sqrt{(x+1)^2}$. You also have  $\sqrt{a^2} = \vert a\vert$, so
$$\sqrt{(x+1)^2} = \vert x+1\vert = \begin{cases} \ x+1; \quad x \geq -1 \\ -x-1 = \vert x\vert-1; \quad x < -1\end{cases}$$
