From examples of real sound waves it might seem that trying to use a cosine or sine function to describe a sound wave is pointless because real sound waves are very complex looking. However the French Mathematician Jean Baptiste Joseph Fourier showed any periodic function can be formed from an infinite sum of sines and cosines. This is very convenient because it means that everything we know about sines and cosines applies to a periodic function of any shape. Although the sum is infinite in theory, in many cases using just a few terms may be close enough to provide a good approximation.
Suppose you wanted to make a square wave but only had sine waves to work with. The pictures below were made with the graphing calculator we used earlier. A series of seven sine waves are plotted on the left and the sum of those waves is plotted on the right, below. Although the square wave is not perfect, the more waves that are added, the closer it becomes to a square wave. (You can try this at home; here is the sum that made the graph on the right: 1.0*sin(t)+.3333*sin(3*t)+.2*sin(5*t)+.1428*sin(7*t)+.1111*sin(9*t)+.0909*sin(11*t)+0.0769*sin(13*t). Try plotting just the first term, then the first two terms, then the first three, etc.)
Simulation exercise 9A (turn in answers on a separate sheet of paper): Fourier Synthesis Simulation.
As you can see from the simulation and the example of the square wave, any periodic shape can be formed by adding sine waves. This is the concept behind constructing an electronic instrument called a synthesizer. Electric pianos also use this principle. By combining the right frequencies and amplitudes of sine and cosine waves the synthesizer can duplicate the sound wave of any other instrument. The exact electronics that do this are somewhat complicated but the principle is simple; the right combination of sine waves can create the sound of any musical instrument. [NOTE: Modern synthesizers also often use digitally recorded samples of instruments or other sounds which are electronically modified for output, in addition to pure sine and cosine waves.]