You are given:
(1). n|m
(2). a ≡ b (mod m)
From (1), there exists some integer x such that m = xn.
From (2), there exists some integer y such that (a-b) = ym.
Therefore, (a-b) = yxn, and so:
There exists an integer z (equal to yx) such that (a-b) = zn.
Therefore, a ≡ b (mod n).
(1). n|m
(2). a ≡ b (mod m)
From (1), there exists some integer x such that m = xn.
From (2), there exists some integer y such that (a-b) = ym.
Therefore, (a-b) = yxn, and so:
There exists an integer z (equal to yx) such that (a-b) = zn.
Therefore, a ≡ b (mod n).