Q:

Gravitational potential of planets

How do you work out the gravitational potential of planets in the solar system? Do orbiting planets have gpe? And what would it be relative to? 
The equation I know for it is mgh. But what would the acceleration (g) be relative to? Should g take account of the accelerations due to all the planets? Do you just choose a random point? And what about h, which is some sort of distance - but which distance? I have read loads on google about gravitational potential, haven't found anything to answer this particular question though. 
The solar system for which I want to calculate the gpe is simplified to model planets as point masses, don't know if that matters. 

A:

The formula $U=mgh$ is simplified and assumes that you are near a planet's surface ($g$ itself is only valid near the Earth's surface). This sounds kind of like a homework problem, so I'll give you some hints. First, you need to pick an origin (usually the star at the center of the system is a good place). Now you need to figure out the forces acting on the planets. Since the problem is asking for gravitational potential energy, you know that you only need to consider gravitational forces. Identify the gravitational forces and then integrate the force along the paths in question to calculate the potential energy. Be sure to maintain the same coordinate system throughout!
Making an assumption about your situation: you might be able to neglect the planet to planet gravitational force if the central force is much larger (which it should be, but I don't know what your problem statement was) and just calculate the potential energy due to the interaction between the planet and the star. 
EDIT: I feel i can be more specific --
Gravity, when modeled as a central force (ie, Newtonian gravity) has a value of $F=-G\frac{Mm}{r^2}$, where the different m's are the masses of the two separate objects and r is the distance between them. To find the potential energy due to gravity, you essentially want to calculate the negative of the work done in order to "put" the planet where it is in orbit. Work is just the integral of force from where the potential is defined as 0. In this case, you would need to bring the planet in from $\infty$ where the force vanishes (approaches 0).
So, in math terms, $U=-\int_{\infty}^{r} -G\frac{Mm}{r^{\prime2}} dr^{\prime}=-G\frac{Mm}{r}$. This result is for one planet in relation to the sun, calculated assuming one dimension of force (which is valid for only 2 bodies). If you have more bodies that you want to account for (like other planets), then you need to complicate that expression to higher dimensions and add all the terms from the gravitational forces due to every object with the proper vectors in tact. Luckily, you can use superposition of forces for that so it's not all that messy, but would be a little much here (I think). In practical terms, the gravitational force from the star at the center of a solar system far outweighs that of the individual planets, that you can neglect those terms and come up with a very good approximation of the total gravitational potential.

