The paper offers a solution to the centuries-old puzzle - why the major chords are perceived as happy and the minor chords as sad - based on the information theory of emotions. A theory and a formula of musical emotions were created. They define the sign and the amplitude of the utilitarian emotional coloration of separate major and minor chords through relative pitches of constituent sounds