the answer is supposed to be 4 but i do not know how they got it.

Solve for x.
[x-(1/x)]/[1+(1/x)]=3

3 [1+(1/x)] = x-(1/x)

3 = x - 4/x
3x = x^2 -4
x^2 -3x -4 = 0
(x-4)(x+1) = 0
x = 4 or -1
The -1 solution is not allowed because it causes a zero denominator in the original equation.