The number of permutation from the letter A to G, so that neither the set BEG nor CAD appears is ?
The number of ways that ABCDEFG can be arranged is 7!
From that we must subtract the number of ways BEG and/or CAD appear.
We use
N(X or Y) = N(X) + N(Y) - N(X and Y)
Where
N(X) = "The number of ways in which BEG appears",
N(Y) = "The number of ways in which CAD appears"
N(X and Y) = "The number of ways in which both BED and CAD appear"
---------------------
To find N(X):
The number of ways BEG occurs is in one of these 5 configurations:
BEG----, -BEG---, --BEG--, ---BEG-, ----BEG
where the other letters {A,C,D,F} are where the dashes are.
We can choose the configuration for BEG to appear in 5 ways.
We choose the arrangements of the other 4 letters to go where
the dashes are in 4! or 24 ways.
So N(X) = 5×4! = 5×24 = 120
-------------------
To find N(Y)
N(Y) is the same and N(X), so N(Y) = 120 ways also.
-------------------
To find N(X and Y)
The number of ways both BEG and CAD occur together in one of
these 6 configurations:
BEGCADF, BEGFCAD, FBEGCAD, CADBEGF, CADFBEG, FCADBEG
So N(X and Y) = 6
-------------------
N(X or Y) = N(X) + N(Y) - N(X and Y)
= 120 + 120 - 6 = 234
-------------------
Answer: 7! - 234 = 5040 - 234 = 4806
Edwin