I've been going through solution which solves about missing two number in array. The solution provider assumes following equation :
$\displaystyle a-b= \sqrt{(a+b)^2 -4ab}$
I am not sure, what is the base equation from which it has been derived.
I've been going through solution which solves about missing two number in array. The solution provider assumes following equation :
$\displaystyle a-b= \sqrt{(a+b)^2 -4ab}$
I am not sure, what is the base equation from which it has been derived.
First of all :
$$\sqrt{(a+b)^2-4ab} \color{red}\neq a-b $$
The correct identity is :
$$\displaystyle \sqrt{(a+b)^2-4ab} =|a-b| $$ $\big(|x|$ denotes Absolute Value of $x \big)$
This is so because ;
$$\color{blue}{(a+b)^2-4ab}=a^2+b^2+2ab-4ab=a^2+b^2-2ab= \color{blue}{(a-b)^2}$$
Therefore :
$$ \sqrt{(a+b)^2-4ab}=\sqrt{(a-b)^2}=|a-b|$$