An important idea in probability are combinations vs permunations.

- Combinations - You don’t care about the order in which events occur. For example, if a store sells 10 shirts but you can only buy 3, the order in which you buy the shirts does not matter. The number of different combinations is:

\[ nCr = \frac{n!}{r!(n-r)!} \]

Where n is the total objects and r is the number of objects you want to choose.

For the shirt example:

\[10C3 = \frac{10!}{3!(10-3)!} = \frac{10!}{3!*7!} = 240\]

- Permutations - The order of the events matters. For example in a PIN code, there are 10 different numbers (0 - 9) and you can only choose 4 numbers.

The equation for a permuation is:

\[ nPr = \frac{n!}{(n-r)!} \]

Where n is the number of objects and r is the number of objects you want to choose (or the number of slots you have for those objects).

For a pin code:

\[ nPr = \frac{10!}{(10-4)!} = \frac{10!}{6!} = 10 * 9 * 8 * 7 = 5040\]

Calculate the number of strings over the alphabet {a, b} that have length 7, begin with a, and contain at least one b.

Before we begin the probability part of the question, it’s good to look at set notation.

{a, b} only includes the letters a and b from the alphabet.

{1, 2, 3} only includes the numbers 1, 2, and 3.

{‘apple’, ‘orange’} only includes the fruits ‘apple’ and ‘orange.’

Onto the probability part - we have to meet the following conditions

The string has length 7

Begins with a

Contains at least one b

**Total Combinations**

Disregarding these conditions, there are:

2^7 = 128 total possible combinations

**Why?:**

Pretend you have 7 empty slots:

Each slot can be filled with either a or b. Since there are two possible values for each slot, you multiply

\[2 * 2 * 2 * 2 * 2 * 2 * 2 = 128\]

**Looking at the conditions **

We can now look at each of the conditions one at a time. To meet the `begins with a`

condition, the string must look like this:

a _ _ _ _ _ _

That only leaves 6 empty slots that can be filled with either a or b. For this reason, we use 2^6 = 64. Since the first slot MUST be a, there are half as many possible combinations. To meet the `contains at least one b`

condition, we know that the string must look like one of the following strings (where the empty slots can be a OR b).

**String possibility 1 - first b is in the 2nd slot**

a b _ _ _ _ _ (There are 5 remaining slots, so 2^5 = 32 possibilities)

**String possibility 2 - first b is in the 3rd slot**

a a b _ _ _ _ (There are 4 remaining slots, so 2^4 = 16 possibilities)

**String possibility 3 - first b is in the 4th slot**

a a a b _ _ _ (There are 3 remaining slots, so 2^3 = 8 possibilities)

**String possibility 4 - first b is in the 5th slot**

a a a a b _ _ (There are 2 remaining slots, so 2^2 = 4 possibilities)

**String possibility 5 - first b is in the 6th slot**

a a a a a b _ (There is 1 remaining slots, so 2^1 = 2 possibilities)

**String possibility 6 - first b is in the 7th slot**

a a a a a a b (There are 0 remaining slots, so 2^0 = 1 possibilities)

Now that we have segmented the possibilities into which position the first letter b appears, we can just add together all the possibilities

\[ 32 + 16 + 8 + 4 + 2 + 1 = 63 \]

Earlier, we determined there are 2^6 = 64 combinations because there are 6 different slots that can be filled with two letters.

Why did we get 63 as an answer? Because there is only one combination of letters that does not include the letter b:

aaaaaaa

A manufacturer of metal pistons finds that on the average, 12% of his pistons are rejected because they are either oversize or undersize. What is the probability that a batch of 10 pistons will contain?

If there are no more than 2 rejects, that means there can either be 0 rejects, 1 reject, or 2 rejects. We have to find the probability of each of these events and add them together.

We know what the probability of a rejection is 12% or 0.12.

Since a piston can either be accepted or rejected, that means that the probability that a piston is accepted is 1 - 0.12 = 0.88.

**0 rejects in a batch of 10**

This means that all 10 pistons will be accepted. Since we determined the probability of one piston being accepted is 0.88, the probability of 10 pistons being accepted is 0.88^10.

**1 rejects in a batch of 10**

This means that 9 pistons will be accepted and 1 will be rejected. This probability will be (10C1)(0.88^9)*(0.12^1). We multiply by (10C1) because there are 10 different times that a piston could be rejected once.

**2 rejects in a batch of 10**

This means that 8 pistons will be accepted and 2 will be rejected. This probability will be (10C2)(0.88^8)*(0.12^2). We multiply by (10C2) because there are 10 different times that a piston could be rejected twice.

**Solution**

\[P(no more than 2 rejects) = P(0 rejects) + P(1 reject) + P(2 rejects)\]

\[P(0 rejects) + P(1 rejects) + P(2 rejects) = (10C0)*(0.88)^{10}*(0.12)^0 + (10C1)*(0.88)^9*(0.12)^1 + (10C2)*(0.88)^8*(0.18)^2 = 0.8913\]

At least 2 rejects means there can be 2, 3, 4, 5, 6, 7, 8, 9, or 10 rejections. This is too much work to solve - so instead we can just use:

P(at least 2 rejects) = 1 - P(less than two rejects)

Why can we do this?

We know that where can either be 2 or more rejections, or less than 2 rejections in a batch of 10. No other possibility can happen. Therefore, the probability of these two events together is 100% or 1.

**Solution**

P(less than two rejects) = P(0 rejects) + P(1 rejects)

Note - 10C0 = 1

\[P(0 rejects) = (10C0)*(0.88)^10 = 0.2785\]

\[P(1 rejects) = (10C1)*(0.88)^9*(0.12)^1 = 0.378\]

**P(less than two rejects) = 0.2785 + 0.378 = 0.6565**