Basically, Potential= -GM/r
For planet N, it has a radius, a density, a mass and a volume which I have labelled as letters for short.
For Planet M, the radius is twice of N's radius.
To find out M's mass, do volume* density
You're told M has two times density of N.
To find out volume of M, do 4/3*pi*r^3, however, this time, your radius is 2r since M is twice of radius of N. This results in 8 times the volume
Mass of N = 8*2=16 due to mass=density *volume
Sub in the mass and radius into V= -GM/r
soz about the calculations, only read your comment later lol