Step 1: Differentiate \( f(x) \).
The given function is: \[ f(x) = x + \frac{1}{x}. \] Differentiate \( f(x) \) to find critical points: \[ f'(x) = 1 - \frac{1}{x^2}. \]
Step 2: Solve \( f'(x) = 0 \).
Set \( f'(x) = 0 \): \[ 1 - \frac{1}{x^2} = 0 \quad \Rightarrow \quad \frac{1}{x^2} = 1 \quad \Rightarrow \quad x^2 = 1. \] Thus, \( x = 1 \) and \( x = -1 \).
Step 3: Determine the nature of critical points.
Differentiate \( f'(x) \) to find \( f''(x) \): \[ f''(x) = \frac{2}{x^3}. \] - At \( x = 1 \): \[ f''(1) = \frac{2}{1^3} = 2 \quad (\text{positive, so } x = 1 \text{ is a local minimum}). \] - At \( x = -1 \): \[ f''(-1) = \frac{2}{(-1)^3} = -2 \quad (\text{negative, so } x = -1 \text{ is a local maximum}). \]
Step 4: Compute \( M \) and \( m \).
- At \( x = 1 \): \[ f(1) = 1 + \frac{1}{1} = 2 \quad (\text{local minimum } m). \] - At \( x = -1 \): \[ f(-1) = -1 + \frac{1}{-1} = -2 \quad (\text{local maximum } M). \]
Step 5: Compute \( M - m \).
\[ M - m = -2 - 2 = -4. \]
Conclusion:
The value of \( M - m \) is: \[ \boxed{-4}. \]