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$$
 A: The right calculation is the follows:$$\sqrt{(x+1)^2}=|x+1|$$
A: Remark that $x \cdot (x+2) + 1 = x^2 + 2x + 1 = (x+1)^2$, so:
$$
\sqrt{x \cdot (x+2) + 1} = \sqrt{(x+1)^2} = |x+1|
$$
You may also note that:


*

*For $x \geq -1$, we have $|x+1| = x+1$

*For $x \leq -1$, we have $|x+1| = -(x+1) = -x-1 = |x|-1$ (since $x<0$)


This shows why your formula works in the ranges it does. Note, though, that your ranges aren't quite right: for $x$ in $[-1,0]$, your first formula applies (try for example with $x=-1/2$: you get $1/2$, not $-1/2$).
A: 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}$$
