Lời giải:
a) ĐKXĐ: \(a>0; a\neq 1\)
\(M=\left(\frac{\sqrt{a}}{2}-\frac{1}{2\sqrt{a}}\right)\left(\frac{a-\sqrt{a}}{\sqrt{a}+1}-\frac{a+\sqrt{a}}{\sqrt{a}-1}\right)\)
\(=\frac{a-1}{2\sqrt{a}}.\frac{(a-\sqrt{a})(\sqrt{a}-1)-(a+\sqrt{a})(\sqrt{a}+1)}{(\sqrt{a}+1)(\sqrt{a}-1)}\)
\(=\frac{a-1}{2\sqrt{a}}.\sqrt{a}.\frac{(\sqrt{a}-1)^2-(\sqrt{a}+1)^2}{a-1}\)
\(=\frac{(\sqrt{a}-1)^2-(\sqrt{a}+1)^2}{2}=\frac{a+1-2\sqrt{a}-(a+1+2\sqrt{a})}{2}=\frac{-4\sqrt{a}}{2}=-2\sqrt{a}\)
b)
Để \(M=-4\Leftrightarrow -2\sqrt{a}=-4\Leftrightarrow \sqrt{a}=2\Rightarrow a=4\)