5.
\(A=\sqrt{\dfrac{x-2\sqrt{x}+1}{x+2\sqrt{x}+1}}=\sqrt{\dfrac{\left(\sqrt{x}-1\right)^2}{\left(\sqrt{x}+1\right)^2}}=\dfrac{\left|\sqrt{x}-1\right|}{\sqrt{x}+1}\)
\(B=\dfrac{x-1}{\sqrt{y}-1}\sqrt{\dfrac{\left(y-2\sqrt{y}+1\right)^2}{\left(x-1\right)^4}}=\dfrac{x-1}{\sqrt{y}-1}.\sqrt{\dfrac{\left(\sqrt{y}-1\right)^4}{\left(x-1\right)^4}}\)
\(=\dfrac{x-1}{\sqrt{y}-1}.\dfrac{\left|\left(\sqrt{y}-1\right)^2\right|}{\left|\left(x-1\right)^2\right|}=\dfrac{x-1}{\sqrt{y}-1}.\dfrac{\left(\sqrt{y}-1\right)^2}{\left(x-1\right)^2}=\dfrac{\sqrt{y}-1}{x-1}\)
6.
\(A=\dfrac{\left(\sqrt{a}+2\right)^2}{\sqrt{a}+2}-\dfrac{a-4}{\sqrt{a}-2}=\sqrt{a}+2-\dfrac{\left(\sqrt{a}-2\right)\left(\sqrt{a}+2\right)}{\sqrt{a}-2}\)
\(=\sqrt{a}+2-\left(\sqrt{a}+2\right)=0\)
\(B=\dfrac{\left(\sqrt{x}+\sqrt{y}\right)\left(x-\sqrt{xy}+y\right)}{\sqrt{x}+\sqrt{y}}-\left(x-2\sqrt{xy}+y\right)\)
\(=x-\sqrt{xy}+y-x+2\sqrt{xy}-y\)
\(=\sqrt{xy}\)