What is the mathematical equation used to calculate the distance between earth and the sun at any given day of the year?
The Earth's orbit is elliptical and the distance
Kepler's law gives a fairly good approximation to the Earth's orbit. In actual fact the Earth's orbit is not a true ellipse as it constantly being changed by the gravitational pull of the other planets.
If you want a really accurate value you need to use numerical integration data such as NASA's DE430 data. This data consists of a large number of coefficients for a series of polynomial equations which have been derived from observations and satellite data.