This video thoroughly describes 3 different ways to tune your guitar by ear while elaborating on the pitfalls and intricacies of each tuning method. This link explains the interaction between two waves more accurately which is a subject I mention briefly in the video. This link has a chart to convert between midi, note name, frequency, and period which will help you understand the relationship between octaves and the distances between half steps.