# How many ways can you arrange the letters PLAY without repetition if the first letter can't be A and the second can't be Y?

How would you do this sort of problem in general, for example, if the the letter sequence was longer and there were more conditions?

One way I used to solve this problem was to enumerate the possibilities (I counted 14):

   L => PLAY, PLYA
/
P
\
A = > PALY, PLYA

P => LPAY, LPYA
/
L
\
A => LAYP, LAPY

P => YPLA, YPAL
/
Y -- L => YLPA, YLAP
\
A => YAPL, YALP


The other way I tried to think about this was to start with all possible combinations of the letters and subtract out letter combinations that didn't meet the given conditions.

4! - 3! if you start with A - 2 x 1 * 1 * 2 if you start with P or L but have Y as the second letter.

It would seem if you make the problem larger and add more conditions it becomes error prone to try to subtract out all the unacceptable combinations of letters.

-

There are $4!=24$ possible permutations without any restrictions. How many are bad? There are $3!=6$ that have A as the first letter, and there are $3!=6$ that have Y as the second letter, so to a first approximation there are $24-6-6=12$ allowable permutations. But some of the bad permutations are bad because they have A as first letter and Y as second letter, and we subtracted these twice: once on account of the A, and once on account of the Y. To correct that first approximation, we need to add these ‘doubly bad’ permutations back into the total. There are $2!=2$ of them, so the final count is $24-6-6+2=14$.

This technique of counting is known as the method of inclusion-exclusion and can be extended to arbitrarily large problems, though the computations may become rather extensive.

-

Without restrictions, there are $4!=24$ ways of rearranging the letters. $6$ have A in the first position (fix A and rearrange the others), and $6$ have Y in the second position. But now you've counted the rearrangements AY_ _ twice (once for each constraint, and they fit both), so add them back in (there are $2$) to cancel that out. So overall there are $24-6-6+2=14$ possible ways.

-
+1. This is an application of the inclusion-exclusion principle. –  Harald Hanche-Olsen Aug 23 '12 at 19:48

You can break this down into two cases.

Either the first letter is Y, or it is not Y. Thus, we have two disjoint cases.

First, let the first letter be Y. Then, for all options of letters in order, you have $$1\cdot 3\cdot 2\cdot 1 = 6.$$

Second, let the first letter not be Y. Then, we have $$2\cdot 2\cdot 2\cdot 1 = 8.$$