Soroban is brilliant at explaining such things. But let me try:

There are some tricks you should know to solve this problem:

Trick 1:

2 people always sit together, demands grouping them. Call them as single entity, that way they ill never be separated in your calculations. So group two teachers together and treat them as a boy.

Modified Problem:

A class committee consists of 6 boys, 3 girls . They have to take a group photograph for the school magazine. Find the number of ways they can be arranged in a row such that no 2 girls are next to each other.

Trick 2:

Whenever you want some set of objects always separated, then its a good idea to fix their position first. Consider the diagram below:

G1,G2,G3 refer to the girls. This is one particular arrangement(You have 6 such arrangements).Code:x1** G1**x2** G2**x3** G3***x4

Now lets take the 6 boys and distribute them around these girls.Since the problem does not want the girls to be together, put 1 boy between those girls. This means we can distribute the remaining four boys wherever we please. From the figure, there are x1 boys before G1, x2 boys between G1 and G2, x3 boys between G3 and G4, x4 boys after G4.

Trick 3:

We can always solve such a problem by solving an equivalent problem. Here the number of ways to distribute boys is the same as counting the number of solutions to the equation x1+x2+x3+x4 = 4.

I hope you know to solve such a problem. The number of solutions to this equation is

Finishing touch:

So the number of ways to the modified problem is 35. But that is not the number of arrangements.Remember that the girls can be rearranged in 6 different ways for each of the 35 boys distribution. Thus there are 6 x 35 ways to distribute boys and permute the girls. Notice again that the boys themselves can be permuted. Since there are 6 boys, they can be permuted in 6!=720 ways. So the total number of permutation is 6 x 35 x 720 ways.

Solution to the original problem:

Now lets solve the original problem. The only difference is one of the boys is actually a pair of teachers. And for each arrangement of the modified problem we can swap the teachers to get a new arrangement. Thus we have to multiply the solution by 2.

Final Answer:

So the total number of arrangements is