The potential of each sphere consists of two points : one due to its own charge, and the other due to the charge on the other sphere. Using the principle of superposition, we have
`V_1 = V_(r_(1), "surface") + V_(r_(2), "inside")`
and `V_2 = V_(r_(1), "outside") + V_(r_(2), "surface")`
Hence,
`V_1 = (1)/(4 pi epsilon _0) q_(1)/r_(1) + (1)/(4 pi epsilon_0) q_(2)/r_(2)`
and `V_2 = (1)/(4 pi epsilon_0)q_(1)/r_(2)+(1)/(4 pi epsilon_0)q_(2)/r_(2)`.