The gravitational field Eg along x−axis, due to some distribution of mass is Eg=kx3. If the gravitational potential is taken as zero at infinity, then its value at a position x is
Eg=kx3
Since, Eg=−dVgdx
So Vg=−∫∞rEgdx=−∫∞rkx3dx
Vg=−(1∞−k2r2)
Vg=k2r2
putting r=x
Vg=k2x2