The Problem
Chris wants to design a bean bag toss game and proposes the following schematic. How would Chris figure out the probability of a bean bag going through one of the green openings if it is thrown randomly at the board?
This is the type of application problem typical of a high school geometry class. Traditionally, such a problem occurs at the end of a unit on geometric measurement after students have been told and have practiced key formulas for triangles, circles, trapezoids, etc. But how can computer science (CS) serve as a vehicle to make such a problem (and generally, probability) more student-centered and dynamic? Equipped with CS, let’s explore what I did in my class to enliven this topic.
A quick program allowed students to interact with a simulation to collect meaningful data to connect to a theoretical approach. Moreover, such a program embeds the concept of a limit that many students will see later in Calculus. In fact, a few students were interested in looking at the code behind the scenes, one noticing that codes on lines 28 to 31 are related to the Distance Formula, checking if a given point is within a certain threshold distance. The first two variables determine if a selected point (x, y) is within the interior of one of the two circles. The second two determine if the selected point (x, y) is within the triangle or rectangle.
I wanted students to be able to modify the shapes on the target to effect the probability but few students had a background in JavaScript to make shapes and check if points were interior to them. Enter Scratch!
Students were asked to compare the experimental probability estimates to the theoretical, which can be computed knowing the amount of pixels for the screen and the circle. By clicking “stage” in the bottom left and then “backdrops”, students can access the blue circle. The window dimensions are 480 pixels wide by 360 pixels tall while the circle is approximately 156 pixels in diameter. The theoretical probability of landing in the blue circle is then
very close to our experimental estimate!
To conclude, students were asked to make their own backdrop design (either using the same color blue or changing the code to be of their new color) so that the probability is closest to 30% as possible. Students can select the color that they wish to touch by clicking on the color in the code then selecting the color from their backdrop using the eyedropper tool. Students could not only test their design experimentally using the provided code, but were also encouraged to compare this to the theoretical probability depending on their design. An example of a student design is shown below. Students used strategic thinking and refinement to get as close to 30% as they could while personalizing their design.
Summary
In closing, it is my hope that these examples have enlivened your interest in the intersection of math and CS. Not only does CS provide students to gain access to running simulations that would otherwise take lots of time to do physically – it provides a space for students to conjecture, experiment, and reason. Give this activity a shot or tweak it to fit your students’ interests and needs.
Guest Blogger: Chris Bolognese (@eulersnephew)