$ f(\frac{x^2+1}{x^2})=x^2+\frac{1}{x^2}-2 \Rightarrow f(x)=?$ 
$ f(\frac{x^2+1}{x^2})=x^2+\frac{1}{x^2}-2 \Rightarrow f(x)=?$

I'm getting a wrong answer even though my solution looks valid to me:
Inverse of $(1+\frac{1}{x^2})$ is $(\frac{1}{{\sqrt{x-1}}})$, so I plug this expression in wherever I see $x$'s 
$$f(x)=(\frac{1}{{\sqrt{x-1}}})^2+(\sqrt{x-1})^2-2$$
Finally, I get $f(x)=\frac{(x-2)^2}{x-1}$ which is wrong according to the answer key. The answer should have been $x^2-4$
What am I doing wrong?

I think your answer is correct. I solved the problem like this:
$$f(\frac{x^2+1}{x^2})=f(1+\frac{1}{x^2})=x^2+\frac{1}{x^2}-2$$
Now $f(1+\frac{1}{x^2})$ can be written as a function of just $\frac{1}{x^2}$ so,
$$f(1+\frac{1}{x^2})=g(\frac{1}{x^2})=x^2+\frac{1}{x^2}-2$$
Put $t=\frac{1}{x^2}$, to get:
$$f(1+t)=g(t)$$
$$g(t)=t+\frac{1}{t}-2$$
Or, $$g(x)=x+\frac{1}{x}-2$$
Now, $g(x)=f(1+x)$
Put, $1+x=\alpha$ to get,
$$f(\alpha)=g(\alpha-1)=\alpha -1 + \frac{1}{\alpha-1} -2$$
$$f(x)=x - 1 + \frac{1}{x-1} -2$$
$$f(x)=\frac{(x-2)^2}{x-1}$$ where $x\neq 0$,$x\neq1$
Hope this helps...
