A company has 11 software engineers and 7 civil engineers. In how many ways can they be seated in a row so that all the civil engineers do not sit together?
Total number of engineers =11+7=18.
These 18 engineers can be arranged in a row in 18!ways. ...(A)
Now we will find out the total number of ways in which these 18 engineers can be arranged so that all the 7 civil engineers will always sit together.
For this, group all the 7 civil engineers and consider as a single civil engineer. Hence, we can take total number of engineers as 12. These 12 engineers can be arranged in 12!ways.
We had grouped 7 civil engineers. These 7 civil engineers can be arranged among themselves in 7!ways.
Hence, total number of ways in which the 18 engineers can be arranged so that the 7 civil engineers will always sit together = 12! x 7! ...(B)
From (A) and (B),
Total number of ways in which 11 software engineers and 7 civil engineers can be seated in a row so that all the civil engineers do not sit together=18!-(12! x7!)