<p>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,
<span class="math-container">$$c = 2 \arctan\left[\frac{\tan\frac{a+b}{2}\cos\frac{A+B}{2}}{\cos\frac{A-B}{2}}\right],$$</span>
and the elevation angle is <span class="math-container">$90^\circ - c$</span>. Here <span class="math-container">$A$</span> and <span class="math-container">$B$</span> are the known angles, at the observer and at the Sun's geographical position, <span class="math-container">$a$</span> and <span class="math-container">$b$</span> are the opposite sides, <span class="math-container">$90^\circ$</span> minus observer's latitude, and <span class="math-container">$90^\circ$</span> minus the Sun's declination.</p>

CC BY-SA 4.0
2024-04-13T21:44:41.793Z
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 (https://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.
Pygmalion
CC BY-SA 4.0
2024-04-13T23:12:38.170Z
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.
stretch
CC BY-SA 4.0
2024-04-21T23:10:20.287Z
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.
stretch
CC BY-SA 4.0
2024-04-13T14:02:23.430Z
2024-04-16T20:12:03.570Z
2024-04-16T20:12:03.570Z
stretch
<p>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.</p>
<p>That azimuth equation comes from the spherical trigonometry <a href="https://en.wikipedia.org/wiki/Spherical_law_of_cosines" rel="noreferrer">cosine law</a>, as applied to the PZX <a href="https://en.wikipedia.org/wiki/Navigational_triangle" rel="noreferrer">navigational triangle</a>.</p>
<p>I'll simplify your notation slightly, and use <span class="math-container">$A$</span> for the azimuth, and <span class="math-container">$\theta$</span> for the elevation (aka altitude) angle.</p>
<p>From the cos law, we have
<span class="math-container">$$sin(\delta) = \sin\varphi\sin\theta + \cos\varphi\cos\theta\cos A$$</span></p>
<p>As shown in the question, that's easy to solve for <span class="math-container">$A$</span>, but we have a little problem isolating <span class="math-container">$\theta$</span>.</p>
<p>We have an equation of the form
<span class="math-container">$$a\cos\theta + b\sin\theta = c$$</span>
We know <span class="math-container">$a, b, c$</span> and want to find <span class="math-container">$\theta$</span>. We can do that with the help of the <a href="https://en.wikipedia.org/wiki/Brahmagupta%E2%80%93Fibonacci_identity" rel="noreferrer">Brahmagupta–Fibonacci identity</a>.</p>
<p>Let
<span class="math-container">$$r^2=a^2+b^2=c^2+d^2$$</span>
We can easily find <span class="math-container">$d$</span> given <span class="math-container">$a,b,c$</span>.
Now
<span class="math-container">$$\begin{align}
r^4 &amp; = (a^2+b^2)(c^2+d^2)\\
&amp; = a^2c^2+b^2d^2 + b^2c^2+ a^2d^2\\
&amp; = a^2c^2+b^2d^2 \pm 2abcd + 
b^2c^2+a^2d^2\mp 2abcd\\
r^4 &amp; = (ac \pm bd)^2 + (bc \mp ad)^2\\
1 &amp; = \left(\frac{ac \pm bd}{r^2}\right)^2 + \left(\frac{bc \mp ad}{r^2}\right)^2\\
\end{align}$$</span></p>
<p>Let
<span class="math-container">$\cos\theta = \frac{ac \pm bd}{r^2}$</span> and
<span class="math-container">$\sin\theta = \frac{bc \mp ad}{r^2}$</span></p>
<p>Substituting those expressions into our original equation,
<span class="math-container">$$(a^2c \pm abd + b^2c \mp adb) / r^2$$</span>
<span class="math-container">$$= (a^2c + b^2c) / r^2 = c$$</span>
So our expressions for <span class="math-container">$\cos\theta$</span> and <span class="math-container">$\sin\theta$</span> are valid.
Also,
<span class="math-container">$$\tan\theta = \frac{bc \mp ad}{ac \pm bd}$$</span></p>
<p>We now have everything we need to find <span class="math-container">$\theta$</span>. We just have to choose the correct <span class="math-container">$\pm$</span> and <span class="math-container">$\mp$</span> to get it in the correct quadrant.</p>

CC BY-SA 4.0
2024-04-15T16:50:02.250Z
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.
Pygmalion
CC BY-SA 4.0
2024-04-13T14:08:46.340Z
2024-04-13T14:14:14.707Z
2024-04-13T14:14:14.707Z
PM 2Ring
<p>It is well known that the formula for the sun path azimuth <span class="math-container">$\alpha_\text{s}$</span> (assuming that <span class="math-container">$\alpha_\text{s} = 0$</span> for noon) is</p>
<p><span class="math-container">$$\alpha_\text{s}(\gamma_\text{s}) = \arccos \frac{\sin\gamma_\text{s} \, \sin{\varphi} - \sin \delta}{\cos\gamma_\text{s} \, \cos{\varphi}}$$</span></p>
<p>where <span class="math-container">$\varphi$</span> is latitude, <span class="math-container">$\delta$</span> is solar declination and <span class="math-container">$\gamma_\text{s}$</span> is sun path angle of elevation.</p>
<p>I wonder, is there a reverse formula, that is the formula that gives the angle of elevation from the azimuth, <span class="math-container">$\gamma_\text{s}(\alpha_\text{s})$</span>?</p>

<the-sun>
The sun path angle of elevation
Pygmalion
# The sun path angle of elevation

(Asked by: username_0 on 2024-04-13)

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})$?

**Tags:** the-sun


---

## 2 answers

### Answer by username_1 on 2024-04-13. Score: 4 | Accepted answer

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.

> **Comments:**
> **username_0**: 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 (https://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.  
> **username_1**: 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.  
> **username_1**: 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.  

---

### Answer by username_2 on 2024-04-13. Score: 5

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](https://en.wikipedia.org/wiki/Spherical_law_of_cosines), as applied to the PZX [navigational triangle](https://en.wikipedia.org/wiki/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](https://en.wikipedia.org/wiki/Brahmagupta%E2%80%93Fibonacci_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.

> **Comments:**
> **username_0**: 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.  

---

