The equation I'm trying to differentiate is, $ f(x) = \sqrt\frac{x^2-1}{x^2+1}$ and I know the answer is meant to be
$$=\frac{\frac{x\sqrt {x^2+1}}{\sqrt {x^2-1}}-\frac{x\sqrt {x^2-1}}{\sqrt {x^2+1}}}{x^2+1}$$
But when I do the working out I get this
$$=\frac{(x^2-1)^\frac{1}{2}}{(x^2+1)^\frac{1}{2}}$$
$$=\frac{\frac{1}{2}(x^2-1)^\frac{-1}{2}\cdot2x\cdot(x^2+1)^\frac{1}{2}-(x^2-1)^\frac{1}{2}\cdot\frac{1}{2}(x^2+1)^\frac{-1}{2}\cdot2x}{x^2+1}$$
simplify $$=\frac{x(x^2-1)^\frac{-1}{2}\cdot(x^2+1)^\frac{1}{2}-(x^2-1)^\frac{1}{2}\cdot x(x^2+1)^\frac{-1}{2}}{x^2+1}$$
$$=\frac{\frac{\sqrt {x^2+1}}{x\sqrt {x^2-1}}-\frac{\sqrt {x^2-1}}{x\sqrt {x^2+1}}}{x^2+1}$$
As you can see two of my $x$'s are in the wrong location, and I just can't figure out what I'm doing wrong. Any help as to what steps I'm doing wrong or missing would be much appreciated.