Hello, please help me :)

A question asked that I find all relative extrema of a function f(x)= x + 1/x. I'm a bit confused with my solution, but I'll show my work first..:

I found f'(x) to get the critical numbers:
f'(x)=1-x^-2
f'(x)=(x^2 -1)/x^2
f'(x)=(x+1)(x-1)/x^2
therefore, critical numbers are x=-1,1 (and x=0 is a vertical asymptote)

so after that, I did a sign diagram using f' to figure out where the function increased/decreased: increase at (-∞,-1) and (1,∞); decrease at (-1,0) and (0,1).

From that I found that my relative max is at a point (-1,-2) and my relative min is at a point (1,2).

Here is where I got a bit confused... If I look at the whole function, my rel. min is larger than my rel. max, but if I look at it, as two different intervals it seems okay, where (-∞,0) would have a rel. max of -2 and (0,∞) would have a rel. min of 2.

Should I not look at the function as a whole? or should I just look at it as two separate open intervals?

Also, my work is okay, correct? Just making sure, I really want to ace this test! :)