# Solar Azimuth angle Derivation

I tried posting this on math stack exchange to no avail so I thought maybe it's more relevant here :

I know a similar question has been posted here before but no links to any mathematical derivations given on the following post. I was not able to access the citations on the wiki page either.

How do I calculate the sun's azimuth based on zenith, hour angle, declination, and latitude?

I was recently trying to derive the position of the Sun in the sky given the latitude, time of year and time of day.

I used the following definitions:

$$\phi :$$ I used this to denote the angle of latitude, as per convention

$$t:$$ I used this to denote the angle of the year completed since Summer solstice

$$\theta:$$ I used this to denote the angle of the day completed since solar noon

$$\Omega:$$ I used this to denote the solar zenith angle.

$$\Gamma:$$ I used this to denote the azimuth of the Sun clockwise from due North

$$k:$$ I used this to denote the angle of 66.56 degrees between the Earth's axis and plane of revolution

$$\lambda:$$ I used this to denote the angle between the Earth's axis and the vector in the direction of the sun, this is complementary to the more commonly used declination angle $$\delta$$

My goal was to get a function $$f(\phi, t, k,\theta)=\Omega,\Gamma$$

I was able (with some help) to derive the following formulae:

$$\cos(\lambda)= \cos(t)*\cos(k)$$

$$\cos(\Omega)=\cos(\lambda)*\sin(\phi)+\cos(\phi)*\sin(\lambda)*\cos(\theta)$$

However, I was not able to then derive the formula given on the following Wikipedia page for $$\Gamma=f(\theta,\lambda,\Omega)$$ which I have transcribed into my variables below:

https://en.wikipedia.org/wiki/Solar_azimuth_angle

$$\sin(\Gamma)=-\dfrac{(\sin(\theta)*\sin(\lambda))}{\sin(\Omega)}$$

I think in order to derive this I need to convert to a local co-ordinate system with due North along the y-axis, due East along the x-axis and zenith along the z-axis.

Can someone help me to proceed?

Have a look at https://www.pveducation.org, specifically section 2.4 on Terrestrial Solar Radiation. It describes the equations required and has some online calculators and interactive plots.

If you wish to calculate in your own code, I'd recommend the pysolar Python package: https://pysolar.readthedocs.io/en/latest/. It has methods for taking the latitude, longitude and time of day to calculate the Sun's azimuth and altitude.

• Thanks, but I was looking for a nice derivation, I already have the intuition for the problem. I made an excel spreadsheet and was able to use dot products to solve the problem of finding the azimuth but couldn't really cleanly derive the formula in a mathematically elegant way. – aman Mar 14 at 10:01

What I think you're trying to do is workable, but approximate. You first find the Sun's geographical position (GP), the point on the Earth where the Sun is in zenith at the time of the observation. You start by finding the Sun's GP latitude (its declination). It's approximately 23 degrees times the sine of ((days since the vernal equinox)times 360/365). Then you find its longitude as the ((hours since local apparent noon)times(15 degrees) + observer's west longitude). You will have three points, vertices of a spherical triangle: observer's location, Sun's GP, and the north pole. The angle at the pole is the difference between the longitudes of the Sun's GP and the observer. The sides between the pole and the other two points are 90 degrees minus their latitudes. All that's needed to solve a spherical triangle is the arc length of two sides and their included angle. Using the law of cosines for spherical triangles, find the arc distance between the observer and the Sun's GP. The altitude of the sun will be 90 degrees minus that number. Find the angle at the observer using the law of sines for spherical triangles. That will be the Sun's azimuth.

• Just to be clear, by North Pole you mean the actual North Pole of Earth correct? – aman Mar 13 at 15:07
• Yes. The south pole would work as well. – stretch Mar 13 at 17:41
• Unfotunately, I don't really have an understanding of spherical geometry, I was able to solve it using vectors though. – aman Mar 14 at 9:59
• There's not much to understand about spherical trigonometry. There are only two equations for most problems. There are online calculators that will immediately return the third side and the other two angles if given two sides and their included angle. The only tricky part is that answers come from inverse trigonometric functions no matter how you do the calculation, and give you one of two possible answers. You need to calculate the other answer and decide which is correct. Your expressions for azimuth and zenith angle also have that problem, you probably know. – stretch Mar 14 at 12:30
• Although Wikipedia is generally not a good place to learn new mathematics, en.wikipedia.org/wiki/Spherical_trigonometry isn't too bad, if you're already comfortable with plane trig and vectors. – PM 2Ring Mar 15 at 8:59