Question 1175991
<font color=black size=3>
Let's say these 5 boys and 4 girls are students of a small classroom. Let's also say that the teacher is chaperoning them.


The 5+4 = 9 students are standing in line, and let's say that 3 adjacent students (standing next to each other) leave the line to get popcorn. The teacher can step in for those 3 students as a substitution. Wherever the teacher is, the three students will replace him/her when the students get back from buying popcorn.


So the 9 people in line drops to 9-3 = 6 people after those 3 students leave. But then the teacher steps in to bump the count to 6+1 = 7 people.


Those 7 people arrange in 7! = 7*6*5*4*3*2*1 = 5040 ways. 
The exclamation mark indicates factorial. We count down 7,6,5,... all the way to 1 multiplying along the way.


There are 5040 ways to arrange the group of students+teacher. Order matters. Of any of those 5040 permutations, there are 3! = 3*2*1 = 6 ways to arrange the trio of students who left the line.


Consider those three students to have codenames of A,B,C
Those 6 arrangements are such
A,B,C
A,C,B
B,A,C
B,C,A
C,A,B
C,B,A


This means that we'll have 6*5040 = <font color=red>30,240 different ways</font> to form the line such that those 3 students must stand next to one another. At this point, the teacher has been removed from the line.
</font>