We consider the arrangements by taking 2 particular balls together as one and hence the remaining 4 can be arranged in 4! = 24 ways. Again two particular balls taken together can be arranged in two ways. Therefore, there are 24 × 2 = 48 total ways of arrangement.
Among the 5! = 120 permutations of 5 balls, there are 48 in which two balls are together. In the remaining 120 – 48 = 72 permutations, two particular balls are never together.