Music notes that sound good together often have a mathematical connection. These musical relationships are based on ratios and intervals, which are the numerical relationships between notes. For example, a perfect fifth is derived from a 3:2 ratio between two notes. When two notes have an exact ratio like this, they tend to sound good together. However, some notes don't have an exact ratio with each other, and this is why they don't sound good together. Additionally, some notes are harmonically dissonant, meaning they don't naturally fit together in a chord. Although these notes may not sound good together, they can still be used in interesting ways to create tension, drama, and emotion in a musical composition.