Wave Interference (with sound!)

Developed by Christopher Orban - Published June 7, 2017

DOI: 10.1119/PICUP.Exercise.WaveInterference

This exercise illustrates wave interference in 2D by adding two sine-waves together. The result looks very much like the interference pattern that can be created with ripples in a pond. This exercise will use a programming language called [p5.js](http://p5js.org) that is very similar to C and C++ programming. (Note: If you are familiar with C or C++ the main difference you will see is that there is no main() function and instead the draw() function serves this role.) **Importantly, this exercise can be completed using any computer or chromebook without downloading any software!** This exercise is designed for an algebra-based physics class at the college or high school level. It may also be useful for calculus-based physics for non-majors (e.g. engineering & science majors). However, it does use a taylor expansion, so perhaps it is more of an introductory calculus based exercise This exercise is part of a series of exercises developed by Prof. Chris Orban. There are pre-and-post assessment questions associated with this exercise (not available here) that are being used in an educational research study. If interested to collaborate on that study please e-mail Prof. Chris Orban (orban@physics.osu.edu). The first paper from this study [is available at this link](https://arxiv.org/abs/1701.01867), the second paper which discusses the electromagnetism exercises [is available at this link](https://arxiv.org/abs/1707.00185)
Subject Area Waves & Optics
Level First Year
Available Implementation Javascript
Learning Objectives
1. Students will see how two sine waves can interfere to produce constructive and destructive interference 2. Students will take the equation for the path difference between two sources of waves and do a taylor expansion to obtain the lines of destructive interference. 3. Students will modify the code to plot these lines of destructive interference. By comparing these lines to the interference pattern the approximate nature of the taylor expansion will be illustrated
Time to Complete 60 min

These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).

This programming lab is designed to illustrate the idea of wave interference. This happens because of the principle of "superposition". For sound waves, this 20 dollar word just means that if there are two speakers in a large room or open space, the amplitude of the sound waves at a particular point in that room are the sum of the waves of the two speakers. ![](images/WaveInterference/interference0103.png "")

Step 1. Open up the code in an editor

Make sure to set your speaker volume low before you press play!!! Click here to open up the code in an editor Press the play button (red triangle) in the top left to run the code. If for some reason you can't open it up in the editor you can also try out the interactive at this link Here is a version without the red line that runs faster (useful for chromebooks)

Step 2. Explore the Interference

Step 2a. Move the little microphone to find the constructive and destructive interference

Move the little microphone around and listen to the amplitude of the tone. When you put the little microphone in a place where there is destructive interference there should be almost no sound. When you put it at a point of constructive interference, the tone should be much louder.

Step 2b. Move the speakers around

Move the speakers around by clicking and dragging the speakers to a new location on the x axis. How does it change the interference pattern?

Step 3. Look at this diagram:

![](images/WaveInterference/SoundLab_diagram_fixed.png "") Later, in Step 5 you will need to write down $r_1$ and $r_2$ as a function of $d$, $x$, and $y$.

Step 4. Think about the math involved

If there was just Speaker #1 the instantaneous amplitude $S_1$ at (x,y) would be this: $$S_1 = A_1 \sin (k_1 r_1 - \omega_1 t)$$ where $r_1$ is the distance between speaker #1 and the point (x,y). Likewise, the instantaneous amplitude at (x,y) from only speaker #2 would be this: $$S_2 = A_2 \sin (k_2 r_2 - \omega_2 t)$$ where $r_2$ is the distance between speaker #2 and the point (x,y). If you have both speakers then the amplitude at a particular point in the room would be this: $$S_1 + S_2 = A_1 \sin (k_1 r_1 - \omega_1 t) + A_2 \sin (k_2 r_2 - \omega_2 t)$$ The following trig identity is very useful: $$\sin a + \sin b = 2 \cos \left(\frac{a-b}{2} \right) \sin \left( \frac{a+b}{2} \right)$$ Assume $A_1= A_2 = A$, $\omega_1 = \omega_2 = \omega$, $k_1 = k_2 = k$, and use this expression to prove that the following is true: $$S_1 + S_2 = 2 A \cos \left(\frac{k (r_1-r_2)}{2} \right) \sin \left(\frac{k (r_1+ r_2) - 2\omega t }{2}\right)$$ and constructive/destructive interference depends on whether the cosine term works out to be equal to zero or one.

Step 5. Look at the diagram again and figure out r1 and r2

**Look at the diagram from Step 3 again. How would you write $r_1$ and $r_2$ in terms of x, y and d?**

Step 6. Consider Destructive Interference

Use the previous equation to explain why the following is the correct equation for destructive interference: $$|r_1 - r_2| = \frac{n\lambda}{2}$$ Why is destructive interference only achieved if $n = 1, 3, 5 , 7...$?

Step 7. Approximate!

The previous expression turns out to be difficult to work with: $$|r_1 - r_2| = \frac{n\lambda}{2}$$ $$\sqrt{(x+d)^2 + y^2} - \sqrt{(x-d)^2 + y^2} = \frac{n\lambda}{2}$$ We'd really like to be able to solve for y, but there's no simple way of doing this. If you try to square both sides, for example, this doesn't help much to isolate y and x. When you're stuck like this, sometimes the best you can do is approximate. Notice the following trick if $|b/a| \ll 1$, $$\sqrt{a +b } = a \sqrt{1 + \frac{b}{a} } \approx a \left( 1 + \frac{1}{2} \frac{b}{a} \right)$$ Use this trick to prove that the lines of destructive interference follow this formula: $$ y = \pm \frac{4 d}{n \lambda} x $$

Step 8. Plot up the lines of destructive interference!

Modify the code to plot up the lines in the programming activity. Show that the lines for $n = 1$ match up well with the interference fringes. The result should look like this: ![](images/WaveInterference/interference0114.png "")

Step 9. Move the speakers around!

Move the speakers around by clicking and dragging the speakers to a new location on the x axis. **Bring the speakers closer and further apart. Do your lines still match up with the interference pattern?**

Step 9. (Extra Credit:) Consider n = 3, 5, 7...

Plot the lines of destructive interference for n = 3, 5, 7... and compare to the simulated wave pattern. These lines will not compare as well to the simulation as it does for n = 1. Why does n > 1 compare less well to the lines of destructive interference in the simulation? Do you have any ideas for improving the locations of the lines? How could we make the approximation better?

How to get full credit on this programming lab

**1. Describe in words what happens when you change the separation between the speakers (Step 2b)** Click and drag the speakers closer and further apart. Describe with words what happens to the interference pattern. **2. Use the trig identify to produce the interference formula (Step 4)** Assume $A_1= A_2$, $\omega_1 = \omega_2$ and derive the equation below for the addition of two sine waves $$S_1 + S_2 = 2 A_1 \cos \left(\frac{k (r_1-r_2)}{2} \right) \sin \left(\frac{k (r_1+ r_2) - 2\omega_2 t }{2}\right)$$ **2. Write r1 and r2 in terms of x, y and d (Step 5)** This is the primary task of Step 5. **3. Explain why destructive interference only occurs for n = 1,3,5,7... (Step 6)** This is the primary task of step 6. Why would $n = 2,4,6...$ not give destructive interference? **4. Derive $y = \pm \frac{4d }{ n \lambda }x$ from approximating the equation for destructive interference (Step 7)** This will take a couple of steps. Write these steps out on a sheet of paper, take a picture with your phone, and submit it to the assignment dropbox on canvas. **5. Submit your code with the plotted lines (Step 8)** Modify your code until it looks like the video shown in Step 8. **(Optional) 6. Comment on n = 3, 5, 7...** For extra credit, modify your program to show the lines of destructive interference for n = 3, 5, 7... Explain why these lines don't compare very well to the destructive interference in the wave pattern whereas the n = 1 result does. Comment on how you would perhaps improve upon the solution $y = \pm \frac{4d}{n\lambda}x$. To be clear, there is more than one way that this solution could be improved upon.

Download Options

Share a Variation

Did you have to edit this material to fit your needs? Share your changes by Creating a Variation

Credits and Licensing

Christopher Orban, "Wave Interference (with sound!)," Published in the PICUP Collection, June 2017, https://doi.org/10.1119/PICUP.Exercise.WaveInterference.

DOI: 10.1119/PICUP.Exercise.WaveInterference

The instructor materials are ©2017 Christopher Orban.

The exercises are released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license