# Explanation of formula given on Wikipedia (for sign in half-angle formula for sine)

This Wikipedia article listing trigonometric identities, states the following identity under half angles: $$\sin{\frac{\theta}{2}} = \text{sgn}\bigg(2\pi-\theta+4\pi\bigg\lfloor\frac{\theta}{4\pi}\bigg\rfloor \bigg)\sqrt{\frac{1-\cos{\theta}}{2}}$$ where $$\text{sgn}(x)$$ is a function that returns $$+1$$ if $$x>0$$ and $$-1$$ if $$x<0$$.

I know and understand the part of the formula that says $$\sqrt{\frac{1-\cos{\theta}}{2}}$$ and understand the fact that the remaining part is to decide the $$\pm$$ sign in the formula. From where, however, does the sign-deciding part of the expression come from? And why should it make sense?

• The sign thing is just a shorthand to express that the value is positive when $\theta \in [4k\pi, (4k+2)\pi]$ for some integer $k$, and negative otherwise. It's just a notation trick, not something derived from anywhere. – user3733558 Apr 4 at 8:29
• @user3733558 Why $4\pi$, though? – soupless Apr 4 at 8:34
• @user3733558 Won't any $\theta$ lie in that range? (put $k=0$ and the range becomes $[0, 2\pi]$) Edit: I understand what you are saying now. But I still do not understand how the notational trick incorporates the same. – Aadi Prasad Apr 4 at 8:39
• Thanks @AadiPrasad, and a last note (because I feel the tone of my comments and answers don't reflect it): I want to applaud your curiosity, and your questioning of details like this one. That's a proper attitude towards anything mathematical. Well done. – user3733558 Apr 4 at 9:06
• Thank you very much to you too, @user3733558. And no, your answer or your comments do not reflect the 'it is how it is' tone at all. Not everything has to have a very profound explanation. – Aadi Prasad Apr 4 at 10:26

I imagine it happened this way. In the past, someone saw $$\sin \frac{\theta}{2} = \pm \sqrt{\frac{1-\cos{\theta}}{2}}$$ and thought "Wait a minute, this isn't really satisfactory. There shouldn't be uncertainties here. We know what sign the expression should be for a given $$\theta$$". And indeed, $$\sin \frac{\theta}{2} \geqslant 0 \text{ for } 0 \leqslant \theta \leqslant 2\pi \\ \sin \frac{\theta}{2} \leqslant 0 \text{ for } 2\pi \leqslant \theta \leqslant 4\pi$$ and this pattern is periodic of period $$4\pi$$. So that someone sat down and thought "What function can I cook up that would give me $$+1$$ for inputs in $$[0,2\pi]$$ and $$-1$$ for inputs in $$[2\pi,4\pi]$$, and would also be $$4\pi$$ periodic?". And he found the expression you can see on Wikipedia.

This is not the only way to achieve the same goal. This is not a forced (derived) result. This is an artificial invention, made to achieve a specific goal, and it works. But don't look for a deeper meaning behind it, there isn't any.

Personally, I would go with $$(-1)^{\left\lfloor\frac\theta{2\pi}\right\rfloor}=\left\{\begin{array}{rl}1&\text{when }\frac\theta{2\pi}\in[0,1)\pmod{2}\\-1&\text{when }\frac\theta{2\pi}\in[1,2)\pmod{2}\end{array}\right.\tag1$$ However, what was done on Wikipedia was to create a sawtooth wave, which again, I would give as $$\frac12-\left\{\frac\theta{4\pi}\right\}\left\{\begin{array}{}\gt0&\text{when }\frac\theta{4\pi}\in\left(0,\frac12\right)\pmod{1}\\\lt0&\text{when }\frac\theta{4\pi}\in\left(\frac12,1\right)\pmod{1}\end{array}\right.\tag2$$ However, since $$\{x\}=x-\lfloor x\rfloor$$, $$(2)$$ can be written as $$\frac12-\left\{\frac\theta{4\pi}\right\}=\frac12-\left(\frac\theta{4\pi}-\left\lfloor\frac\theta{4\pi}\right\rfloor\right)\tag3$$

Note that all three functions have the same sign; negative in the gray regions and positive in the white regions.

The sign in $$(3)$$ is preserved upon multiplication by $$4\pi$$: $$2\pi-\theta+4\pi\left\lfloor\frac\theta{4\pi}\right\rfloor\tag5$$ which has the same sign as $$(2)$$ and is what appears in Wikipedia.

• Can you elaborate a bit more? How did you come up with $(1)$, or $(2)$? All of it just looks Greek to me. – Aadi Prasad Apr 5 at 3:20
• Ok. We need to establish some context. Have you encountered the floor function, $\lfloor x\rfloor$? $\{x\}$ is the (periodic) fractional part function, defined as $x-\lfloor x\rfloor$. It goes from $0$ to just less than $1$ as $x$ goes from $n$ to just less than $n+1$ for $n\in\mathbb{Z}$. – robjohn Apr 5 at 4:25
• I know all the definitions you mention. But why would you 'go with $(1)$'? From the way it is written, it seems as if equation $(1)$ should be as obvious and natural as $2+2 = 4$ is. It isn't so to me. (I am a high schooler who will be learning (single variable) calculus this year.) – Aadi Prasad Apr 5 at 10:37
• Look at $\left\lfloor\frac\theta{2\pi}\right\rfloor$. It jumps up $1$ every $2\pi$. That means it goes from even ($0$) on $[0,2\pi)$, to odd ($1$) on $[2\pi,4\pi)$, to even ($2$) on $[4\pi,6\pi)$, and so on. Thus, $(-1)^\left\lfloor\frac\theta{2\pi}\right\rfloor$ goes from $1$ on $[0,2\pi)$ to $-1$ on $[2\pi,4\pi)$, to $1$ on $[4\pi,6\pi)$. This is the same pattern as the sign of $\sin\left(\frac\theta2\right)$ (see the graph). – robjohn Apr 5 at 12:54
• Ooh! Now I get it — both, $(1)$ and $(2)$. Thanks a lot! – Aadi Prasad Apr 6 at 9:19

The function inside the $$\operatorname{sgn}$$ function has zeroes only when:

$$\theta=2\pi \pm 4k\pi$$

and the sign alternates between them, which gives the same pattern as the $$\sin\frac{\theta}{2}$$ function.

It is from the process of deriving the identity itself.

First, let us use the double-angle formula $$\cos2\theta = 2\cos^{2}\theta - 1$$. Solving for $$\cos^{2}\theta$$, we get $$\cos^{2}\theta = \frac{1 + \cos 2\theta}{2}.$$

Replacing $$\theta$$ by $$\frac{\theta}{2}$$, we get \begin{align*}\cos^{2}\left(\frac{\theta}{2}\right) &= \frac{1 + \cos\theta}{2} \\ \cos\left(\frac{\theta}{2}\right) &= \pm\sqrt{\frac{1 + \cos\theta}{2}}\end{align*}

Using the identity $$\sin^{2}\theta + \cos^{2}\theta = 1$$ to get $$\sin \frac{\theta}{2}$$, \begin{align*}\sin^{2}\left(\frac{\theta}{2}\right) + \cos^{2}\left(\frac{\theta}{2}\right) &= 1 \\ \sin^{2}\left(\frac{\theta}{2}\right) + \frac{1 + \cos\theta}{2} &= 1 \\ \sin^{2}\left(\frac{\theta}{2}\right) &= 1 - \frac{1 + \cos\theta}{2} \\ \sin^{2}\left(\frac{\theta}{2}\right) &= \frac{2 - 1 - \cos\theta}{2} \\ \sin^{2}\left(\frac{\theta}{2}\right) &= \frac{1 - \cos\theta}{2} \\ \sin\left(\frac{\theta}{2}\right) &= \pm\sqrt{\frac{1 - \cos\theta}{2}}\end{align*}

As you can see, the squares on the equation force it to take the plus-minus sign.

Edit: I don't have an idea about the $$\displaystyle \mathrm{sgn}\left(2\pi - \theta + 4\pi\left\lfloor\frac{\theta}{4\pi}\right\rfloor\right)$$. I just used the basic ones.

• Thank you very much for writing out the entire derivation. But I am already aware of it — the issue I have is with what is inside the $\text{sgn}$ function. – Aadi Prasad Apr 4 at 8:32