Gravitational potential energy negative?

Can the gravitational potential energy be negative? $PE=mgh$, we kind of have the same fig as this (minus the car)!

and we choose the arbitrary point to be the G of the pendulum (point of stability) now $(O,k)$ is upwards but the book says $E_p=mgh$ and they choose $h$ to be positive?

my question is :the inverse pendulum is moving upwards but its still UNDER the arbitary point ($E_p=0$),why does the book say $E_p=mgh$ where $h$ is positive $h=\frac{L}{2}\theta°$!

• You can define a potential energy function in any way you like - as long as you stick with this choice. You choose the "zero" of your potential energy function. Commented May 31, 2014 at 18:26
• Make certain that you distinguish between the difference of potential energy and potential energy itself, because the latter has no physical significance. Commented May 31, 2014 at 18:39

In this particular example, it looks like the reference point is defined as the base of the inverted pendulum, where it attaches to the car (or ground, if the car isn't present in your version of the problem). $h$ is then the height above the car (ground). In this case, it's probably easiest to measure the height of the pendulum's bob in terms of that definition. But you could instead define your reference point to be the point of highest reach of the pendulum's bob. $h$ would then be measured as height above that point. Since all the points you're interested are below that point, $h$ would be negative for all points, and potential energy would always be negative. And that's okay; there's nothing inherently wrong with that. It just might be a bit harder to work with the resulting equations.
This is beyond the scope of this particular example, but $PE = mgh$ only works for systems near the surface of the earth, where $h$ is much smaller than the radius of the earth. If you have to work with distances that are similar in size to the radius of the earth, you have to use the full (Newtonian) form $PE = -GMm/r$, where I'm using $r$ to mean the distance between the object and the center of the earth. In cases where you have to use this form, the easiest reference is usually to define the potential energy to be zero when the object is infinitely far from the earth. In this case, all points a finite distance from the earth have a negative potential energy.