Originally Posted by
Plato You really need to learn to model the outcome space.
For part (b) the desired outcomes are rearrangements of the string
.
Where each
can be
.
The string can be arranged in
ways.
But each
can be replaced in four ways that gives
.
Now each of those strings has probability
.
I don't know if this post will be of value to anyone, but here is another method which is much more complicated than Plato's and gives the same result. I outlined it originally because I was having trouble following Plato's reasoning, even though it seems really easy to follow now.
Consider each possible type of string, by which I mean:
111222XXXX {4}
111222XXXY {1,3}
111222XXYY {2,2}
111222XYZZ {1,1,2}
111222XYZW {1,1,1,1}
where X, Y, Z, and W can be 3, 4, 5, or 6.
This corresponds with the ways 4 can be partitioned as a sum of positive integers. (For partition function P, P(4) = 5.)
Then you count the ways to get each one and multiply by the corresponding ways to arrange the string.
4 ways to get {4} resulting in .
ways to get {1,3} resulting in .
ways to get {2,2} resulting in .
ways to get {1,1,2} resulting in .
1 way to get {1,1,1,1} resulting in .
Which can be summarized as
We get .
By the way, I also programmed a Monte Carlo to verify the result. (Because initially there was a discrepancy between the two answers, due to my writing a 12 instead of a 6 in one spot.)
Code:
import java.util.Random;
public class diceRollsProblem() {
Random g = new Random();
public void monteCarlo() {
int successes = 0;
for (int i = 0; i < Integer.MAX_VALUE; i++) {
if (i % 500 == 0)
System.out.println(i + " " + successes/(double)i);
int[] rolls = new int[10];
for (int j = 0; j < 10; j++)
rolls[j] = g.nextInt(6)+1;
int num1s = 0, num2s = 0;
for (int j = 0; j < 10; j++) {
if (rolls[j] == 1) num1s++;
if (rolls[j] == 2) num2s++;
}
if (num1s == 3 && num2s == 3) successes++;
}
}
}
Edit: This program's a bit better.
Code:
import java.util.Random;
public class diceRollsProblem() {
Random g = new Random();
public void monteCarlo() {
int successes = 0;
for (int i = 0; i < Integer.MAX_VALUE; i++) {
if (i % 100000 == 0)
System.out.println(i + " " + successes/(double)i);
int[] distr = new int[6];
for (int j = 0; j < 10; j++)
distr[g.nextInt(6)]++;
if (distr[0] == 3 && distr[1] == 3) successes++;
}
}
}