See Our New JEE Book on Amazon
The electric potential energy of two point charges $q_1$ and $q_2$ separated by a distance $r$ is given by \begin{align} U=\frac{1}{4\pi\epsilon_0}\frac{q_1 q_2}{r}. \end{align}
The electric potential energy of a system of point charges is obtained by algebraic addition of potential energy of each pair. Let there are $n$ point charges $q_1, q_2,\cdots, q_n$. The charge pair $(q_i,q_j)$ is separated by a distance $r_{ij}$. The electric potential energy of the system is given by \begin{align} U=\frac{1}{4\pi\epsilon_0}\sum_{i=1, i > j}^{n}\; \sum_{j=1}^{n} \frac{q_i q_j}{r_{ij}} \end{align} Note that charge pair ($q_i,q_j$) shall not be counted twice as ($q_i,q_j$) and ($q_j,q_i$). This is ensured by the condition $i > j$. There can be other ways to express the same.
Let us take three charges $q_1, q_2$ and $q_2$ with separations $r_{12}$, $r_{13}$ and $r_{23}$. Apply above formula to get the potential energy of a system of three point charges as \begin{align} U&=\frac{1}{4\pi\epsilon_0}\sum_{i=1, i > j}^{3} \sum_{j=1}^{3} \frac{q_i q_j}{r_{ij}} \nonumber\\ &=\frac{1}{4\pi\epsilon_0}\sum_{i=1, i > j}^{3} \left(\frac{q_i q_1}{r_{i1}} + \frac{q_i q_2}{r_{i2}} + \frac{q_i q_3}{r_{i3}} \right) \nonumber\\ &=\frac{1}{4\pi\epsilon_0}\left(\sum_{i=2}^{3} \frac{q_i q_1}{r_{i1}} + \sum_{i=3}^{3} \frac{q_i q_2}{r_{i2}}\right) \nonumber\\ &=\frac{1}{4\pi\epsilon_0} \left(\frac{q_2 q_1}{r_{21}} +\frac{q_3 q_1}{r_{31}} + \frac{q_3 q_2}{r_{32}} \right) \end{align}
Problem (IIT JEE 2002): Two equal point charges are fixed at $x=-a$ and $x=+a$ on the $x$-axis. Another point charge $Q$ is placed at the origin. The change in the electrical potential energy of $Q$, when it is displaced by a small distance $x$ along the $x$-axis, is approximately proportional to,
Solution: