Question 936633
In how many ways can five students 
<pre>
Suppose the students are A,B,C,D and E
and the seats are 1,2,3,4,5,6,7 and 8
</pre>
be seated in row of eight seat if a certain two students

a) insist on setting next to each other
<pre>
Suppose A and B insist on sitting together.

Case 1:  A sits left of B
There are 7 ways to choose their seats: 1&2,2&3,3&4,4&5,5&6,6&7, and 7&8
That's 7 ways:
Case 2:  A sits right of B
That's also 7 ways.

That's 14 ways to place A and B together

There are now 6 seats left and 3 students C,D, and E left to seat.

For each of those 14 ways to seat A and B, there are
6 ways to seat C.  That's 14*6 ways to seat A,B and C.

There are now 5 seats left and 2 students D and E left to seat.

For each of those 14*6 ways to seat A,B and C, there are
5 ways to seat D.  That's 14*6*5 ways to seat A,B,C and D.
 
There are 4 seats left and 1 student, E, left to seat.

For each of those 14*6*5 ways to seat A,B,C and C, there are
4 ways to seat D.  That's 14*6*5*4 ways to seat A,B,C,D and E.

Answer: 14*6*5*4 = 1680 ways.
</pre>
b) Refuse to sit next to each other
<pre>
There are 8 ways to seat A, 7 ways to seat B, 6 ways to seat C,
5 ways to seat D and 4 ways to seat E.

That's 8*7*6*5*4 = 6720 ways anybody can sit in any seat.

We subtract 1680 ways A and B sit together.

Answer 6720-1680 = 5040.

Edwin</pre>