To ensure that f(x) is continuous at x = 2, the left-hand limit (LHL), right-hand limit (RHL), and the value of the function at x = 2 must be equal.
1. Left-hand limit (LHL):
For x < 2, \[ f(x) = \frac{x - 2}{|x - 2|} + a \] Since \( x - 2 < 0 \), we have \( |x - 2| = -(x - 2) \). Thus, \[ f(x) = \frac{x - 2}{-(x - 2)} + a = -1 + a \] Hence, \[ \text{LHL} = -1 + a \]
2. Right-hand limit (RHL):
For x > 2, \[ f(x) = \frac{x - 2}{|x - 2|} + b \] Since \( x - 2 > 0 \), we have \( |x - 2| = x - 2 \). Thus, \[ f(x) = \frac{x - 2}{x - 2} + b = 1 + b \] Hence, \[ \text{RHL} = 1 + b \]
3. Value at \( x = 2 \):
\[ f(2) = a + b \]
4. Continuity condition:
For continuity, \[ \text{LHL} = \text{RHL} = f(2) \] Substituting the values: \[ -1 + a = 1 + b = a + b \]
From \( -1 + a = a + b \), we get: \[ b = -1 \]
From \( 1 + b = a + b \), we get: \[ a = 1 \]
Final Answer:
\[ \boxed{a = 1,\; b = -1} \]