Tag Archives: binomial

Probability, Polynomials, and Sicherman Dice

Three years ago, I encountered a question on the TI-Nspire Google group asking if there was a way to use CAS to solve probability problems.  The ideas I pitched in my initial response and follow-up a year later (after first using it with students in a statistics class) have been thoroughly re-confirmed in my first year teaching AP Statistics.  I’ll quickly re-share them below before extending the concept with ideas I picked up a couple weeks ago from Steve Phelps’ session on Probability, Polynomials, and CAS at the 64th annual OCTM conference earlier this month in Cleveland, OH.

BINOMIALS:  FROM POLYNOMIALS TO SAMPLE SPACES

Once you understand them, binomial probability distributions aren’t that difficult, but the initial conjoining of combinatorics and probability makes this a perennially difficult topic for many students.  The standard formula for the probability of determining the chances of K successes in N attempts of a binomial situation where p is the probability of a single success in a single attempt is no less daunting:

\displaystyle \left( \begin{matrix} N \\ K \end{matrix} \right) p^K (1-p)^{N-K} = \frac{N!}{K! (N-K)!} p^K (1-p)^{N-K}

But that is almost exactly the same result one gets by raising binomials to whole number powers, so why not use a CAS to expand a polynomial and at least compute the \displaystyle \left( \begin{matrix} N \\ K \end{matrix} \right) portion of the probability?  One added advantage of using a CAS is that you could use full event names instead of abbreviations, making it even easier to identify the meaning of each event.

prob1

The TI-Nspire output above shows the entire sample space resulting from flipping a coin 6 times.  Each term is an event.  Within each term, the exponent of each variable notes the number of times that variable occurs and the coefficient is the number of times that combination occurs.  The overall exponent in the expand command is the number of trials.  For example, the middle term– 20\cdot heads^3 \cdot tails^3 –says that there are 20 ways you could get 3 heads and 3 tails when tossing a coin 6 times. The last term is just tails^6, and its implied coefficient is 1, meaning there is just one way to flip 6 tails in 6 tosses.

The expand command makes more sense than memorized algorithms and provides context to students until they gain a deeper understanding of what’s actually going on.

FROM POLYNOMIALS TO PROBABILITY

Still using the expand command, if each variable is preceded by its probability, the CAS result combines the entire sample space AND the corresponding probability distribution function.  For example, when rolling a fair die four times, the distribution for 1s vs. not 1s (2, 3, 4, 5, or 6) is given by

prob2

The highlighted term says there is a 38.58% chance that there will be exactly one 1 and any three other numbers (2, 3, 4, 5, or 6) in four rolls of a fair 6-sided die.  The probabilities of the other four events in the sample space are also shown.  Within the TI-Nspire (CAS or non-CAS), one could use a command to give all of these probabilities simultaneously (below), but then one has to remember whether the non-contextualized probabilities are for increasing or decreasing values of which binomial outcome.

prob3

Particularly early on in their explorations of binomial probabilities, students I’ve taught have shown a very clear preference for the polynomial approach, even when allowed to choose any approach that makes sense to them.

TAKING POLYNOMIALS FROM ONE DIE TO MANY

Given these earlier thoughts, I was naturally drawn to Steve Phelps “Probability, Polynomials, and CAS” session at the November 2014 OCTM annual meeting in Cleveland, OH.  Among the ideas he shared was using polynomials to create the distribution function for the sum of two fair 6-sided dice.  My immediate thought was to apply my earlier ideas.  As noted in my initial post, the expansion approach above is not limited to binomial situations.  My first reflexive CAS command in Steve’s session before he share anything was this.

prob4

By writing the outcomes in words, the CAS interprets them as variables.  I got the entire sample space, but didn’t learn gain anything beyond a long polynomial.  The first output– five^2 –with its implied coefficient says there is 1 way to get 2 fives.  The second term– 2\cdot five \cdot four –says there are 2 ways to get 1 five and 1 four.  Nice that the technology gives me all the terms so quickly, but it doesn’t help me get a distribution function of the sum.  I got the distributions of the specific outcomes, but the way I defined the variables didn’t permit sum of their actual numerical values.  Time to listen to the speaker.

He suggested using a common variable, X, for all faces with the value of each face expressed as an exponent.  That is, a standard 6-sided die would be represented by X^1+X^2+ X^3+X^4+X^5+X^6 where the six different exponents represent the numbers on the six faces of a typical 6-sided die.  Rolling two such dice simultaneously is handled as I did earlier with the binomial cases.

NOTE:  Exponents are handled in TWO different ways here.  1) Within a single polynomial, an exponent is an event value, and 2) Outside a polynomial, an exponent indicates the number of times that polynomial is applied within the specific event.  Coefficients have the same meaning as before.

Because the variables are now the same, when specific terms are multiplied, their exponents (face values) will be added–exactly what I wanted to happen.  That means the sum of the faces when you roll two dice is determined by the following.

prob5

Notice that the output is a single polynomial.  Therefore, the exponents are the values of individual cases.  For a couple examples, there are 3 ways to get a sum of 10 \left( 3 \cdot x^{10} \right) , 2 ways to get a sum of 3 \left( 2 \cdot x^3 \right) , etc.  The most commonly occurring outcome is the term with the largest coefficient.  For rolling two standard fair 6-sided dice, a sum of 7 is the most common outcome, occurring 6 times \left( 6 \cdot x^7 \right) .  That certainly simplifies the typical 6×6 tables used to compute the sums and probabilities resulting from rolling two dice.

While not the point of Steve’s talk, I immediately saw that technology had just opened the door to problems that had been computationally inaccessible in the past.  For example, what is the most common sum when rolling 5 dice and what is the probability of that sum?  On my CAS, I entered this.

prob6

In the middle of the expanded polynomial are two terms with the largest coefficients, 780 \cdot x^{18} and 780 \cdot x^{19}, meaning a sums of 17 and 18 are the most common, equally likely outcomes when rolling 5 dice.  As there are 6^5=7776 possible outcomes when rolling a die 5 times, the probability of each of these is \frac{780}{7776} \approx 0.1003, or about 10.03% chance each for a sum of 17 or 18.  This can be verified by inserting the probabilities as coefficients before each term before CAS expanding.

prob7

With thought, this shouldn’t be surprising as the expected mean value of rolling a 6-sided die many times is 3.5, and 5 \cdot 3.5 = 17.5, so the integers on either side of 17.5 (17 & 18) should be the most common.  Technology confirms intuition.

ROLLING DIFFERENT DICE SIMULTANEOUSLY

What is the distribution of sums when rolling a 4-sided and a 6-sided die together?  No problem.  Just multiply two different polynomials, one representative of each die.

prob8

The output shows that sums of 5, 6, and 7 would be the most common, each occurring four times with probability \frac{1}{6} and together accounting for half of all outcomes of rolling these two dice together.

A BEAUTIFUL EXTENSION–SICHERMAN DICE

My most unexpected gain from Steve’s talk happened when he asked if we could get the same distribution of sums as “normal” 6-sided dice, but from two different 6-sided dice.  The only restriction he gave was that all of the faces of the new dice had to have positive values.  This can be approached by realizing that the distribution of sums of the two normal dice can be found by multiplying two representative polynomials to get

x^{12}+2x^{11}+3x^{10}+4x^9+5x^8+6x^7+5x^6+4x^5+3x^4+2x^3+x^2.

Restating the question in the terms of this post, are there two other polynomials that could be multiplied to give the same product?  That is, does this polynomial factor into other polynomials that could multiply to the same product?  A CAS factor command gives

prob9

Any rearrangement of these eight (four distinct) sub-polynomials would create the same distribution as the sum of two dice, but what would the the separate sub-products mean in terms of the dice?  As a first example, what if the first two expressions were used for one die (line 1 below) and the two squared trinomials comprised a second die (line 2)?

prob10

Line 1 actually describes a 4-sided die with one face of 4, two faces with 3s, and one face of 2.  Line 2 describes a 9-sided die (whatever that is) with one face of 8, two faces of 6, three faces of 4, two faces of 2, and one face with a 0 ( 1=1 \cdot x^0).  This means rolling a 4-sided and a 9-sided die as described would give exactly the same sum distribution.  Cool, but not what I wanted.  Now what?

Factorization gave four distinct sub-polynomials, each with multitude 2.  One die could contain 0, 1, or 2 of each of these with the remaining factors on the other die.  That means there are 3^4=81 different possible dice combinations.  I could continue with a trail-and-error approach, but I wanted to be more efficient and elegant.

What follows is the result of thinking about the problem for a while.  Like most math solutions to interesting problems, ultimate solutions are typically much cleaner and more elegant than the thoughts that went into them.  Problem solving is a messy–but very rewarding–business.

SOLUTION

Here are my insights over time:

1) I realized that the x^2 term would raise the power (face values) of the desired dice, but would not change the coefficients (number of faces).  Because Steve asked for dice with all positive face values.  That meant each desired die had to have at least one x to prevent non-positive face values.

2) My first attempt didn’t create 6-sided dice.  The sums of the coefficients of the sub-polynomials determined the number of sides.  That sum could also be found by substituting x=1 into the sub-polynomial.  I want 6-sided dice, so the final coefficients must add to 6.  The coefficients of the factored polynomials of any die individually must add to 2, 3, or 6 and have a product of 6.  The coefficients of (x+1) add to 2, \left( x^2+x+1 \right) add to 3, and \left( x^2-x+1 \right) add to 1.  The only way to get a polynomial coefficient sum of 6 (and thereby create 6-sided dice) is for each die to have one (x+1) factor and one \left( x^2+x+1 \right) factor.

3) That leaves the two \left( x^2-x+1 \right) factors.  They could split between the two dice or both could be on one die, leaving none on the other.  We’ve already determined that each die already had to have one each of the x, (x+1), and \left( x^2+x+1 \right) factors.  To also split the \left( x^2-x+1 \right) factors would result in the original dice:  Two normal 6-sided dice.  If I want different dice, I have to load both of these factors on one die.

That means there is ONLY ONE POSSIBLE alternative for two 6-sided dice that have the same sum distribution as two normal 6-sided dice.

prob11

One die would have single faces of 8, 6, 5, 4, 3, and 1.  The other die would have one 4, two 3s, two 2s, and one 1.  And this is exactly the result of the famous(?) Sicherman Dice.

If a 0 face value was allowed, shift one factor of x from one polynomial to the other.  This can be done two ways.

prob12

The first possibility has dice with faces {9, 7, 6, 5, 4, 2} and {3, 2, 2, 1, 1, 0}, and the second has faces {7, 5, 4, 3, 2, 0} and {5, 4, 4, 3, 3, 2}, giving the only other two non-negative solutions to the Sicherman Dice.

Both of these are nothing more than adding one to all faces of one die and subtracting one from from all faces of the other.  While not necessary to use polynomials to compute these, they are equivalent to multiplying the polynomial of one die by x and the other by \frac{1}{x} as many times as desired. That means there are an infinite number of 6-sided dice with the same sum distribution as normal 6-sided dice if you allow the sides to have negative faces.  One of these is

prob13

corresponding to a pair of Sicherman Dice with faces {6, 4, 3, 2, 1, -1} and {1,5,5,4,4,3}.

CONCLUSION:

There are other very interesting properties of Sicherman Dice, but this is already a very long post.  In the end, there are tremendous connections between probability and polynomials that are accessible to students at the secondary level and beyond.  And CAS keeps the focus on student learning and away from the manipulations that aren’t even the point in these explorations.

Enjoy.

Binomial Probability and CAS

I posted previously about a year ago an idea for using CAS in a statistics course with probability.  I’ve finally had an opportunity to use it with students in my senior one-semester statistics course over the last few weeks, so I thought I’d share some refinements.  To demonstrate the mathematics, I’ll use the following problem situation.

Assume in a given country that women represent 40% of the total work force.  A company in that country has 10 employees, only 2 of which are women.
1) What is the probability that by pure chance a 10-employee company in that country might employ exactly 2 women?
2) What is the probability that by pure chance a 10-employee company in that country might employ 2 or fewer women?

Over a decade ago, I used binomial probability situations like this as an application of polynomial expansions, tapping Pascal’s Triangle and combinatorics to find the number of ways a group of exactly 2 women can appear in a total group size of 10.  Historically, I encouraged students to approach this problem by defining m=men and w=women and expand (m+w)^{10} where the exponent was the number of employees, or more generally, the number of trials.  Because question 1 asks about the probability of exactly 2 women, I was interested in the specific term in the binomial expansion that contained w^2.  Whether you use Pascal’s Triangle or combinations, that term is 45w^2m^8.  Substituting in given percentages of women and men in the workforce, P(w)=0.4 and P(m)=0.6, answers the first question.  I used a TI-nSpire to determine that there is a 12.1% chance of this.

That was 10-20 years ago and I hadn’t taught a statistics course in a very long time.  I suspect most statistics classes using TI-nSpires (CAS or non-CAS) today use the binompdf command to get this probability.

The slight differences in the input parameters determine whether you get the probability of the single event or the probabilities for all of the events in the entire sample space.  The challenge for the latter is remembering that the order of the probabilities starts at 0 occurrences of the event whose probability is defined by the second parameter.  Counting over carefully from the correct end of the sequence gives the desired probability.

With my exploration of CAS in the classroom over the past decade, I saw this problem very differently when I posted last year.  The binompdf command works well, but you need to remember what the outputs mean.  The earlier algebra does this, but it is clearly more cumbersome.  Together, all of this screams (IMO) for a CAS.  A CAS could enable me to see the number of ways each event in the sample space could occur.  The TI-nSpire CAS‘s output using an expand command follows.

The cool part is that all 11 terms in this expansion appear simultaneously.  It would be nice if I could see all of the terms at once, but a little scrolling leads to the highlighted term which could then be evaluated using a substitute command.

The insight from my previous post was that when expanding binomials, any coefficients of the individual terms “received” the same exponents as the individual variables in the expansion.  With that in mind, I repeated the expansion.

The resulting polynomial now shows all the possible combinations of men and women, but now each coefficient is the probability of its corresponding event.  In other words, in a single command this approach defines the entire probability distribution!  The highlighted portion above shows the answer to question 1 in a single step.

Last week one of my students reminded me that TI-nSpire CAS variables need not be restricted to a single character.  Some didn’t like the extra typing, but others really liked the fully descriptive output.

To answer question 2, TI-nSpire users could add up the individual binompdf outputs -OR- use a binomcdf command.

This gets the answer quickly, but suffers somewhat from the lack of descriptives noted earlier.  Some of my students this year preferred to copy the binomial expansion terms from the CAS expand command results above, delete the variable terms, and sum the results.  Then one suggested a cool way around the somewhat cumbersome algebra would be to substitute 1s for both variables.

CONCLUSION:  I’ve loved the way my students have developed a very organic understanding of binomial probabilities over this last unit.  They are using technology as a scaffold to support cumbersome, repetitive computations and have enhanced in a few directions my initial presentations of optional ways to incorporate CAS.  This is technology serving its appropriate role as a supporter of student learning.

OTHER CAS:  I focused on the TI-nSpire CAS for the examples above because that is the technology is my students have.  Obviously any CAS system would do.  For a free, Web-based CAS system, I always investigate what Wolfram Alpha has to offer.  Surprisingly, it didn’t deal well with the expanded variable names in (0.4women+0.6men)^{10}.  Perhaps I could have used a syntax variation, but what to do wasn’t intuitive, so I simplified the variables here to get

Huge Pro:  The entire probability distribution with its descriptors is shown.
Very minor Con:  Variables aren’t as fully readable as with the fully expanded variables on the nSpire CAS.

Factors and number bases

For the second day of my precalculus classes last week, I had planned to introduce them to some of the CAS syntax of their new TI-Nspire calculators.  The following is my best attempt to recreate a conversation that happened when we explored the factor command.  Of course, this could have happened on any CAS platform you have available (TI-Nspire CAS, Wolfram Alpha, Geogebra (v4.2 beta release and forum), …).

I first asked them to factor x^2-1.  No surprises.  Then, to demonstrate the power of the machines, I asked them to factor x^{23}-1.  The virtually instantaneous results elicited some “wow”s around the room.  Knowing some sub-factoring would result, I suggested they factor x^8-1.  One student also factored x^{13}-1.  Announcing her result to the class, speculation immediately mounted that there might be a bigger pattern at play, especially for odd integer exponents.

It’s difficult to use any toolbox to its fullest extent if you don’t know everything inside it.  My only plan for this was to introduce a CAS command for problem solving later in the course, but my students had other plans.  Seeing the results above, they started to make broader pattern predictions.

Pattern 1:  A few quickly surmised that for odd integer values of n, x^n-1 factored to (x-1)\cdot\left( x^{n-1}+x^{n-2}+...+x^2+x+1 \right).  It was a nice stab at the obvious cases, so I asked whether the pattern also held for even values of n.  Some reflexively said “no” based on the output, but others suggested that perhaps the non-(x-1) factors of x^8-1 could multiply back together to continue the pattern the odd powers seem to follow.

GREAT!  I had planned to introduce the Nspire expand command, it’s need just developed organically.  Why give a list of things for uninspired memorization when you can instead put them in situations where they’ll ask to be taught that same specific content?  The students needed and asked for a tool they didn’t think they had yet.  The results elicited a few more “wow”s and “cool”s.

The pattern does seem to continue, but the CAS apparently seems to factor the non-(x-1) polynomial factor further.  What they didn’t ask was why the polynomials from even n factor further while those from odd n don’t seem to do the same.  If the opportunity presents itself, I’ll circle back on that one another day. They also two other smaller connections.

Boolean discovery: Notice the result from the last line of the last image.  Rather than expanding product of the three binomial factors, one student compared what she suspected were the factors, and the CAS responded with the Boolean “true”.  She had done this while the class was struggling to divine the name of the command that might make the CAS “un-factor”–before I gave them the expand command.  It showed them that a CAS actually might be able to help evaluate student hypotheses.

Continuation of Pattern 1: After seeing these results, I asked if the technology was required to factor x^2-1.  Most quickly replied “no” thinking, I guess, that x^2-1=(x-1)(x+1) was a special case they had memorized long ago.  I pressed on.  Does this fit the pattern we had just discovered?  After a few silent moments more, one boy tentatively said, “Well, sure.  If n=2, then x^2-1=(x-1)(x^1+1), using just the last two terms of the longer polynomials created for larger values of n.  More “cool”s.

Final pattern:  One other student noticed the cascading exponents in the factoring of x^8-1.  When asked why that was, he pointed out that x^8-1 could be written and factored as a difference of squares:  x^8-1=\left( \left( x^4 \right)^2-1^2 \right)=(x^4-1)(x^4+1).  From there, the first term was also a difference of squares, and the pattern continued to the complete factoring of x^8-1 in line 3 of the first image.  He confirmed his hypothesis with another “cascading” factoring of differences of squares with x^{16}-1.

Conclusions:  Obviously my students haven’t proved any of these factoring patterns yet, but I was particularly impressed with the way technology created an algebraic sandbox for my students.  They were free to think and explore without me holding their hands every step of the way.

My students had “discovered” a cool factoring pattern.  They had to THINK hard to describe what they saw and investigated to see if the pattern was universal or just some isolated occurrence.  And technology clearly facilitated and enabled some high-level learning that otherwise would have been nothing more low-level and quickly forgotten memorizations.

This happened last Thursday.  Covering other ideas, I mostly left the idea alone Friday, but yesterday I asked my students at the start of class to factor x^{11}-1 without technology.  They all nailed it.

For the future?  This was an accidental lesson, but it is one I’ll deliberately set up in the future for other classes.  It was far more effective than any factoring worksheet I’ve ever seen.  Here are some additional questions I plan to pose later if an opportunity arises.  I’d love any ideas readers may suggest.

  1. If n is even, will the longer, non-(x-1) polynomial always factor?  Why?
  2. What happens for even values of n that aren’t also powers of 2?
  3. How can you PROVE that any of these patterns actually hold universally?

Extension:  One of the students stopped by my room after school Thursday to let me know that personal interest has led him to explore binary numbers in the past.  He was intrigued by the connection of these results to decimal representations.  Another great organic teaching moment!  After a fun conversation with him, I decided to share with that class some thoughts I had on using your fingers to multiply.  This is already long, so a description of that class will need to wait for another post.

CAS and Probability

A recent thread on the TI-Nspire Google Group asked about uses of CAS in probability.  There are so many possibilities–one uses CAS for binomial probabilities. For example, what’s the probability of getting exactly 3 heads in 5 tosses of a fair coin?  A CAS approach expands (\frac{1}{2}h+\frac{1}{2}t)^5.  The \frac{1}{2} coefficients of h (heads) and t (tails) are the respective probabilities of each outcome and the exponent is the number of trials. Obviously, there’s lots to unpack here to prevent this from being a black box tool, but note the power of the output.  The three heads event is represented by the \frac{5h^3t^2}{16} term, and the coefficient is the desired probability, \frac{5}{16}. Early in my career, I taught this by expanding (h+t)^5, picking the appropriate term, and substituting for each variable its probability.  The great power of this approach is that the meaning of each fractional term remains by the presence of the variables while you gain the answers simultaneously.  Also note that while the problem asked only for the probability of exactly 3 heads, the CAS output gives the result of every possibility in the entire sample space. Variations 1)  What is the probability of 3 heads in five tosses if the coin was bent in a way that P(h)=0.4?  Adjust the coefficients to get 0.2304. 2)  The technique is not restricted binomial probabilities.  If there are three possible outcomes (a, b, and c) where P(a)=0.4, P(b)=0.35, and P(c)=0.25, then what is the probability of exactly 2 as in 3 trials? Because only 2 outcomes are specified for the 3 trials, the third could be either b or c.  These two outcomes are highlighted above, giving a total probability of 0.288. While these values certainly could be computed without a CAS, the point here is to use technology for computations, freeing users to think.

A “new” binomial expansion problem

First, props are due to my friend Natalie Jackucyn of Chicago for introducing me to a variation on this problem a few years ago. I pitched this version of the problem to my Precalculus class this week as a way to review some of their Algebra II topics while enhancing their problem-solving ideas and learning how to use their new CAS handhelds. Here’s the problem:

One of the terms in the expansion of (Ax+By)^n is 27869184x^5 y^3. If A, B, and n are all integers, what are their values?

For me, the process is critically important. The answers don’t really matter; they just happen. I’ll post my students’ ideas in a few days, but for now I leave it open to any readers to leave their thoughts.