Sum of p terms S1 = (p/2)[2a + (p-1)d]
Sum of q terms S2 = (q/2)[2a + (q-1)d]
Given S1 = S2. Solve the equations and find 2a =
Then put this value in the sum of p+q terms.
You could also use
for q>p
Then
Therefore the average must be zero, which is also the average of the first and last terms of this progression.
This causes the sum of p+q terms to be zero, since