Ta có: \(S=\left(\frac{\sqrt{x}+1}{x-4}-\frac{\sqrt{x}-1}{x+4\sqrt{x}+4}\right)\cdot\frac{x\sqrt{x}+2x-4\sqrt{x}-8}{\sqrt{x}}\)
\(=\left(\frac{\left(\sqrt{x}+1\right)\left(\sqrt{x}-2\right)}{\left(\sqrt{x}-2\right)^2\cdot\left(\sqrt{x}+2\right)}-\frac{\left(\sqrt{x}-1\right)\left(\sqrt{x}+2\right)}{\left(\sqrt{x}-2\right)^2\cdot\left(\sqrt{x}+2\right)}\right)\cdot\frac{x\left(\sqrt{x}+2\right)-4\left(\sqrt{x}+2\right)}{\sqrt{x}}\)
\(=\left(\frac{x-\sqrt{x}-2-\left(x+\sqrt{x}-2\right)}{\left(\sqrt{x}-2\right)^2\cdot\left(\sqrt{x}+2\right)}\right)\cdot\frac{\left(\sqrt{x}+2\right)\cdot\left(x-4\right)}{\sqrt{x}}\)
\(=\frac{x-\sqrt{x}-2-x-\sqrt{x}+2}{\left(\sqrt{x}-2\right)^2\cdot\left(\sqrt{x}+2\right)}\cdot\frac{\left(\sqrt{x}+2\right)^2\cdot\left(\sqrt{x}-2\right)}{\sqrt{x}}\)
\(=\frac{-2\sqrt{x}\cdot\left(\sqrt{x}+2\right)}{\left(\sqrt{x}-2\right)\cdot\sqrt{x}}\)
\(=\frac{-2\left(\sqrt{x}+2\right)}{\sqrt{x}-2}\)
\(=\frac{-2\sqrt{x}-4}{\sqrt{x}-2}\)