C3. Solve problems and create computational representations of mathematical situations using coding concepts and skills.

Learning Context: The Probability Machine


Duration: 125 minutes

Summary

In this learning situation, the student creates a machine to randomly roll a die and then show that the greater the number of trials in the experiment, the closer the experimental probability is to its theoretical probability.

Expectations Specific Expectations
C3. Algebra
Solve problems and create computational representations of mathematical situations using coding concepts and skills.
C3.1 Solve problems and create representations of mathematical situations computationally by writing and executing code, including code that includes conditional statements and other control structures.

C3.2 Read and modify given codes, including codes with conditional statements and other control structures, and describe the impact of these changes on the results.

D2. Data
Describe the likelihood that events will happen, and use that information to make predictions.
D2.2 Determine and compare theoretical and experimental probabilities of an event occurring.

Preferred High-Impact Mathematics Instructional Practices Description
Learning Goals, Success Criteria and Descriptive Feedback Post the assessment criteria in the classroom for students to reference as they work. Throughout the lesson, take time to circulate among the students and observe what they are doing. Take the opportunity to ask students about their work and give them descriptive feedback on the posted assessment criteria.
Mathematical Conversations In the learning situation, students discuss the possible probabilities of rolling a die. As they explore the possible outcomes, they listen to the different opinions and explain their reasoning to their peers. Take time to circulate among the students and ask them about what they notice, what they know or what they would like to know.
Flexible Groupings Students work in groups to foster collaboration. Small group experiments make students feel safe and often motivate them to take risks. They can work in small groups to create their own probability machine that will make the 1,000 rolls required easier and more accurate.

Prior Knowledge and Skills

To be able to complete this learning context, the student must:

  • have an understanding of experimental probability and theoretical probability;
  • be able to organize data in a relative frequency table (fractions);
  • be able to use block coding program;
  • know the multiples of numbers.

At the end of this learning task, the student will be able to:

  • write and execute the code for a randomized die roll in a block coding program;
  • integrate one or more conditional instructions in its code;
  • compare theoretical and experimental probabilities of an event.

Success Criteria based on the Achievement Chart Categories

Skills Success Criteria
Knowledge and Understanding

  • The student understands what conditional statements are and when to use them.
  • The student understands the difference between theoretical and experimental probability.
  • The student can identify the actions in a block of code for repeating and nested events.
  • The student uses a block coding program to represent a random outcome.

Thinking

  • The student writes pseudocode illustrating planned out steps.
  • The student compares the theoretical and experimental probabilities of obtaining an even number.
  • The student alters/debugs code to fix errors.

Communications

  • The student explains what blocks of code will do when it is executed.
  • The student uses vocabulary related to coding (conditional instructions, variables) and probability (impossible, unlikely, equiprobable, very likely, certain).

Application

  • The student writes code to count the number of random throws of a die.
  • The student writes code to count the amount of even numbers drawn at random.

Material
  • block coding program
  • dice numbered from 1 to 6
  • appendix A (table in which to compile experimental results)
  • pencil
Note: The examples in this learning context were designed with Scratch.

Mathematical Vocabulary

Experimental probability, theoretical probability, repeating events, nested events, conditional instruction, control structure.

Situation

Duration: 10 minutes

Assessment can be carried out through…

As a class, show the picture of the dice. Ask students to come up with questions to ask themselves about this image.

Sample questions:

  • How many dots are there in total?
  • How many times do we see the number 6?
  • What is the probability of getting a 3?

Divide students into small groups and give each group a die numbered 1-6. Ask them to find the theoretical probability of getting an even number. If necessary, review the probability line and associated terminology.

Sample reflections:

  • There are three even numbers, 2, 4 and 6. There are six possible outcomes when we roll a die. The probability of having an even number is therefore \(\frac{3}{6}\).
  • The fraction can be simplified to half, which means half of the time an even number is rolled. The probability line shows that it is equally probable to get an even or an odd number.

Possible Observations Possible Interventions
The student does not know where to start. What should you do first?

What are all the possible outcomes of a roll of the die?

What are the even numbers on the die?

What is a probability?

The student has difficulty expressing probability as a fraction. What does the numerator represent in probability?

What does the denominator represent in probability?

How many sides does the die have in total?

Is this total the numerator or the denominator?

The student has difficulty expressing the probability of getting an even number as a fraction. What does the fraction \(\frac{3}{3}\) represent?

(an integer, \(\frac{1}{1}\) or 100%)

Is it true that every roll of the die will result in an even number?

Ask students to find the theoretical probability of getting a multiple of 3 and then the probability of getting the number 4. Students should then place the probabilities on the probability line, as in the first example.

Sample reflections:

  • There are two multiples of 3 on a six-sided die (3 and 6), and six possible outcomes, so the probability of getting a multiple of 3 is \(\frac{2}{6}\).
  • The fraction \(\frac{2}{6}\) is equivalent to \(\frac{1}{3}\).

Or

  • I know that \(\frac{1}{3}\) is between \(\frac{1}{4}\) and \(\frac{1}{2}\).
  • There is only one number 4 on a six-sided die, and six possible outcomes, so the probability of getting a 4 is \(\frac{1}{6}\).

Have students roll the die 20 times and complete a relative frequency table like this one.

Event Counting Frequency Relative Frequency Expressed as a Fraction
I get an even number.
I get a multiple of 3.
I get a 4.

Ask students what they notice about the results.

Do the results represent the theoretical probability? Why? (Write down students' answers to this question for future reference.)

Discuss the results and compare them with the probabilities found earlier. Encourage students to question the effect of the number of throws on the outcome.

Action

Approximate duration: 100 minutes

Assessment can be carried out through…

Ask students to determine the experimental probability of getting an even number by rolling a die 1,000 times.

Sample reflections:

  • 1,000 rolls is a lot, and it will take a long time.
  • A roll of the dice lasts about 5 seconds, so 1,000 rolls is approximately 5000 seconds (5000 seconds is about 83 minutes.)
  • With so many throws, one could make more mistakes, for example forgetting to put a result in the frequency table or losing count of the number of throws.

Question students as to whether there is a more efficient way to determine the results of 1,000 throws looking for the response about using code to simulate the experiment.

First ask students for ideas on how the number of times an even number is rolled on a six-sided die can be tracked for up to 1,000 rolls. This will then become the basis for the pseudocode.

Example of pseudocode:

Repeat 1,000 times.

Generate a random number from 1 to 6.

Add the number to the list "The list of throws".

If the number = 2 or the number = 4 or the number = 6.

Add 1 to the counter "Even numbers".

The code consists of three parts:

  • A block of code to simulate a roll of a six-sided die and compile the results.
  • A block of code with a conditional event to determine whether the result of the roll is even or not.
  • A block of code that will compile the total number of rolls resulting in an even number.

Here is an example of code that determines the number of times an even number is obtained after 1,000 throws of the die, based on the above pseudocode.

Here is the result generated by this code. The students' code could be different yet have the same outcome.

Possible Observations Possible Interventions
The student fails to compile the results of the die roll.

Ask the student to find the number of sides of the die that was given to them.

  • Which block allows you to represent the die with its six faces?
  • How many rolls are needed to be made?
  • Which block of code accounts fo these multiple rolls?

The student forgets to reset his variables and lists.

Ask the student to read the code aloud to see if there are any missing instructions.

Ask the student to explain the three blocks identified.

Ask the student what happens when the variables are not reset.

What is the impact on test results?

Student does not use operator blocks correctly.

Ask the student how the code can be adjusted to do more of what is wanted (use the "or" block). Have the student understand that the code is read one command at a time. The use of the "or" operator command is useful for setting conditions, such as 2 or 4 or 6 for even numbers.

The student repeats 1,000 times in their even number code rather than repeating the length of the list. Ask the student where the results of the dice rolls are compiled (the results of the dice rolls should be compiled in "The Rolling List").

In which list should you find the even numbers?

What variable do you need to add to search for even numbers? (I need to add the "length of the roll list", so that the entire roll list will be repeated)

Student does not use variables appropriately. Ask the student what the variables mean. He or she must know the meaning of the variables used in order to fully understand the code.

Note: In the examples provided, the notes in yellow are explanations of how the code works and should be omitted when the code is presented to students.

Consolidation

Duration: 15 minutes

The evaluation can be carried out through…

Follow Up Questions

  • What are the findings?
  • Do the results of the experimental probability at 20 throws differ from the results of the experimental probability at 1,000 throws?
  • What do you notice between the theoretical and experimental probability?
  • In your code, which blocks represent conditional statements?
  • Could you use your randomizer or a similar machine in other probability situations? Which ones? Why or why not?

Extension

  • Suggest that students alter their code to compare the experimental probabilities of obtaining a multiple of 3 or the number 4 with their theoretical probabilities.
  • Suggest that students code to compare the theoretical and experimental probability of drawing a red marble from a bag of 10 marbles knowing that 3 marbles are red (we discuss conditional if/then/otherwise statements in this example).

Links with Other Mathematical Strands

Number

B1.4 Compare and order fractions from halves to twelfths, including improper fractions and fractional numbers, in various contexts.

B1.5 Read, represent, compare, and order decimal numbers to hundredths in a variety of contexts. Conditional statements (if/then/if not) are used to make comparisons between numbers by using them in combination with the "operator" blocks (>, <, =).

Data

D2.1 Use fractions to express the probability of events happening, represent this probability on a probability line, and use it to make predictions and informed decisions.

D2.2 Determine and compare theoretical and experimental probabilities of an event occurring. Conditional statements are used to code in experimental situations with probabilities. The if/then/not terminology is useful in determining certain events in a random experiment.

Financial Literacy

F1.2 Estimate and calculate the cost of transactions involving multiple items priced in dollars and cents, including sales tax, using various strategies.

By using conditional statements (if/then/if not), it is possible to create rules to follow for rounding (e.g., IF the number in the hundredths position is 1 or 2, THEN change the value to 0. IF the number at the hundredths position is 3 or 4, THEN change the value to 5, etc.).

Differentiated Instruction and Universal Design for Learning

  • Give students the disconnected blocks so they can replace them and make a code.
  • Give the students the variables before starting the code.
  • Suggest a beginning of the code for the student to complete.
  • Create some blocks for the student, such as the "multiple of 3" block and the "even number" block.