Download presentation
Presentation is loading. Please wait.
Published byJoshua Pope Modified over 8 years ago
1
Origins of Probability Theory and The Fundamental Counting Principle
2
A gambler's paradox During the Renaissance in 17 th Century France, games of chance, played with cards and dice, were a popular and fashionable habit, and often involved wagering large sums of money. Chevalier de Mere A flamboyant professional gambler, known as the Chevalier de Mere, experienced a seemingly paradoxical streak of ruinous bad luck with a pair of dice games
3
Equally favorable odds? Game 1: If you roll a single die four times, I'll bet that you will get a “six” Game 2: If you roll a pair of dice 24 times, I'll bet that you will get a “double-six” ______________________________________ The Chevalier expected that wagers in either of these games would be equally in his favor, but his careful record-keeping showed him that over the long term he lost money on Game 2
4
His fallacious reasoning Game 1: ● 4 throws of one die ● chances of getting a “six” in a single throw equals 1/6 ● Therefore changes of getting a “six” among four throws equals 4 x (1/6) = 2/3 Game 2: ● 24 throws of two dice ● Chances of getting a “double-six” in one throw equals 1/36 ● Therefore chances of getting a “double-six” among twenty-four throws equals 24 x (1/36) = 2/3
5
Pascal and Fermat Blaise Pascal Pierre de Fermat Desperate for an explanation of his losses, the Chevalier wrote in 1654 to one of the great thinkers of his time, Blaise Pascal (1633-1662), who in turn shared news of this “paradox” with the famous lawyer, and amateur mathematician, Pierre de Fermat (1607-1665) Blaise Pascal Piere de Fermat
6
Founding a new discipline The letters back and forth, between Pascal and Fermat in the mid-Seventeenth Century, in which they worked out an explanation for De Mere's paradox and other questions, can be cited as the origin for a mathematical theory of probability To understand their explanation, and to see the fallacies in De Mere's own reasoning, we need to apply a basic mathematical technique known as The Fundamental Counting Principle
7
Fundamental Counting Principle If a given task can be carried out in m ways, and another task can be carried out in n ways, then altogether the number of ways in which these two tasks can be caried out will be: m times n Obviously this principle can be extended to cases where there are more than just two tasks
8
Example: course prerequisites If there are four ways to fulfill your precalculus requirement, and if there are two ways to fulfill your programming requirement, then altogether there would be 4 x 2 = 8 ways to qualify for enrolling in this Math 202 course
9
Example: ASCII codes The American Standard Code for Information Interchange (ASCII) was developed in the 1960s to represent characters used in telegraphic communications, and in more recent times the printable characters on a teletype console or computer monitor, using 7-digit binary numbers How many ASCII codes are possible?
10
Example: Auto license plates Beginning in 1980, the standard License Plates used in California had seven characters, arranged in the pattern shown here (first a numeral, then 3 letters, then 3 numerals) How many such plates are possible? Answer: 10 x 26 x 26 x 26 x 10 x 10 x 10
11
Example: computer passwords If you are required to type in a 7-letter password in order to access your computer account, then your number of possible password choices is 26 x 26 x 26 x 26 x 26 x 26 x 26 = 26 7 because each of the seven tasks, of selecting a letter from the alphabet, can be done in 26 ways
12
Over 8 billion passwords! A one-line Python program can show us the number of seven-letter passwords print “Number of 7-letter passwords = %d “ % 26 ** 7 (This value 26 7 equals 8,031,810,176)
13
Example: DeMere's Game 1 When a single die is thrown 4 times, the total number of possible outcomes equals 6 x 6 x 6 x 6 = 6 4 = 1296 Of these equally likely possiblities, the number of outcomes in which “six” does NOT occur equals 5 x 5 x 5 x 5 = 5 4 = 625 Thus 1296 – 625 = 671 outcomes are “favorable” ones for DeMere's wager
14
Example: DeMere's Game 2 When two dice are thrown 24 times, the total number of possible outcomes equals 36 24 And the number of these possibilities in which “double-six” does NOT occur equals 35 24 So the probability of getting a “double-six” in 24 throws of two dice equals (36 24 – 35 24 )/36 24 (We need a computer to calculate this fraction!)
15
A quick Python program samples = 36 ** 24# the number of outcomes failures = 35 ** 24# those without double-six successes = samples – failures# 'favorables' print “ Probability of a 'double-six' in 24 throws”, numerator = 1.0 * successes denominator = 1.0 * samples probability = numerator / denominator print “= %1.4f “ % probability
16
Computer animations Motion pictures work by showing us a series of still images in rapid succession (e.g., 24 frames-per-second at the movies) The human eye blends these still images together in what seems like continuous movement We can apply that idea, plus knowledge about special terminal control codes, to write short programs that create useful animations
17
ANSI 'escape' codes printf Using the 'printf()' function in C (or C++), we can write program-statements that achieve two goals: - make the blinking cursor disappear printf( “\e[?25l” ); - draw characters anywhere onscreen printf( “\e[%d;%dH%c”, 12, 40, 'o' ); Thus we can draw a character, pause for a fraction of a second, then make it disappear by overwriting it with a blank space
18
Clearing the screen Here is a terminal 'escape' sequence you can use to clear the entire screen: printf( “\e[H\e[J” ); And remember that 'fflush( stdout );” can be used to make your screen-output show up immediatly
19
A “random walk” animation int row = 12, col = 40;// initialize the variables for (int frame = 0; frame < 100; frame++) { intx = random() % 2;// randomly choose 0 or 1 switch ( x ) { case 0:col += 1; break;// x==0? move to the right case 1:col -= 1; break;// x==1? move to the left } printf( “\e[%d;%dH%c”, row, col, 'o' ); fflush( stdout );// show usleep( 40000 );// delay for 40 milliseconds printf( “\e[%d;%dH%c”, row, col, ' ' ); fflush( stdout );// hide }
20
List of escape-codes You can find books and websites that document the various terminal escape-code sequences http://ascii-table.com/ansi-escape-sequences.php
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.