The potential of each sphere consists of two points one due to its own charge and second due to the charge on the other sphere. Using the principle of superposition we have
`V_(1)=V_(r_(1surface))+V_(r_(2."inside"))`and
`V_(2)=V_(r_(1"outside"))+V_(r_(2surface))`
Hence `V_(1)=(1)/(4piepsilon_(0))(q_(1))/(r_(1))+(1)/(4piepsilon_(0))(q_(2))/(r_(2))`
and `V_(2)=(1)/(4piepsilon_(0))(q_(1))/(r_(2))+(1)/(4piepsilon_(0))(q_(2))/(r^(2))`