User:Sagie/sandbox/Trigo

Angle sum and difference identities
$$\sin(\alpha \pm \beta) = \sin \alpha \cos \beta \pm \cos \alpha \sin \beta$$

$$\cos(\alpha \pm \beta) = \cos \alpha \cos \beta \mp \sin \alpha \sin \beta$$

$$\tan(\alpha \pm \beta) = \frac{\tan \alpha \pm \tan \beta}{1 \mp \tan \alpha \tan \beta}$$

$$\tan\left( \frac{\alpha+\beta}{2} \right) = \frac{\sin\alpha + \sin\beta}{\cos\alpha + \cos\beta} = -\,\frac{\cos\alpha - \cos\beta}{\sin\alpha - \sin\beta}$$

$$\arctan\alpha \pm \arctan\beta = \arctan\left(\frac{\alpha \pm \beta}{1 \mp \alpha\beta}\right)$$

$$\arcsin\alpha \pm \arcsin\beta = \arcsin\left(\alpha\sqrt{1-\beta^2} \pm \beta\sqrt{1-\alpha^2}\right)$$

$$\arccos\alpha \pm \arccos\beta = \arccos\left(\alpha\beta \mp \sqrt{(1-\alpha^2)(1-\beta^2)}\right)$$

Sine, cosine, and tangent of multiple angles
$$\cos n\theta +j\sin n\theta=(\cos(\theta)+j\sin(\theta))^n$$

$$\tan\,(n{+}1)\theta = \frac{\tan n\theta + \tan \theta}{1 - \tan n\theta\,\tan \theta}$$

$$\cot\,(n{+}1)\theta = \frac{\cot n\theta\,\cot \theta - 1}{\cot n\theta + \cot \theta}$$

$$\cos nx = 2 \cdot \cos x \cdot \cos ((n-1) x) - \cos ((n-2) x)$$

$$\sin nx = 2 \cdot \cos x \cdot \sin ((n-1) x) - \sin ((n-2) x)$$

$$\sin n\theta = \sum_{k=0}^n \binom{n}{k} \cos^k \theta\,\sin^{n-k} \theta\,\sin\left(\frac{1}{2}(n-k)\pi\right)$$

$$\cos n\theta = \sum_{k=0}^n \binom{n}{k} \cos^k \theta\,\sin^{n-k} \theta\,\cos\left(\frac{1}{2}(n-k)\pi\right)$$

Linear combinations
0 & \text{if } a + b\cos \alpha \ge 0 \\ \pi & \text{if } a + b\cos \alpha < 0 \end{cases}.$$
 * $$a\sin x+b\cos x=c\cdot\sin(x+\varphi)=c\cdot\cos(x+\varphi-\pi/2)\,$$, where $$c = \sqrt{a^2 + b^2}$$ and $$\varphi = \operatorname{atan2} \left( b, a \right)$$.
 * $$a\sin x+b\sin(x+\alpha)= c \sin(x+\beta)\, \text{, where }c = \sqrt{a^2 + b^2 + 2ab\cos \alpha}\, \text{ and } \beta = \arctan \left(\frac{b\sin \alpha}{a + b\cos \alpha}\right) + \begin{cases}
 * $$\sum_i a_i \sin(x+\delta_i)= a \sin(x+\delta)\,$$, where $$a^2=\sum_{i,j}a_i a_j \cos(\delta_i-\delta_j)$$ and $$\tan \delta=\frac{\sum_i a_i \sin\delta_i}{\sum_i a_i \cos\delta_i}$$.

Other sums of trigonometric functions
= \sin\left(\left(n +\frac{1}{2}\right)x\right) \Big/ \sin(x/2).$$
 * $$\text{Lagrange identities: }\sum_{n=1}^N \sin n\theta = \frac{1}{2}\cot\frac{\theta}{2}-\frac{\cos(N+\frac{1}{2})\theta}{2\sin\frac{1}{2}\theta}\text{ and }\sum_{n=1}^N \cos n\theta = -\frac{1}{2}+\frac{\sin(N+\frac{1}{2})\theta}{2\sin\frac{1}{2}\theta}.$$
 * $$\text{Dirichlet kernel: } 1+2\cos(x) + 2\cos(2x) + 2\cos(3x) + \cdots + 2\cos(nx)
 * $$\text{If }\alpha\ne0\text{, then}\sin{\varphi} + \sin{(\varphi + \alpha)} + \sin{(\varphi + 2\alpha)} + \cdots + \sin{(\varphi + n\alpha)} = \sin\left(\frac{(n+1) \alpha}{2}\right) \cdot \sin\left(\varphi + \frac{n \alpha}{2}\right) \Big/ \sin{\frac{\alpha}{2}}.$$
 * $$\text{If }\alpha\ne0\text{, then}\cos{\varphi} + \cos{(\varphi + \alpha)} + \cos{(\varphi + 2\alpha)} + \cdots + \cos{(\varphi + n\alpha)} = \sin\left(\frac{(n+1) \alpha}{2}\right) \cdot \cos\left(\varphi + \frac{n \alpha}{2}\right) \Big/ \sin{\frac{\alpha}{2}}.$$

Inverse trigonometric functions
$$\begin{align} \arcsin(x)+\arccos(x) &=\pi/2 \\ \arctan(x)+\arccot(x) &=\pi/2 \\ \arctan(x)+\arctan(1/x) &=\left\{\begin{matrix} \pi/2, & \mbox{if }x > 0 \\ -\pi/2, & \mbox{if }x < 0 \end{matrix}\right. \\ \end{align}$$

$$\quad\begin{align} \sin[\arccos(x)] &=\sqrt{1-x^2} \\ \sin[\arctan(x)] &=\frac{x}{\sqrt{1+x^2}} \\ \cos[\arctan(x)] &=\frac{1}{\sqrt{1+x^2}} \\ \cos[\arcsin(x)] &=\sqrt{1-x^2} \\ \end{align}$$

$$\quad\begin{align} \tan[\arcsin (x)] &=\frac{x}{\sqrt{1 - x^2}} \\ \tan[\arccos (x)] &=\frac{\sqrt{1 - x^2}}{x} \\ \cot[\arcsin (x)] &=\frac{\sqrt{1 - x^2}}{x} \\ \cot[\arccos (x)] &=\frac{x}{\sqrt{1 - x^2}} \\ \end{align}$$

Complex exponentials
$$ e^{i\theta} = \operatorname{cis} \, \theta = \cos\theta + i\sin\theta\,$$

$$\sin \theta = \frac{e^{i\theta} - e^{-i\theta}}{2i} \,$$

$$\cos \theta = \frac{e^{i\theta} + e^{-i\theta}}{2} \,$$

$$\sec \theta = \frac{2}{e^{i\theta} + e^{-i\theta}} \,$$

$$\csc \theta = \frac{2i}{e^{i\theta} - e^{-i\theta}} \,$$

$$e^{i\pi/2} = i \quad\ \vert\ \quad i^2 = e^{i\pi} = -1 \quad\ \vert\ \quad e^{2\pi i} = 1$$ $$ e^{-i\theta} = \cos(-\theta) + i\sin(-\theta) = \cos(\theta) - i\sin(\theta)$$

$$\arcsin x = -i \ln \left(ix + \sqrt{1 - x^2}\right) \,$$

$$\arccos x = i\,\ln\left(x-i\,\sqrt{1-x^2}\right) \,$$

$$\arcsec x = -i \ln \left(\tfrac{1}{x} + \sqrt{1 - \tfrac{i}{x^2}}\right) \,$$

$$\arccsc x = -i \ln \left(\tfrac{i}{x} + \sqrt{1 - \tfrac{1}{x^2}}\right) \,$$

$$\operatorname{arccis} \, x = \frac{\ln x}{i} = -i \ln x = \operatorname{arg} \, x \,$$

$$\tan \theta = \frac{e^{i\theta} - e^{-i\theta}}{i(e^{i\theta} + e^{-i\theta})} \,$$

$$\cot \theta = \frac{i(e^{i\theta} + e^{-i\theta})}{e^{i\theta} - e^{-i\theta}} \,$$

$$\arctan x = \frac{i}{2} \ln \left(\frac{i + x}{i - x}\right) \,$$

$$\arccot x = \frac{i}{2} \ln \left(\frac{x - i}{x + i}\right) \,$$

Infinite product formulae
$$\sin x = x \prod_{n = 1}^\infty\left(1 - \frac{x^2}{\pi^2 n^2}\right)$$

$$\sinh x = x \prod_{n = 1}^\infty\left(1 + \frac{x^2}{\pi^2 n^2}\right)$$

$$\cos x = \prod_{n = 1}^\infty\left(1 - \frac{x^2}{\pi^2(n - \frac{1}{2})^2}\right)$$

$$\cosh x = \prod_{n = 1}^\infty\left(1 + \frac{x^2}{\pi^2(n - \frac{1}{2})^2}\right)$$

$$\frac{\sin x}{x} = \prod_{n = 1}^\infty\cos\left(\frac{x}{2^n}\right)$$

$$|\sin x| = \frac1{2}\prod_{n = 0}^\infty \sqrt[2^{n+1}]{\left|\tan\left(2^n x\right)\right|}$$

Limits
$$\lim_{x\rightarrow 0}\frac{\sin x}{x}=1$$

$$\lim_{x\rightarrow 0}\frac{1-\cos x }{x}=0$$

Derivatives
$${\mathrm{d} \over \mathrm{d}x} \sin x = \cos x$$

$${\mathrm{d} \over \mathrm{d}x} \cos x = -\sin x$$

$${\mathrm{d} \over \mathrm{d}x} \arcsin x = {1 \over \sqrt{1 - x^2}}$$

$${\mathrm{d} \over \mathrm{d}x} \arccos x = {-1 \over \sqrt{1 - x^2}}$$

$${\mathrm{d} \over \mathrm{d}x} \tan x = \sec^2 x $$

$${\mathrm{d} \over \mathrm{d}x} \cot x = -\csc^2 x$$

$${\mathrm{d} \over \mathrm{d}x} \arctan x = { 1 \over 1 + x^2}$$

$${\mathrm{d} \over \mathrm{d}x} \arccot x = {-1 \over 1 + x^2}$$

$${\mathrm{d} \over \mathrm{d}x} \sec x = \tan x \sec x$$

$${\mathrm{d} \over \mathrm{d}x} \csc x = -\csc x \cot x$$

$${\mathrm{d} \over \mathrm{d}x} \arcsec x = { 1 \over |x|\sqrt{x^2 - 1}}$$

$${\mathrm{d} \over \mathrm{d}x} \arccsc x = {-1 \over |x|\sqrt{x^2 - 1}}$$

Integrals
$$\int \frac{\mathrm{d}u}{\sqrt{a^2-u^2}} =\sin^{-1}\left( \frac{u}{a} \right)+C$$

$$\int \frac{\mathrm{d}u}{a^2+u^2} =\frac{1}{a}\tan ^{-1}\left( \frac{u}{a} \right)+C$$

$$\int \frac{\mathrm{d}u}{u\sqrt{u^2-a^2}} =\frac{1}{a}\sec ^{-1}\left| \frac{u}{a} \right|+C$$

Tangent half-angle substitution
$$t \triangleq \tan\frac{x}{2}.$$

$$\sin x = \frac{2t}{1 + t^2}$$

$$\cos x = \frac{1 - t^2}{1 + t^2}$$

$$e^{i x} = \frac{1 + i t}{1 - i t}$$

$$\mathrm{d}x = \frac{2 \,\mathrm{d}t}{1 + t^2}$$

Phasor arithmetic
= \operatorname{Re}\{A e^{i\theta} \cdot i\omega e^{i\omega t}\} = \operatorname{Re}\{\omega A e^{i(\theta + \pi/2)} \cdot e^{i\omega t}\} = \omega A\cdot \cos(\omega t + \theta + \pi/2)$$ $$ where: $$A_3^2 = (A_1 \cos\theta_1 + A_2 \cos \theta_2)^2 + (A_1 \sin\theta_1 + A_2 \sin\theta_2)^2 = A_1^2 + A_2^2 + 2 A_1 A_2 \cos(\theta_1 - \theta_2)$$ and $$\theta_3 = \arctan\left(\frac{A_1 \sin\theta_1 + A_2 \sin\theta_2}{A_1 \cos\theta_1 + A_2 \cos\theta_2}\right)$$.
 * Definition: $$A\cdot \cos(\omega t + \theta) = \frac A 2 \cdot (e^{i(\omega t + \theta)} + e^{-i(\omega t + \theta)}) = \operatorname{Re} \left\{ A\cdot e^{i(\omega t + \theta)}\right\} = \operatorname{Re} \left\{ A e^{i\theta} \cdot e^{i\omega t}\right\}$$
 * $$[\text{Phasor}] \cdot [\text{complex const}]: \ \operatorname{Re}\{(A e^{i\theta} \cdot e^{i\omega t})\cdot B e^{i\phi} \}= \operatorname{Re}\{(AB e^{i(\theta+\phi)})\cdot e^{i\omega t} \} = AB \cos(\omega t +(\theta+\phi))$$
 * Derivative: $$\operatorname{Re}\left\{\frac{d}{d t}(A e^{i\theta} \cdot e^{i\omega t})\right\}
 * $$A_1 \cos(\omega t + \theta_1) + A_2 \cos(\omega t + \theta_2) = \operatorname{Re} \{A_1 e^{i\theta_1}e^{i\omega t}\} + \operatorname{Re} \{A_2 e^{i\theta_2}e^{i\omega t}\} = \operatorname{Re} \{(A_3 e^{i\theta_3})e^{i\omega t}\} = A_3 \cos(\omega t + \theta_3),