  We express the position of the Sun in the sky as a function of time and the
observer's geographic coordinates. Our method is based on applying rotation
matrices to vectors describing points on the celestial sphere. We also derive
direct expressions, as functions of date of the year and geographic latitude,
for the duration of daylight, the maximum and minimum altitudes of the Sun, and
the cardinal directions to sunrise and sunset. We discuss how to account for
the eccentricity of the earth's orbit, the precessions of the equinoxes and the
perihelion, the size of the solar disk, and atmospheric refraction. We
illustrate these results by computing the dates of "Manhattanhenge" (when
sunset aligns with the east-west streets on the main traffic grid for
Manhattan, in New York City), by plotting the altitude of the Sun over
representative cities as a function of time, and by showing plots ("analemmas")
for the position of the Sun in the sky at a given hour of the day.
