A couple of properties of a square root play an important role in these transformations.
First of all, square root in this case is understood in its arithmetic meaning, that is a positive value. So, #sqrt(4)# is equal to #2#, not #+-2#.
So, we can replace: #sqrt(4)=2#.
Secondly, keep in mind that #sqrt(a*b)=sqrt(a) * sqrt(b)#, where #a# and #b# are positive numbers. This can be easily proven based on the definition of #sqrt(X)# being a number that, if raised to the power of #2#, would produce #X#.
Indeed, let's raise #sqrt(a) * sqrt(b)# to the power of 2:
#[sqrt(a) * sqrt(b)]^2 = sqrt(a) * sqrt(b) * sqrt(a) * sqrt(b)=#
#=(sqrt(a) * sqrt(a)) * (sqrt(b) * sqrt(b))=a*b#,
which proves that #sqrt(a)*sqrt(b)# is #sqrt(a*b)#
That's why we can replace
#sqrt(8)=sqrt(4*2)=sqrt(4)*sqrt(2)=2sqrt(2)#
Finally,
#sqrt(2) * 2 * sqrt(2) = 2 * sqrt(2) * sqrt(2) = 2*2 = 4#