Does a star's emitted energy equal the work of its gravitational field? Based on the formula of this question, it is possible to estimate the difference of the Sun's gravitational potential energy now and after it becomes a white dwarf.
$$\Delta E = GM^2\left (\frac{1}{r_{wd}} - \frac{1}{r_{now}}\right)$$
Taking the final radius $r_{wd} = 0,008 r_{now}$, (based on data from Sirius B), $\Delta E = 6*10^{43}$J
Looking for data of total power of the Sun, I found $3,846 * 10^{26}$W, and its estimated life 5 billion years.
So, in a rough approximation if my arithmetic is right, the energy until the Sun becomes a white dwarf is $4,7 * 10^{43}$J.
It seems too close to be coincidence, so my question is: is it correct to assume that a star's emitted energy equals the work of the gravitational field in reducing its size?
Another related question: does the estimated data for the remaining lifetime use the energy potential equation ($\frac{GM^2}{r}$)? Or it is an independent calculation?
 A: No, a star's source of energy is nuclear reactions, not gravitational collapse. Lord Kelvin estimated the age of the sun on the assumption that its only source of energy was gravitational potential energy, and the lifetime came out to be much too short compared to what we now know is the age of the solar system.
A: The Sun has already been shining with more or less its current luminosity for the last 4.5 billion years and its radius has actually increased by about 10% since then. This demonstrates that the Sun is not powered by the release of gravitational potential energy.
The numerical similarity you have found is a coincidence. You could have done the same calculation at any point in the Sun's main sequence lifetime and got a similar answer for the gravitational potential energy, but a very different answer for the energy that would be radiated in the remaining main sequence lifetime.
You have also neglected the post-main sequence life, when the Sun will radiate far more energy than it did as a main sequence star.
