Example 21 Solve cos x = 1/2 .