Introduction to Harmonics
It was Pathagoras who discovered the fact that two similar strings under the same tension, differing only in length where the lengths of the strings are in a ratio of two integers, and when sounded together gave a pleasing effect to the listener. If one string length is twice the length of the of the other string length, then they would be considered an octave apart from one another. If the lengths of these strings are 2 to 3, then they would correspond to the interval between C and G, this is called a fifth. It turns out that these intervals are very pleasing to hear, especially when sounded together to create a chord.
Out of all the sounds you hear there is one called noise, and this type of sound corresponds to an irregular vibration of the eardrum that is produced by some type of irregular vibration. The sound of music has a different character. Music is characterized by the production of sustained tones or musical notes. A musical note differs from a noise in that there is a periodic character to its frequency spectrum. There are three aspects of musical tone: loudness, pitch, and quality of sound. The loudness corresponds to the magnitude of pressure change. The pitch corresponds to the period of time for one repetition of the basic pressure function, low notes have longer periods and high notes have relatively shorter periods. The quality of a tone has to do with the structure of the repeating pattern.
The sound produced by a vibrating string generates a wave motion. These wave will travel in both directions of the string, and will be reflected at the ends. The period if repetition is the time required for the wave to travel two full lengths of the string. The time is the same for waves that start out in either direction. The sound wave produced must also have the same repetition. This is how the string produced a musical tone.
A vibrating string has various natural modes of oscillation, and any vibration that is set up by the starting conditions can be considered a combination of several of the natural modes oscillating together. For a string the normal modes of oscillation has the frequencies ω_{0}, 2ω_{0}, 3ω_{0}, ...
The most general motion of a vibrating string is composed of the sum of sinusoidal oscillations at the fundamental frequency ω_{0}, another at the second harmonic frequency 2ω_{0}, another at the third harmonic frequency 3ω_{0}, etc... The fundamental mode repeats itsef every period T_{1} = 2π/ω_{0}. The second harmonic mode repeats itself every T_{} = 2π/ω_{0}. It also repeats itself every T_{1} = 2T_{2}, after two of its periods. The third harmonic mode repeats itself after a time T_{1} which is 3 of its periods. This is how a vibrating string repeats its whole pattern with a periodicity of T_{1}, and how a musical tone is produced.
If f(t) represents the air pressure as a function of time for a musical tone, then expect that f(t) can be written as the sum of a number of simple harmonic functions of time, like cos(ωt) for each of the harmonics. If the period of the vibration is T, the fundamental angular frequency is ω= 2π/T, and the harmonics will be 2ω, 3ω, etc...
There is one slight issue. For each frequency the starting phases will not likely be the same for all frequencies. It is probably a good idea to use functions like cos(ωt + φ), where φ represents the phase. However, it is more traditional to use both the sine and cosine functions for each frequency. Therefore:
cos(ωt + φ) = (cosφcosωt  sin&psisinωt)
and since φ is a constant, any sinusoidal oscillation at the frequency ω can be represented as the sum of a term with cosωt and another term with sinωt.
It turns out that any function f(t) that is periodic with time period T can be written as:
f(t)  a_{0}
+ a_{1}cosωt + b_{1}sinωt
+ a_{2}cosωt + b_{2}sinωt
+ a_{3}cosωt + b_{3}sinωt
+ . . . +. . .
where ω = 2π/T and the a's and b's are numerical constants which tell you how much of each component oscillation is present in the oscillation f(t). This series is called the Fourier series for f(t).
Any sound wave can be made up of such a sum.
Lets get back to the term "quality" of a musical tone. It is the relative amounts of the various harmonics, the values of the a's and b's. A tone with only the first harmonic is a pure tone. A tone with many strong harmonics is a rich tone. A violin produces a different portion of harmonics than does a trumpet.
Getting back to to the similar strings, it is true that strings with lengths in the ratio of 2 to 3 will have fundamental frequencies in the ratio of 2 to 3. So, why should they sound pleasant together? Remember,look at the properties of the frequencies of the harmonics. The second harmonic of the lower shorter string will have the same frequency as the third harmonic of the longer string.
Consider making the following rules. Notes sound consonant when they have harmonics with the same frequency. Notes sound dissonant if their upper harmonics have frequencies near to each other but far enough apart that there are rapid beats between the two. You may ask why is it that beats do not sound pleasant, and why unison of upper harmonics do sound pleasant, it is something that we do not know how to define or describe.
Here is an exercise for you to check the harmonic relationships we have been discussing. On a piano, label the 3 successive C's near the middle of the keyboard by C, C', and C'', and the G's just above by G, G', and G''. Then the fundamentals will have the following relative frequencies:
C  2 G  3
C'  4 G'  6
C''  8 G''  12
These harmonic relationships can be demonstrated in the following way: Suppose you press C' slowly so that it does not sound but you can cause the damper to be lifted. If you then sound C, it will produce its own fundamental and some second harmonic. The second harmonic will set the string of C' into vibration. If you now release C (keeping C' pressed) the damper will stop the vibration of the C strings, and you will hear the note of C' as it dies away. In a similar way, the third harmonic of C can cause a vibration of G'. Or the sixth of C can set up a vibration in the fundamental of G''.
The major scale can be defined by the following three chords: (F, A, C), (C, E, G), and (G, B, D). Each of these chords represent tone sequences with the frequency ratio of 4:5:6, these ratios plus the fact that an octave, C to C', has the ratio of 1:2 determine the whole scale for the ideal case for what is called "just intonation". It is interesting to note that keyboard instruments like the piano are not usually tuned in this manner, but a little bit of tweaking is done so that frequencies are approximately correct for all possible starting tones. For this tuning, which is called "tempered" the octave (with ratio 1:2) is divided into 12 equal intervals for which the frequency ratio is 2^{1/12}. In this case, a fifth no longer has the frequency ratio 3/2, but instead has a ratio of 2^{7/12} = 1.499, which is close enough for most ears. It is still difficult to determine whether the ear is matching harmonics or performing mathematical steps when you decide a sound is pleasing to hear.
Arnold Schoenberg (1874  1951) created a twelvetone row technique that changed keys every few notes, this creates a disturbing feel to the music. Schoenberg's technique is often used in soundtracks of horror movies. If you play C and C' on the white keys of a piano, this is a major scale which sounds pleasant. If you play A and A' on the white keys, this is a minor scale that sounds tragic. Then, play B to B', this generates a blues scale for the melancholy jazz sound. Not enough for you, then go ahead and play D to D' on the white keys, this generates a bright sound used in Spanish guitar music.
Why do different combinations of notes "feel" different, it is because of the math. Why does a flute and violin sound different when they play the same note? The answer is harmonics! Harmonics is why scales have different feels to them. Play an A (440 Hz) with full harmonics, you will not only hear the 440 Hz tone, but also the 880 Hz tone at half the volume (first harmonic), a 1320 Hz tone at a third the volume (second harmonic), a 1760 Hz tone at onequarter the volume (third harmonic), etc....until the frequency gets too high of the volume gets too low.
Play an A at 110 Hz, 220 Hz is the first harmonic, 330 Hz is the second harmonic corresponding to an E on the second octave. The third harmonic is also an A two octaves up from 440 Hz, 550 Hz is the fourth harmonic which is a C# on the third octave, the fifth harmonic is another E on the same octave. The significance of this is that A, C# and E are the notes that make up the A major chord. These notes sound natural and pleasant together, this is because they emphasize one another's harmonic pattern.
The following represent some chords of C major and c minor, and displays how harmonics emphasize one another:
C Major
Note  Fundamental  1^{st} overtone  2^{nd} overtone  3^{rd} overtone  4^{th} overtone  5^{th} overtone 
C  261.62  523.24  784.86  1046.48  1308.10  1569.72 
E  329.62  659.24  988.86  1318.48  1648.10  1977.72 
G  399.99  783.98  1175.97  1567.96  1959.95  2351.94 
C minor
Note  Fundamental  1^{st} overtone  2^{nd} overtone  3^{rd} overtone  4^{th} overtone  5^{th} overtone 
C  261.62  523.24  784.86  1046.48  1308.10  1569.72 
Eb  311.13  622.25  933.38  1244.50  1555.63  1866.75 
G  399.99  783.98  1175.97  1567.96  1959.95  2351.94 
Note, the fundamental frequency represents the 1^{st} harmonic, the 2^{nd} harmonic represents the 1^{st} overtone, etc... The missing harmonic correspondence creates a darker feel to the chord. Chords in different scales create different harmonic patterns. The more divergent they are the more disturbing they seem.
When putting chords together it is important to know how the harmonics are associated with the scales and octaves. The following represents this association:
1^{st} Harmonic  Fundamental 
2^{nd} Harmonic  Octave 
3^{rd} Harmonic  5^{th} over octave 
4^{th} Harmonic  2^{nd} octave 
5^{th} Harmonic  3^{rd} over 2^{nd} octave 
6^{th} Harmonic  5^{th} over 2^{nd} octave 
7^{th} Harmonic  minor 7^{th} over 2^{nd} octave 
8^{th} Harmonic  3^{rd} octave 
9^{th} Harmonic  whole tone over 3^{rd} octave 
10^{th} Harmonic  3^{rd} over 3^{rd} octave 
For completeness, the following describe emotional properties of the Major and minor scales.
Minor Scales
Bb minor

A "dark" key, a feeling of being all alone. Tchaikovsky's Symphony No. 4.

F minor

Passion, Beethoven's Appassionata Sonata. A highly tinted and grey feel.

C minor

Heroic struggle. Beethoven, Brahms' Symphony No. 1.

G minor

Sadness and tragedy.

D minor

Bach's The Art of Fugue. Albert Einstein associated this key with counterpoint and chromaticism.

A minor

Expressing the sad effect.

E minor

Lots of classical guitar, heavy metal. Mendelssohn used this key.

B minor

The key of passive suffering, a quiet acceptance of fate. Bach used this key a lot. Very melancholic and grieving feel. Eagle's Hotel California, Pink Floyd's Comfortably Numb. This is a common key for rock, folk, and country music.

F# minor

Has been described as "light red". Can lead to great distress and is more lovesick then lethal. Gloomy, and can be dark and evil.

C# minor

Very popular with piano. Beethoven, Scarlatti, Brahms

G# minor

Lady Gaga's Poker Face. Rarely used in orchestral music.

D# minor

not used that much.

Major Scales
Db Major

Majestic, great for the flute or other instruments that stress the fundamental.

Ab Major

Peaceful, serene feel, used by Schubert and Chopin.

Eb Major

Bold, heroic,, majestic and serious. Superior to C Major

Bb Major

Most useful for wind instruments.

F Major

Fantastic for the English horn.

C Major

Very common, simple. This is the key of strength or happiness.

G Major

Lot of guitar music.

D Major

Violin music, open string resonate sympathetically with the D string producing a brilliant sound. Lots of trumpet music.

A Major

Innocence, love, the hope of seeing one's beloved again when parting.

E Major

Music of contemplation. Bach's third partita for violin. Bells of London's Clock Tower.

B Major

Very easy to play. Chopin used this key quite a bit.

F# Major

Common for piano.

The idea that any note that has a periodic sound can be represented by a suitable combination of harmonics. It would be interesting to find out what amount of each harmonic is required. It is straight forward to compute f(t) if you are given all the coefficients "a" and "b". The more interesting question is, if you are given f(t) how do you know what the coefficients of the various harmonic terms should be? In other words, it is east to make a cake from a recipe, but can you write down the recipe if you are given a cake?
Fourier discovered that is is not very difficult to do this. The term a_{0} is easy to calculate, it is just the average value of f(t) over one period (from t = 0 to t = T). It is east to see how this is so, the average value of a sine or cosine function over one period is zero, over two, or three, or any whole number of periods, it is also zero. So, the average value of all the terms on the right hand side of the equation of f(t) is zero, except for a_{0}.
The average of a sum is the sum of the averages, so the average of f(t) is just the average of a_{0}. however, a_{0} is a constant, so its average is just the same as its value. It can get rather involved to explain the details of how to analyze a periodic wave into its harmonic components. So, for now, I will leave it at that. Just to touch on this topic a bit more, this procedure is called Fourier analysis, and the separate terms are called Fourier components. Once you find all the Fourier components and add them together, you get f(t).