The sum of first n natural number is the triangular number.

1 + 2 + 3 + ... + n = (n * (n + 1)) / 2

Each yellow ball can be represented by corresponding two blue balls, so for every distinct pair of two blue balls selected you will get a unique yellow ball. Hence the number of ways of selecting two distinct numbers from 1...n is same as 1 + 2 + ... + (n-1)