The first one is straightforward. If , then x is in an open ball S contained in A or one contained in B; in either case, and so .
For the second part, proving is equally straightforward. x is in an open ball S contained in and and .
For the reverse inclusion, let .
such that . Similarly . such that .
Now take .
Then proving that .
For the example, take the closed intervals and in . Then but and .