It is well known that the formula for the sun path azimuth $\alpha_\text{s}$ (assuming that $\alpha_\text{s} = 0$ for noon) is

$$\alpha_\text{s}(\gamma_\text{s}) = \arccos \frac{\sin\gamma_\text{s} \, \sin{\varphi} - \sin \delta}{\cos\gamma_\text{s} \, \cos{\varphi}}$$

where $\varphi$ is latitude, $\delta$ is solar declination and $\gamma_\text{s}$ is sun path angle of elevation.

I wonder, is there a reverse formula, that is the formula that gives the angle of elevation from the azimuth, $\gamma_\text{s}(\alpha_\text{s})$?


2 Answers 2


Yes, there is a reverse formula giving the elevation in terms of the azimuth, declination, and latitude, but it's a bit messy, so I won't write it out fully.

That azimuth equation comes from the spherical trigonometry cosine law, as applied to the PZX navigational triangle.

I'll simplify your notation slightly, and use $A$ for the azimuth, and $\theta$ for the elevation (aka altitude) angle.

From the cos law, we have $$sin(\delta) = \sin\varphi\sin\theta + \cos\varphi\cos\theta\cos A$$

As shown in the question, that's easy to solve for $A$, but we have a little problem isolating $\theta$.

We have an equation of the form $$a\cos\theta + b\sin\theta = c$$ We know $a, b, c$ and want to find $\theta$. We can do that with the help of the Brahmagupta–Fibonacci identity.

Let $$r^2=a^2+b^2=c^2+d^2$$ We can easily find $d$ given $a,b,c$. Now $$\begin{align} r^4 & = (a^2+b^2)(c^2+d^2)\\ & = a^2c^2+b^2d^2 + b^2c^2+ a^2d^2\\ & = a^2c^2+b^2d^2 \pm 2abcd + b^2c^2+a^2d^2\mp 2abcd\\ r^4 & = (ac \pm bd)^2 + (bc \mp ad)^2\\ 1 & = \left(\frac{ac \pm bd}{r^2}\right)^2 + \left(\frac{bc \mp ad}{r^2}\right)^2\\ \end{align}$$

Let $\cos\theta = \frac{ac \pm bd}{r^2}$ and $\sin\theta = \frac{bc \mp ad}{r^2}$

Substituting those expressions into our original equation, $$(a^2c \pm abd + b^2c \mp adb) / r^2$$ $$= (a^2c + b^2c) / r^2 = c$$ So our expressions for $\cos\theta$ and $\sin\theta$ are valid. Also, $$\tan\theta = \frac{bc \mp ad}{ac \pm bd}$$

We now have everything we need to find $\theta$. We just have to choose the correct $\pm$ and $\mp$ to get it in the correct quadrant.

  • $\begingroup$ Thank you for the insightful answer. However, I will accept the alternative answer as it actually leads to simpler formulas. Nevertheless, your answer has helped me to understand and implement it. $\endgroup$
    – Pygmalion
    Commented Apr 15 at 16:50

The formula you provided is a straightforward solution of the spherical triangle with vertices at the North Pole, the location of the observer, and the geographical position of the Sun, using the law of cosines for spherical triangles. In that case you know three sides of the triangle and want to know one of the angles. The inverse formula is somewhat more complicated. You know two sides of the triangle and one angle, which is not the angle included between the known sides. For the first step, using the law of sines for spherical triangles find the angle at the geographical position of the Sun. Then, using one of Napier's Analogies, $$c = 2 \arctan\left[\frac{\tan\frac{a+b}{2}\cos\frac{A+B}{2}}{\cos\frac{A-B}{2}}\right],$$ and the elevation angle is $90^\circ - c$. Here $A$ and $B$ are the known angles, at the observer and at the Sun's geographical position, $a$ and $b$ are the opposite sides, $90^\circ$ minus observer's latitude, and $90^\circ$ minus the Sun's declination.

  • $\begingroup$ Your method was more straightforward than the alternative, but it took me a few hours to understand all the details. Let me just note that I had to use the "Tangent of Half Difference of Sides" instead of the "Tangent of Half Sum of Sides" you proposed (proofwiki.org/wiki/Napier%27s_Analogies). The reason for this is that the central azimuth must be assumed to be $180^\circ$ and the formula you proposed has a zero/zero type singularity around this value. $\endgroup$
    – Pygmalion
    Commented Apr 13 at 21:44
  • $\begingroup$ I think/thought that you could have derived the answer, yourself, and you could have. Your comment referred to a Wikipedia article. Me too. I frequently look to Wikipedia on Spherical Trigonometry for questions like yours, and for other lots of other things, I look to Wikipedia: almost daily. (Contributions are deductible in US - I contribute every year.) I've found that technical specs on Wikipedia are easier to access than those from manufacturers. They're all provided by the manufacturers, but Wikipedia has a format easier to use. $\endgroup$
    – stretch
    Commented Apr 13 at 23:12
  • $\begingroup$ Inverse trig formulas (formulae?) are double valued, and I think your comment on my answer says that. The Wikipedia article ( one of many) I used warns that there might be better choices. You found one. $\endgroup$
    – stretch
    Commented Apr 21 at 23:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .