# A small doubt on calculation

Problem:

If the sum of the first $p$ terms of an arithmetic progression is $q$ and the sum of the first $q$ terms is $p$, then find the sum of $p+q$ terms.

For the problem we can write (considering $a$ is the first term and $d$ is the common difference):

$$\frac{p}{2}\cdot \biggl[2a + (p-1)d \biggr] = q \qquad \cdots (1)$$

$$\frac{q}{2}\cdot \biggl[2a + (q-1)d \biggr] = p \qquad \cdots (2)$$

Now in my module it is given that from these we can write $\displaystyle d= \frac{-2(p+q)}{pq}$; I am not getting how we can get that value of $d$ ?!

-

$q \times (1) - p \times (2)$ will give you $d$ and then you can work out $a.$
You get two equations in two unknowns $a,d$; solve them to find $d$. Since we only want to find $d$, we can equate the coefficient of $a$ by multiplying the first equation by $q$, the second by $p$, and subtracting to get a linear equation for $d$.