[ home ] [ math / cs / ai / phy / as / chem / bio / geo ] [ civ / aero / mech / ee / hdl / os / dev / web / app / sys / net / sec ] [ med / fin / psy / soc / his / lit / lin / phi / arch ] [ off / vg / jp / 2hu / tc / ts / adv / hr / meta / tex ] [ chat ] [ wiki ]

/math/ - Mathematics


Name
Email
Subject
Comment
Verification
Instructions:
  • Press the Get Captcha button to get a new captcha
  • Find the correct answer and type the key in TYPE CAPTCHA HERE
  • Press the Publish button to make a post
  • Incorrect answer to the captcha will result in an immediate ban.
File
Password (For file deletion.)

25 Dec 2021Mathchan is launched into public

12 / 3 / 4 / ?

File: r_triangle_1.jpg ( 4.38 KB , 242x208 , 1655398539385.jpg )

Image
Trigonometric functions are used to relate the angles of a right triangle to its sides.

sin(angle)=oppositehypotenusecos(angle)=adjacenthypotenusetan(angle)=sin(angle)cos(angle)=oppositeadjacent\qquad \sin(\text{angle}) = \frac{\text{opposite}}{\text{hypotenuse}}\quad\cos(\text{angle}) =\frac{\text{adjacent}}{\text{hypotenuse}}\quad\tan(\text{angle}) = \frac{\sin(\text{angle})}{\cos(\text{angle})} = \frac{\text{opposite}}{\text{adjacent}}\quad


With respect to any of the two angles
α\alpha
or
β\beta
(the third angle of a right triangle is, of course,
90o90^\text{o}
thereofre it's irrelevant) three sides can be identified with the following names: hypotenuse, opposite and adjacent. The hypotenuse is easy to identify and it's the longest i.e.
cc
. The adjacent side is the one that's "touching" the angle; for angle
α\alpha
that would be
bb
, while for angle
β\beta
that would be
aa
. The opposite side is the one that's NOT "touching" the angle; for angle
α\alpha
that would be
aa
, while for angle
β\beta
that would be
bb
.

Therefore, the complete set of trigonometric functions for the triangle in the pic related is:

sin(α)=accos(α)=bctan(α)=ab\qquad \sin(\alpha) = \frac{a}{c}\quad \cos(\alpha) = \frac{b}{c}\quad \tan(\alpha) = \frac{a}{b}


sin(β)=bccos(β)=actan(β)=ba\qquad \sin(\beta) = \frac{b}{c}\quad \cos(\beta) = \frac{a}{c}\quad \tan(\beta) = \frac{b}{a}



Thus, just knowing the angle
α\alpha
allows conversion of any side to any other side:
aa
bb
cc
a=a=
aa
btan(α)b\tan(\alpha)
csin(α)c\sin(\alpha)
b=b=
atan(α)\frac{a}{\tan(\alpha)}
bb
ccos(α)c\cos(\alpha)
c=c=
asin(α)\frac{a}{\sin(\alpha)}
bcos(α)\frac{b}{\cos(\alpha)}
cc

And similarly, just knowing the angle
β\beta
also allows conversion of any side to any other side:
aa
bb
cc
a=a=
aa
btan(β)\frac{b}{\tan(\beta)}
ccos(β)c\cos(\beta)
b=b=
atan(β)a\tan(\beta)
bb
csin(β)c\sin(\beta)
c=c=
acos(β)\frac{a}{\cos(\beta)}
bsin(β)\frac{b}{\sin(\beta)}
cc

Intuition behind this is straightforward: For angles of a triangle, sine and cosine are bounded functions between zero and one.
(0sin(x)1,  0cos(x)1)(0 \leq \sin(x)\leq 1,\; 0\leq \cos(x) \leq1)
. Multiplying something with these functions should produce a smaller or equal value, while dividing something with these functions should produce a larger or equal value. Since hypotenuse is the longest, multiplying it with sine or cosine will "reduce" it to a leg. Similarly, dividing a leg by sine or cosine will "grow" it into a hypotenuse. A leg can be converted to another leg by "growing" it into a hypotenuse first, then "reducing" it to another leg which effectively is the same as multiplying the leg with a tangent value of the angle that the leg opposes.
>>
Dividing both sides of Pythagorean theorem
a2+b2=c2a^2 + b^2 = c^2
with
c2c^2
a fundamental trigonometric identity is obtained

sin2(α)+cos2(α)=1\qquad \sin^2(\alpha) + \cos^2(\alpha) = 1


Solving equation invarious ways produces conversion formulas

sin(α)=1cos2(α)=tan(x)tan2(x)+1\qquad |\sin(\alpha)| = \sqrt{1 - \cos^2(\alpha)} = \frac{\tan(x)}{\sqrt{\tan^2(x) + 1}}


cos(α)=1sin2(α)=1tan2(x)+1\qquad |\cos(\alpha)| = \sqrt{1 - \sin^2(\alpha)} = \frac{1}{\sqrt{\tan^2(x) + 1}}


Trigonometric function values

α=\alpha=
0o0^\text{o}
30o30^\text{o}
45o45^\text{o}
60o60^\text{o}
90o90^\text{o}
sinα=\sin\alpha =
00
12\frac{1}{2}
22\frac{\sqrt{2}}{2}
32\frac{\sqrt{3}}{2}
11
cosα=\cos\alpha =
11
32\frac{\sqrt{3}}{2}
22\frac{\sqrt{2}}{2}
12\frac{1}{2}
11
tanα=\tan\alpha =
00
33\frac{\sqrt{3}}{3}
11
3\sqrt{3}
++\infty

Easy way to remember the values

02\frac{\sqrt{0}}{2}
12\frac{\sqrt{1}}{2}
22\frac{\sqrt{2}}{2}
32\frac{\sqrt{3}}{2}
42\frac{\sqrt{4}}{2}

Of course, this table is only a mnemonic and
sin(15o)\sin(15^\text{o})
is NOT
0.52\frac{\sqrt{0.5}}{2}
, although the value can be found through the half angle formula
sin(15o)=1cos(30o)2=234\qquad \sin(15^\text{o}) = \frac{1 - \cos(30^\text{o})}{2} = \frac{2 - \sqrt{3}}{ 4}
>>
Using the Euler identity
eiθ=cosθ+isinθe^{i\theta} = \cos\theta + i\sin\theta
:

cos(α+β)+isin(α+β)=ei(α+β)=eiαeiβ=(cosα+isinα)(cosβ+isinβ)=cosαcosβsinαsinβ+i(sinαcosβ+cosαsinβ)\begin{aligned}\qquad \cos(\alpha + \beta) + i\sin(\alpha + \beta) &= e^{i(\alpha + \beta)} = e^{i\alpha}e^{i\beta} \\&= (\cos\alpha + i\sin\alpha)(\cos\beta + i\sin\beta)\\&=\cos\alpha\cos\beta - \sin\alpha\sin\beta + i(\sin\alpha\cos\beta + \cos\alpha\sin\beta) \end{aligned}


Matching real and imaginary parts left and right, we obtain the angle sum formulas
cos(α+β)\cos(\alpha + \beta)
and
sin(α+β)\sin(\alpha + \beta)
.
Difference formulas are obtained by substituting
β\beta
for
β-\beta
and remembering that:

sin(θ)=cos(θ)\qquad\sin(-\theta) = -\cos(\theta)

cos(θ)=+cos(θ)\qquad\cos(-\theta) = +\cos(\theta)


Angle sum and difference formulas:

sin(α+β)=sin(α)cos(β)+cos(α)sin(β)\qquad \sin(\alpha + \beta) = \sin(\alpha)\cos(\beta) + \cos(\alpha)\sin(\beta)

sin(αβ)=sin(α)cos(β)cos(α)sin(β)\qquad \sin(\alpha - \beta) = \sin(\alpha)\cos(\beta) - \cos(\alpha)\sin(\beta)

cos(α+β)=cos(α)cos(β)sin(α)sin(β)\qquad \cos(\alpha + \beta) = \cos(\alpha)\cos(\beta) - \sin(\alpha)\sin(\beta)

cos(αβ)=cos(α)cos(β)+sin(α)sin(β)\qquad \cos(\alpha - \beta) = \cos(\alpha)\cos(\beta) + \sin(\alpha)\sin(\beta)


By dividing (1) and (3), or (2) and (4):

tan(α+β)=tan(α)+tan(β)1tan(α)tan(β)\qquad\tan(\alpha + \beta) = \frac{\tan(\alpha) + \tan(\beta)}{1 - \tan(\alpha)\tan(\beta)}

tan(αβ)=tan(α)tan(β)1+tan(α)tan(β)\qquad \tan(\alpha - \beta) = \frac{\tan(\alpha) - \tan(\beta)}{1 + \tan(\alpha)\tan(\beta)}


And from these, other formulas can be derived.
>>
Half-angle formulas


sin2(α2)=1cos(2α)2\qquad \sin^2\left(\frac{\alpha}{2}\right) = \frac{1 - \cos(2\alpha)}{2}

cos2(α2)=1+cos(2α)2\qquad \cos^2\left(\frac{\alpha}{2}\right) = \frac{1 + \cos(2\alpha)}{2}


Notice that both formulas above use the
cos(2α)\cos(2\alpha)

Half-angle tangent formula is better given by:

tan(α+β2)=sin(α)+sin(β)cos(α)+cos(β)\qquad \tan\left(\frac{\alpha + \beta}{2}\right) = \frac{\sin(\alpha) + \sin(\beta)}{\cos(\alpha) + \cos(\beta)}


By setting
β=0\beta = 0
:

tan(α2)=sin(α)cos(α)+1\qquad \tan\left(\frac{\alpha}{2}\right) = \frac{\sin(\alpha)}{\cos(\alpha) + 1}


By substituting
β\beta
for
β-\beta


tan(αβ2)=sin(α)sin(β)cos(α)+cos(β)\qquad \tan\left(\frac{\alpha - \beta}{2}\right) = \frac{\sin(\alpha) - \sin(\beta)}{\cos(\alpha) + \cos(\beta)}
>>
Double angle formulas:

By setting
β=α\beta = \alpha
we get double angle formulas. There is one double-angle formula for sine but three useful double angle formulas for cosine. The three are easily from each other using the fundamental identity
sin2(α)+cos2(α)=1\sin^2(\alpha) + \cos^2(\alpha) = 1


sin(2α)=2sin(α)cos(α)\qquad \sin(2\alpha) = 2\sin(\alpha)\cos(\alpha)

cos(2α)=cos2(α)sin2(α)=12sin2(α)=2cos2(α)1\qquad\begin{aligned} \cos(2\alpha) &= \cos^2(\alpha) - \sin^2(\alpha)\\&= 1 - 2\sin^2(\alpha)\\&= 2\cos^2(\alpha) - 1\end{aligned}


In additon, double angle formulas can be expressed in terms of a tangent:

sin(2α)=2tan(α)1+tan2(α)\qquad \sin(2\alpha) = \frac{2\tan(\alpha)}{1 + \tan^2(\alpha)}

cos(2α)=2tan(α)1+tan2(α)\qquad \cos(2\alpha) = \frac{2\tan(\alpha)}{1 + \tan^2(\alpha)}

tan(2α)=2tanα1tan2α\qquad \tan(2\alpha) = \frac{2\tan\alpha}{1 - \tan^2\alpha}
>>
Triple angle formulas:

sin(3α)=3sin(α)4sin3(α)\qquad \sin(3\alpha) = 3\sin(\alpha) - 4\sin^3(\alpha)

cos(3α)=4cos(α)3cos(α)\qquad \cos(3\alpha) = 4\cos(\alpha) - 3\cos(\alpha)


>What about quadruple and quintuple angle formulas?
Coefficients for n-angle formulas are the coefficients of Chebyshev polynomials.
Specifically Chebyshev polynomials of the first kind for sine, and Chebyshev polynomials of the second kind for cosine.

Triple angle formula for tangnet:

tan(3α)=3tan(α)tan3α13tan2α\qquad \tan(3\alpha) = \frac{3\tan(\alpha) - \tan^3{\alpha}}{1 - 3\tan^2{\alpha}}
>>
Product to sum formulas

By summing formulas
sin(α+β)\sin(\alpha+\beta)
and
sin(αβ)\sin(\alpha-\beta)
:

2sin(α)cos(β)=sin(α+β)+sin(αβ)\qquad 2\sin(\alpha)\cos(\beta) = \sin(\alpha + \beta) + \sin(\alpha - \beta)

2cos(α)sin(β)=sin(α+β)sin(αβ)\qquad 2\cos(\alpha)\sin(\beta) = \sin(\alpha + \beta) - \sin(\alpha - \beta)


By summing formulas
cos(α+β)\cos(\alpha+\beta)
and
cos(αβ)\cos(\alpha-\beta)
:

2sin(α)sin(β)=cos(αβ)cos(α+β)\qquad 2\sin(\alpha)\sin(\beta) = \cos(\alpha - \beta) - \cos(\alpha + \beta)

2cos(α)cos(β)=cos(αβ)+cos(α+β)\qquad 2\cos(\alpha)\cos(\beta) = \cos(\alpha - \beta) + \cos(\alpha + \beta)



Tangent formula can be obtained by dividing the previous two formulas

tan(α)tanβ=cos(αβ)cos(α+β)cos(αβ)+cos(α+β)\qquad\tan(\alpha)\tan{\beta} = \frac{\cos(\alpha - \beta) - \cos(\alpha + \beta)}{\cos(\alpha - \beta) + \cos(\alpha + \beta)}
>>
Sum to product formulas

These are obtained by setting
x=α+β,y=αβx = \alpha + \beta,\enspace y = \alpha - \beta
, solving
α=x+y2,β=xy2\alpha = \frac{x + y}{2},\enspace\beta=\frac{x - y}{2}
then substituting this in the "product-to-sum" formulas above.
After renaming
x,yx, y
back to
α,β\alpha,\beta
:

sin(α)+sin(β)=2sin(α+β2)cos(αβ2)\qquad \sin(\alpha) + \sin(\beta) = 2\sin\left(\frac{\alpha + \beta}{2}\right)\cos\left(\frac{\alpha - \beta}{2}\right)

sin(α)sin(β)=2sin(αβ2)cos(α+β2)\qquad \sin(\alpha) - \sin(\beta) = 2\sin\left(\frac{\alpha - \beta}{2}\right)\cos\left(\frac{\alpha + \beta}{2}\right)

cos(α)+cos(β)=2cos(α+β2)cos(αβ2)\qquad \cos(\alpha) + \cos(\beta) = 2\cos\left(\frac{\alpha + \beta}{2}\right)\cos\left(\frac{\alpha - \beta}{2}\right)

cos(α)cos(β)=2sin(α+β2)sin(αβ2)\qquad \cos(\alpha) - \cos(\beta) = -2\sin\left(\frac{\alpha + \beta}{2}\right)\sin\left(\frac{\alpha - \beta}{2}\right)


Tangent formula can be obtained in the following way:

tan(α)+tan(β)=sin(α)cos(α)+sin(β)cos(β)=sin(α)cos(β)+cos(α)sin(β)cos(α)cos(β)=sin(α+β)cos(α)cos(β)\qquad \tan(\alpha) + \tan(\beta) = \frac{\sin(\alpha)}{\cos(\alpha)} + \frac{\sin(\beta)}{\cos(\beta)} = \frac{\sin(\alpha)\cos(\beta) + \cos(\alpha)\sin(\beta)}{\cos(\alpha)\cos(\beta)} = \frac{\sin(\alpha + \beta)}{\cos(\alpha)\cos(\beta)}
>>
Taylor series of trigonometric functions

Sine and cosine have the following Maclaurin series (which are Taylor series around
x0=0)x_0 = 0)
:

sin(x)=n=0(1)n(2n+1)!x2n+1\qquad \sin(x) = \sum_{n=0}^\infty\frac{(-1)^n}{(2n + 1)!}x^{2n + 1}

cos(x)=n=0(1)n(2n)!x2n\qquad \cos(x) = \sum_{n=0}^\infty \frac{(-1)^n}{(2n)!}x^{2n}


This is the same as writing:

sin(x)=xx33!+x55!x77!+x99!x1111!+\qquad \sin(x) = x -\frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \frac{x^9}{9!} -\frac{x^{11}}{11!} +\dots

cos(x)=1x22!+x44!x66!+x88!x1010+\qquad \cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \frac{x^8}{8!} - \frac{x^{10}}{10}+\dots


By summing the Maclaurin series of
cos(x)\cos(x)
and
isin(x)i\sin(x)
it's possible to prove Euler's formula
eix=cos(x)+isin(x)e^{ix} = \cos(x) + i\sin(x)


cos(x)+isin(x)=1+ix+(ix)22!+(ix)33!+(ix)44!+=eix\qquad \cos(x) + i\sin(x) = 1 + ix + \frac{(ix)^2}{2!} + \frac{(ix)^3}{3!} + \frac{(ix)^4}{4!} + \dots = e^{ix}


Maclaurin series can be used to approximate trigonometric functions to an arbitrary degree
For small angles (i.e.
α0\alpha\approx 0
), good approximations (often used in physics) are:

sin(α)x\qquad \sin(\alpha)\approx x

cos(α)1\qquad \cos(\alpha)\approx 1


Which are just Maclaurin series with only 1 term.
>>
Computation of trigonometric functions

Maclaurin series lend an easy way to numerically compute.
We need a helper function
ifac(n)
that computes
n!,  nNn!,\; n\in\mathbb{N}
and a helper function
fpow(x, n)
that computes
xn,  xR,nNx^n,\;x\in\mathbb{R}, n\in\mathbb{N}
:

int ifac(int n) {

return (n > 0) ? (n * ifac(n - 1)) : 1;
}
float fpow(float x, int n) {
return (n < 0) ? fpow(1/x, -n)
: (n == 0) ? 1
: (n == 1) ? x
: (n > 1) ? x * fpow(x, n - 1)
: 1;
}

Now
sin(x)\sin(x)
can be computed with
fsin(x, prec)
:
float fsin(float x, int termCount) {

int n, sign = 1;
float numer = x,
denom = 1,
result = sign * (numer / denom);

for (n = 1; n < termCount; n++) {
sign *= -1;
numer = fpow(x, 2*n+1);
denom = ifac(2*n+1);
result += sign * (numer / denom);
}

return result;
}

While
cos(x)\cos(x)
can be computed with
fcos(x, prec)
:

float fcos(float x, int termCount) {

int n, sign = 1;
float numer = 1,
denom = 1,
result = sign * (numer / denom);
for (n = 1; n < termCount; n++) {
sign *= -1;
numer = fpow(x, 2*n);
denom = ifac(2*n);
result += sign * (numer / denom);
}
return result;
}


While Maclaurin series for
sin(x)\sin(x)
and
cos(x)\cos(x)
converge on entire
R\mathbb{R}
, they converge the fastest when
x(π,π]x\in(-\pi,\pi]
so its good to bound
xx
to that interval considering trigonometric functions are periodic. In fact, only 5-15 are iterations are usually good enough in double-precision floating point precision.
>>

File: 8ce0ff601f99fdbf275b63c9b3b1944e.jpg ( 172.93 KB , 1040x1136 , 1656009606752.jpg )

Image
>>198
You touched on what nobody actually mentions, how these functions are computed. Excellent exposition.
>>

File: 1648530726809.png ( 25.95 KB , 644x800 , 1662284901464.png )

Image
gemmy though, thanks for the full info
>>
great thread