*What was the distance of the Sun from Earth on May 22, 2002? How can I find this out for any given date of the year?*

This isn't a particularly hard calculation, but it will require some high school maths.

You need to know the equation for the ellipse of the Earth's orbit around the Sun, and the date at which the Earth is at perihelion (meaning the closest point to the Sun), and then you're set.

Perihelion is listed for the years 2000 through 2025 on this US Naval Observatory page. The orbit of the Earth around the Sun is an ellipse with semi-major axis of 149.6 million kilometres and an eccentricity of 0.017. Below is a diagram of an ellipse.

You can figure out the distance of the Earth from the Sun using the equation

r = a(1-e*e)/(1+e cos(θ))

where r is the distance from the Sun, a is the semi-major axis, e is the eccentricity and θ is the angle around from perihelion. These things are shown on the diagram above. The position of the Sun is at one focus of the ellipse, labelled 'F'. The symbol for the Greek letter theta is used (the O with a line through it).

We know a and e. The tricky thing here is linking theta with the time (and therefore the date). A good approximation is to assume that the Earth orbits at a constant angular rate, meaning that the time in days since perihelion is

time = θ*365.25/360.

(because there are 365.25 days in the year and it takes 360 degrees to go all the way round once).

This isn't quite true, because, as Kepler figured out in the 1600s planets orbit a little bit faster when they are near the Sun than when they are away from it. That makes relating theta with the time since perihelion a little bit trickier, but it can be done, and you can read about it here or in books on celestial mechanics if you are so inclined (note that theta has the technical name of "true anomaly" and is labeled "nu" in the discussion linked).

I actually did this small calculation and created a graph of the result which is shown below. Note that the distance is incorrectly labelled as being in millions of kilometres on the graph, when actually it is in hundreds of millions of kilometres.

May 22, 2002, was 140 days after the perihelion of January 2, 2002, meaning that the Sun was about 151.5 million kilometres away from the Sun (as you can read off the graph). The mean distance to the Sun is 149.6 million kilometres, so on May 22, 2002, the Earth was 1.3% further from the Sun than average. The maximum variation is about 1.5%, which (along with the graph) will tell you than May 22nd was fairly close to aphelion (the furthest point from the Sun).

You can use the graph above to find the distance to the Sun on any day of any year once you know how many days after the last perihelion that day was.

If you want to calculate distances more accurately, take a look at the following pages:

- Solar Position Algorithm (Reda & Andreas 2003), from the National Renewable Energy Laboratory: http://rredc.nrel.gov/solar/codesandalgorithms/spa/ (C code available here)
- Keplerian Elements for Approximate Positions of the Major Planets, from NASA/JPL Solar System Dynamics: http://ssd.jpl.nasa.gov/?planet_pos
- NASA/JPL HORIZONS system (provides tabulated values): http://ssd.jpl.nasa.gov/?horizons

*This page was last updated on May 25, 2016.*