For each x∈X, define the distance functions:
[
\delta_A(x) := d(x, A) = \inf { d(x, a) \mid a \in A }, \quad \delta_B(x) := d(x, B) = \inf { d(x, b) \mid b \in B }.
]
Each distance function is continuous (in fact, Lipschitz continuous with constant 1): for all x,y∈X,
[
|\delta_A(x) - \delta_A(y)| \leq d(x, y), \quad |\delta_B(x) - \delta_B(y)| \leq d(x, y).
]
Thus, the function f:X→R given by
[
f(x) := \delta_A(x) - \delta_B(x)
]
is continuous (as a difference of continuous functions).
Now define the open sets
[
U := { x \in X \mid f(x) < 0 } = { x \in X \mid \delta_A(x) < \delta_B(x) }, \quad V := { x \in X \mid f(x) > 0 } = { x \in X \mid \delta_B(x) < \delta_A(x) }.
]
Since f is continuous, both U and V are open in X. Moreover, U∩V=∅ (as f(x) cannot be both <0 and >0).
Therefore, U and V are disjoint open sets separating the disjoint closed sets A and B. Hence, (X,d) is normal.