system
Given the following post, respond as if you're commenting on Reddit:
human
Acceleration due to gravity and density of a mass

I am in physics class and we just derived the value of 'g' based on Newton's Law of Universal Gravitation, but I know I've been told that black holes have a large amount of gravity because of their mass and density.  I though that density played a factor in determining 'g' but the formula we derived is g= (mass/distance^2 )*Gravitational Constant  

Is this an incomplete formula or does density not play a role in this?  I guess, because the black holes will have so much mass that it is almost incalculable that density shouldn't matter much, but what if a heavenly body had an equal amount of mass, but it was spread over a far larger area, like a nebula or a star?
gpt
It is included, as distance. Think of it this way, imagine that you tried to go closer to the Earth's center. Would g increase? No, because as you travel closer, you go under ground, and more and more of earths mass is now no longer below you, but "above" you, so to speak.

Now imagine that we squeeze Earth, decreasing its radius, increasing its density. The more you squeeze it, the greater its density, and consequently, the smaller the distance from its center you are able to be. Eventually, if we reduced the radius of Earth enough, while maintaining its mass, g would be so large that not even light could escape the surface, and we would have a black hole.