## A Study in Randomness

by Professor Rich Born

### Introduction

This lab, featuring Voyager and intelino, designed for junior high math students, will help your students understand the true nature of randomness. By the time youngsters enter junior high school, they have encountered randomness in a variety of situations. They have likely seen random ping-pong balls drawn in lotteries. They have seen coin tosses before the start of football games. They may have been asked to draw a random card in a card trick. Perhaps they or their parents have purchased tickets for a raffle. The list could go on-and-on.

Interfacing PocketLab Voyager and the "intelino smart train" provides a means by which students can gain a better understanding of the concept of randomness. Designed for all ages, intelino is intuitive with its app, has built-in sensors to provide an interactive experience for the user, and is easily programmed with color snaps that allow the user to control intelino's actions. One of the tracks that comes with the intelino train is a switch track, which by default, causes the engine to randomly go straight through or make a turn. With Voyager mounted to the top of the intelino engine and magnets placed alongside the track, Voyager's magnetometer can be used to sense whether the train has gone straight through or made a turn. Figure 1 shows the basic setup.

Figure 1 - Basic setup for the probability and statistics lab

The track layout consists of six straight tracks and one switch track. The switch track has a built in color snap command (G) that tells intelino to randomly go straight or turn. The intelino engine, with Voyager attached by a 3M damage-free hanger, starts at the position shown and moving to the right at the intelino speed "fast" (60 cm/sec). Choosing the speed fast permits quick data collection, allowing students plenty of time for data analysis. If the engine goes straight through the switch track, the color snap command (white/blue) tells the train to reverse itself. An identical action occurs at E if the engine turns instead of going straight. When the engine gets back to its starting location, the color snap command at B reverses the engine. This process repeats itself over and over again.

You might be wondering what the purpose is for the reverse color snap commands at A, D, and F. In a very small fraction of the cycles, the intelino engine color sensors on the bottom of the engine may not correctly read the reverse commands at B, C, and E. It is the job of the reverse commands at A, D, and F to act as "co-pilots" to catch a missed reverse command at B, C, or F.

The intelino app runs on one device, while the PocketLab app runs on another device. The x-magnetic field is measured by Voyager's rangefinder and zeroed when the rangefinder is at the starting position. The magnets are placed at positions and adjusted until one of the magnets (either the blue or yellow one) shows positive "peaks" on Voyager's real-time graph while the other magnet shows "negative" peaks. If students record data for about 6 minutes, they will have at least 100 "peaks" -- plenty for a comprehensive data analysis. Placement of the magnets midway between the reverse command and the co-pilot works very well.

### Video

The 17-second video below is an action shot of a portion of the data collection phase of this lab. In particular, notice the "peaks" produced when Voyager/intelino reach each of the magnets. The straight random choice shows negative peaks while the turn random choice shows positive peaks. This makes the data for the entire run easy (and fun!) to analyze.

### Data Analysis

Figure 2 contains an Excel chart of Voyager's magnetic field vs. time for a typical run of the experiment. This chart is a great visual that summarizes all events in the run. In this run, turns (T) are represented by positive peaks, and straights (S) are represented by negative peaks. We see that the experiment began with the intelino engine turning four times in a row, followed by one straight, followed by one turn, followed by two straights, and so on. If we represent a turn by the letter T and a straight by the letter S, we have the sequence of moves: TTTTSTSS... etc. Any unbroken sequence of like letters is referred to as a run. This is true even if the sequence has only one letter. In the sequence TTTTSTSS there are four runs: TTTT, S, T, and SS. The length of each of these runs (i.e., the number of letters in the run) is 4, 1, 1, and 2, respectively. The run lengths for the entire experiment are shown in red in Figure 2.

Figure 2 - Graph of x-magnetic field vs. time

### Student Activities

Comments for possible student/teacher discussion are shown in square brackets [ ] for each activity.

### Activity #1

Have the students count up the total number of times the engine turned right, and the number of times that it went straight. [Although these numbers are generally not equal, they are probably reasonably close to the same, as the meaning of "random" for a switch track is intended to mean that the odds are 50-50 in the long run. You might point out to the class that flipping a coin is essentially the same, with a 50-50 chance of the coin landing heads.]

### Activity #2

Ask the students to determine the total number of runs in the first 100 cycles in their graphs. Also, they should determine the longest run of straights and the longest run of turns. [Students are often surprised to see that the longest run has a length of about 5 or 6. If the students are asked to write down their predicted sequence of S's and T's before they do the experiment, for most of them: (1) the length of the longest run would be shorter than that from the experiment, and (1) the total number of runs would be greater than from the experiment.]

### Activity #3

As a more challenging activity, as the students to determine from their graphs the number of cycles for which the "co-pilot" reverse color action snap commands actually played a part. [In the graph of Figure 2, at about 180 seconds, you will notice a "doublet" in which there are two peaks very close together. This occurred on a turn in which the color snap at position E was missed by the intelino color sensors, but was captured by the reverse command at position F. The time between these two peaks was very short, as evidence by the tight doublet of peaks. It should be noted that in several experiment runs by the author, the number of co-pilot actions varied from 1 to 4. So the odds for this happening are less than 5%.]

### Activity #4

Show your students the track layout shown in Figure 3. As you can see, an additional random switch track has been introduced. Then ask them to predict the number of times that intelino/Voyager will reach locations X, Y, and Z in 100 cycles. Finally, the students should perform an actual experiment with this layout to check their predictions. [Location X is a stack of four magnets. This will make its peaks on the magnetic field graph stronger than those at location Y, thus allowing distinguishing X and Y peaks on Voyager's graph. Approximately 25% will go to X, 25% to Y, and 50% to Z.]

Figure 3 - Track layout for activity 4