There are 40 students in our class. How many ways they can be lined up such that two fixed students X and Y are next to each other (order of the two fixed students does not matter). Solution So now that X and Y are always beside each other, then you can treat them as just ONE PERSON. Thus, it\'s like there are now just 39 people to permute. As n! = number of ways to permute n objects in a line, then the number of ways is #ways = 39! = 2.03979*10^46 [ANSWER].