The function of a ball and socket joint is to provide a high level of mobility for the joint. The two major joints of this type in the human body are the shoulder and hip joints. However, the shoulder joint has a higher degree of flexibility than the hip joint.
All joints consist of two bones (and other supporting materials). In a ball and socket joint, one bone has a roughly hemispherical cavity, while the inserting bone has a curved surface on the top. The curved surface goes snugly into the cavity, and can then freely rotate in a fairly large range of motion.