Combinatorics: number of ways to seat 5 children in a line with rules
Five children need to be seated into $5$ seats, but Mike won't sit in the middle, and Johnny can't be seated at the edges.
Since it is rather manageable to count in how many different ways Mike and Johnny can be placed I've done it "by hand" and then multiplied by $3!$ for the remaining children.
$m$ is for Mike, $j$ is for Johnny, $x$ is for the rest
$$ \begin{array}{c} n & \text{s1} & \text{s2} & \text{s3} & \text{s4} & \text{s5} \\ \hline 1 & m & j & x & x & x \\ 2 & m & x & j & x & x \\ 3 & m & x & x & j & x \\ 4 & x & m & j & x & x \\ 5 & x & m & x & j & x \\ 6 & x & j & x & m & x \\ 7 & x & x & j & m & x \\ 8 & x & j & x & x & m \\ 9 & x & x & j & x & m \\ 10 & x & x & x & j & m \\ \end{array} $$
Totaling 10 different permutations times $3!$ for the remaining children which can sit at any spot: $10 \cdot 6 = 60.$
How is this problem supposed to be dealt with in a proper, mathematical, fashion ?
Let $M$ denote the set of arrangements in which Mike is in the midst. Let $J$ denote the set of arrangements in which Johnny is seated at one of the edges.
Since there are evidently $5!$ arrangements if conditions lack, you are actually looking for: $$5!-|M\cup J|$$
With inclusion/exclusion we find:$$|M\cup J|=|M|+|J|-|M\cap J|=4!+2\cdot4!-2\cdot3!=60$$
so that: $$5!-|M\cup J|=120-60=60$$
Consider two cases -
Case 1)
Johnny sits in the middle. Hence others can sit in any way they want. Hence the number of ways in this case is $4!=24$
Case 2)
Neither Johnny nor Mike sits in the middle.
Now Johnny has only two choices to sit (2nd and 4th) positions. After selecting places for Johnny Mike is left with 3 places to sit because he is not allowed to sit in middle. So he has 3 choices while the rest can be permuted on left three seats. Hence the number of ways in this case are
$$\binom {2}{1}\cdot \binom {3}{1}\cdot 3! =36$$
Hence the total number of ways the students can be seated in a line satisfying the given restrictions are $36+24=60$
Hope it helped.
Let's seat Johnny first then Mike then the others, counting the possibilities in each case
- Johnny in the middle: $1 \times 4 \times 3! = 24$ ways
- Johnny not in the middle: $2 \times 3 \times 3! = 36$ ways
So there are $24+36=60$ possibilities in total
Let $A_1$ be the event Mike is sitting on middle, $A_2$ be the event Johny is sitting on left edge or right edge. Then we need to find $5!-|A_1 \cup A_2|$.
In order to find $|A_1 \cup A_2|$, we can use Inclusion-Exclusion Principle as $$|A_1 \cup A_2| = |A_1|+|A_2|-|A_1 \cap A_2|$$ Now, $|A_1| = 4! = 24$ and $|A_2| = 2 \cdot4! = 48$ (Johny sitting left edge and sitting right edge are symmetric and independent events so we can simply multiply the number of arrangements when Johny is sitting on the left edge by $2$). Also, $|A_1 \cap A_2| = 2 \cdot 3! = 12$ by similar argument. So, we have $|A_1 \cup A_2| = 48+24-12=60$ and the result should be $5!-60 = 60$.