Sodium potassium balance in a cell
If potassium ions were alone inside and outside of the cell, they would be tended to diffuse along out of the cell due to high gradient inside. Because of potassium ions have positive charge, potassium lose would cause negativity inside. Within a few seconds, potential loss would rise enough to be able to stop potassium exit out of the cell. Because against decreasing concentration gradient, there would be reverse direction electrical gradient increase so these forces have to be balanced somewhere. For a large mammal nerve cell , needed potential gradient is about-94 millivolts.

We can assume similar concepts for sodium ions also. This time direction will be outer to inner side of cell. And this makes a positive potential (about +61 millivolts) due to gaining positive ions .

When we calculate total diffusion potential for only one ion, Nernst equation is used. For ions more than one we have to use Goldman equation, which is more complicated , instead. 
Goldman equation consists of three factors:


Electrical charge for each ions.
Permeability for each ions.
Concentrations inside and outside of the cell for each ions.




Major factor on this resting potential is membrane permeability. For potassium ions, membrane permeability is about 100 times more than sodium ions. Because potassium leakage channels makes potassium leakage more easier than sodium. When we put this factor on Golman equation, we find resting potential about-86 millivoltes which is closer to potassium diffusion potential.
(source:Wikipedia)
(source:KhanAcademy)