113 - Topic 05 - Analytic Trigonometry Formulas

179 days ago by Professor102

Analytic Trigonometric Formulas - Derivation

John Travis

Mississippi College

Starting with a unit circle approach, developing all the sum, difference, double angle and half angle formulas.

%hide %auto @interact def _(A = slider(1,3,1/10,1.5,label='Angle $A$'),B = slider(1,3,1/10,1,label='Angle $B$')): if A==B: pretty_print('Formula is not interesting if $A=B$. Make them different!') else: pt0 = (1,0) ptA = (cos(A),sin(A)) ptB = (cos(B),sin(B)) ptAmB = (cos(A-B),sin(A-B)) d1 = (cos(A-B)-1)^2 + sin(A-B)^2 d2 = (cos(A)-cos(B))^2 + (sin(A)-sin(B))^2 G = circle((0,0), 1, edgecolor='blue' ) G += line([(0,0),ptAmB],color='gray')+line([pt0,ptAmB],color='green',thickness=5) G += text(str(d1.n(digits=5)),( (cos(A-B)+1)/2.5, sin(A-B)/2.5),rotation=90+180*atan(sin(A-B)/(cos(A-B)-1))/pi) G += text(str(d2.n(digits=5)),( (cos(A)+cos(B))/2.5, (sin(A)+sin(B))/2.5),rotation=90+180*atan((sin(A)-sin(B))/(cos(A)-cos(B)))/pi) G += text('(1,0)',pt0,fontsize=15,color='red')+text('A-B',ptAmB,fontsize=15,color='red') G += text('A',ptA,fontsize=15,color='red')+text('B',ptB,fontsize=15,color='red') G += line([(0,0),ptA],color='gray')+line([(0,0),ptB],color='gray') G += line([ptA,ptB],color='green',thickness=5) G.show(aspect_ratio=True) pretty_print('Distances for each of the arc segments: %s'%str(d1.n())+' and %s'%str(d2.n())) 
       
Angle $A$ 
Angle $B$ 

Click to the left again to hide and once more to show the dynamic interactive window

%hide %auto reset() var('A,B,C') d1 = sin(A-B)^2 + (cos(A-B)-1)^2 d2 = (sin(A)-sin(B))^2 + (cos(A)-cos(B))^2 equation = d1 == d2 pretty_print(html('Equating the two distances $d_1$ and $d_2$ gives')) equation.show() pretty_print('Expanding the squares on each side gives') equation2 = d1.expand() == d2.expand() equation2.show() pretty_print('Canceling using the Pythagorean identities gives') d1a = (d1+2*cos(A-B)).simplify_trig() d2a = d2.simplify_trig() equation3 = d1a -2*cos(A-B) == d2a equation3.simplify().show() pretty_print('Cancel the leftover $2$s and negatives gives the formula') equation4(A,B) = cos(A-B) == (-d2a/2+1) equation4(A,B).show() 
       
Equating the two distances  and  gives

                                
                            
Equating the two distances  and  gives

                                
%hide %auto pretty_print(html('Replacing $B$ with $-B$ yields the addition formula for cosine') ) equation4(A,-B).show() pretty_print(html('Use the fact at $\sin$ is odd and $\cos$ is even to get the addition formula.')) 
       
Replacing  with  yields the addition formula for cosine
Use the fact at  is odd and  is even to get the addition formula.
                                
                            
Replacing  with  yields the addition formula for cosine
Use the fact at  is odd and  is even to get the addition formula.
                                
%hide %auto pretty_print(html('Using this formula and replacing $A$ with $\pi/2-A$ and $B$ with $-B$ yields')) equation5=equation4(pi/2-A,B) equation5.show() pretty_print(html('The cofunction relationships yield')) equation6(A,B) = sin(A+B) == sin(A)*cos(B)+cos(A)*sin(B) equation6(A,B).show() 
       
Using this formula and replacing  with  and  with  yields
The cofunction relationships yield

                                
                            
Using this formula and replacing  with  and  with  yields
The cofunction relationships yield

                                
%auto %hide pretty_print(html('Replacing $B$ with $-B$ yields')) equation6(A,-B).show() pretty_print(html('Use the fact at $\sin$ is odd and $\cos$ is even to get the subtraction formula.')) 
       
Replacing  with  yields
Use the fact at  is odd and  is even to get the subtraction formula.
                                
                            
Replacing  with  yields
Use the fact at  is odd and  is even to get the subtraction formula.
                                
%hide %auto pretty_print(html('Replacing $A-B$ with $A+A$ yields the double angle formula')) equation6(A,A).show() 
       
Replacing  with  yields the double angle formula

                                
                            
Replacing  with  yields the double angle formula

                                
%hide %auto pretty_print(html('Visually, <font color="blue">$\sin(2A)$</font> is the traditional sine curve compressed horizontally.')) pretty_print(html('Visually, <font color="green">$2\sin(A)$</font> is the traditional sine curve expanded vertically.')) pretty_print(html('By multiplying $2\sin(A)$ by $\cos(A)$ the second curve is given a variable amplitude.')) pretty_print(html('The animation shows what happens as $2\sin(A)$ is increasingly multiplied by $\cos(A)$.')) Slides = [] G = plot(sin(2*x),(x,0,2*pi),color='blue',alpha=0.3)+plot(2*sin(x),(x,0,2*pi),color='green',alpha=0.3) for k in range(1,20): c = cos(k/20*x) H = G + plot(2*sin(x)*c,(x,0,2*pi),color='red') Slides.append(H) animate(Slides).show(delay=20, iterations=0) 
       
Visually,  is the traditional sine curve compressed horizontally.
Visually,  is the traditional sine curve expanded vertically.
By multiplying  by  the second curve is given a variable amplitude.
The animation shows what happens as  is increasingly multiplied by .
^C
Traceback (click to the left of this block for traceback)
...
__SAGE__
Visually,  is the traditional sine curve compressed horizontally.
Visually,  is the traditional sine curve expanded vertically.
By multiplying  by  the second curve is given a variable amplitude.
The animation shows what happens as  is increasingly multiplied by .
^C
Traceback (most recent call last):    G = plot(sin(2*x),(x,0,2*pi),color='blue',alpha=0.3)+plot(2*sin(x),(x,0,2*pi),color='green',alpha=0.3)
  File "", line 1, in <module>
    
  File "/tmp/tmpKcmzR7/___code___.py", line 13, in <module>
    H = G + plot(_sage_const_2 *sin(x)*c,(x,_sage_const_0 ,_sage_const_2 *pi),color='red')
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 492, in wrapper
    return func(*args, **options)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1941, in plot
    G = funcs.plot(*args, **original_opts)
  File "sage/symbolic/expression.pyx", line 12027, in sage.symbolic.expression.Expression.plot (build/cythonized/sage/symbolic/expression.cpp:62698)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 492, in wrapper
    return func(*args, **options)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/plot.py", line 1960, in plot
    G = _plot(funcs, *args, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/plot.py", line 2265, in _plot
    randomize)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/plot.py", line 3717, in generate_plot_points
    xi += delta*(random() - 0.5)
  File "src/cysignals/signals.pyx", line 320, in cysignals.signals.python_check_interrupt
KeyboardInterrupt
__SAGE__
%hide %auto pretty_print(html('Using the similar addition formula for $\cos$ but replacing $A+B$ with $A+B$ yields the double angle formula')) equation4(A,-A).show() pretty_print(html('Evenness and oddness gives a first formula for $\cos(2*A)$')) (cos(2*A) == cos(A)^2-sin(A)^2).show() pretty_print(html('Replacing $\sin(A)^2$ with $1-\cos(A)^2$ gives a second formula for $\cos(2*A)$')) (cos(2*A) == 2*cos(A)^2-1).show() pretty_print(html('Instead, replacing $\cos(A)^2$ with $1-\sin(A)^2$ gives a third formula for $\cos(2*A)$')) (cos(2*A) == 1-2*sin(A)^2).show() 
       
Using the similar addition formula for  but replacing  with  yields the double angle formula
Evenness and oddness gives a first formula for 
Replacing  with  gives a second formula for 
Instead, replacing  with  gives a third formula for 

                                
                            
Using the similar addition formula for  but replacing  with  yields the double angle formula
Evenness and oddness gives a first formula for 
Replacing  with  gives a second formula for 
Instead, replacing  with  gives a third formula for 

                                
%hide %auto pretty_print(html('Compare the equality of the last two forms for $\cos(2A)$:\n')) pretty_print(html('Graph <font color="green">$\sin^2(A)$</font> and then flip and stretch vertically.')) pretty_print(html('Graph <font color="blue">$\cos^2(A)$</font> and then stretch vertically.')) pretty_print(html('Finally translate blue down $1$ and green up $1$')) Slides = [] G = plot(cos(x)^2,(x,0,2*pi),color='blue',alpha=0.4) H = plot(sin(x)^2,(x,0,2*pi),color='green',alpha=0.4) for k in range(1,10): flip = (5-k)/5 Slides.append(G+H+plot(flip*sin(x)^2,(x,0,2*pi),color='green')) Slides.append(G+H+plot(-1*sin(x)^2,(x,0,2*pi),color='green')) for k in range(1,10): r = k/10 Slides.append(G+H+plot((-1-r)*sin(x)^2,(x,0,2*pi),color='green')) H1 = plot(-2*sin(x)^2,(x,0,2*pi),color='green') Slides.append(G+H+H1) for k in range(1,11): r = k/10 Slides.append(G+H+H1+plot((1+r)*cos(x)^2,(x,0,2*pi),color='blue')) for k in range(1,10): r = k/10 Slides.append(G+H+plot(2*cos(x)^2-r,(x,0,2*pi),color='blue')+plot(r-2*sin(x)^2,(x,0,2*pi),color='green')) G += plot(2*cos(x)^2-1,(x,0,2*pi),color='red') Slides.append(G+H) animate(Slides).show(delay=30, iterations=3) 
       
Compare the equality of the last two forms for :
Graph  and then flip and stretch vertically.
Graph  and then stretch vertically.
Finally translate blue down  and green up 
^C
Traceback (click to the left of this block for traceback)
...
__SAGE__
Compare the equality of the last two forms for :
Graph  and then flip and stretch vertically.
Graph  and then stretch vertically.
Finally translate blue down  and green up 
^C
Traceback (most recent call last):    H = plot(sin(x)^2,(x,0,2*pi),color='green',alpha=0.4)
  File "", line 1, in <module>
    
  File "/tmp/tmppJE38B/___code___.py", line 30, in <module>
    exec compile(u'animate(Slides).show(delay=_sage_const_30 , iterations=_sage_const_3 )
  File "", line 1, in <module>
    
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 786, in show
    dm.display_immediately(self, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py", line 835, in display_immediately
    plain_text, rich_output = self._rich_output_formatter(obj, rich_repr_kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py", line 625, in _rich_output_formatter
    rich_output = self._call_rich_repr(obj, rich_repr_kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py", line 583, in _call_rich_repr
    return obj._rich_repr_(self, **rich_repr_kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 684, in _rich_repr_
    self.save, kwds, suffix, outputType)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py", line 713, in graphics_from_save
    save_function(filename, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 1080, in save
    use_ffmpeg=use_ffmpeg, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 613, in gif
    d = self.png()
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 470, in png
    save_image(filename, **self._kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/graphics.py", line 3045, in save_image
    self.save(filename, *args, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 411, in wrapper
    return func(*args, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/graphics.py", line 3217, in save
    figure.savefig(filename, **opts)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/figure.py", line 2062, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2212, in print_figure
    **kwargs)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 532, in print_png
    self.figure.dpi, metadata=metadata)
  File "src/cysignals/signals.pyx", line 320, in cysignals.signals.python_check_interrupt
KeyboardInterrupt
__SAGE__
# Trying to save animation to a file for quicker use later. #dir = tmp_dir() + '/' #Slides.gif(savefile=dir + 'my_animation.gif', show_path=True) #Slides.ffmpeg(savefile=dir + 'new.mpg', show_path=True) 
       
%hide %auto solns(A) = solve((cos(2*A) == 1-2*sin(A)^2),sin(A)) html('Using the <i>second</i> formula but solving for $\sin(A)$ gives') solns(A)[0].show() html('or') solns(A)[1].show() html('Replacing $A$ with $A/2$ (using the $+$ formula) gives $\sin(A/2)$') solns(A/2)[0].show() 
       

                                
                            

                                
%hide %auto html('Visually verify the half-angle formula for $\sin(A/2)$:\n') html('Graph <font color="green">$\sin(A)$</font> and then stretch horizontally for a period of $4\pi$ to get $\sin(A/2)$.') html('Graph <font color="blue">$- \cos(A)$</font>, up one, compress by half and then square root.') html('Notice that the graphs agree for half the time and are negatives of each other for the other half. This reflects the $\pm$ formulas.') Slides = [] G = plot(-1*cos(x),(x,0,4*pi),color='blue',alpha=0.3) H = plot(sin(x),(x,0,2*pi),color='green',alpha=0.3) for k in range(1,10): r = k/10 Slides.append(G+H+plot(sin(x/(1+r)),(x,0,4*pi),color='green')) H += plot(sin(x/2),(x,0,4*pi),color='green') Slides.append(G+H) for k in range(1,10): r = k/10 Slides.append(G+H+plot(r-cos(x),(x,0,4*pi),color='blue')) for k in range(1,11): r = k/10 Slides.append(G+H+plot((1-cos(x))/(1+r),(x,0,4*pi),color='blue')) for k in range(1,5): r = k/10 Slides.append(G+H+plot(((1-cos(x))/2)^(1-r),(x,0,4*pi),color='blue')) G += plot(sqrt((1-cos(x))/2),(x,0,4*pi),color='blue') Slides.append(G+H) #G += plot(plot(((1-cos(x))/2)^0.5,(x,0,4*pi),color='blue') #Slides.append(G+H) animate(Slides).show(delay=30, iterations=3) 
       
^C
Traceback (click to the left of this block for traceback)
...
__SAGE__
^C
Traceback (most recent call last):    H = plot(sin(x),(x,0,2*pi),color='green',alpha=0.3)
  File "", line 1, in <module>
    
  File "/tmp/tmpM_zcIa/___code___.py", line 31, in <module>
    exec compile(u'animate(Slides).show(delay=_sage_const_30 , iterations=_sage_const_3 )
  File "", line 1, in <module>
    
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 786, in show
    dm.display_immediately(self, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py", line 835, in display_immediately
    plain_text, rich_output = self._rich_output_formatter(obj, rich_repr_kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py", line 625, in _rich_output_formatter
    rich_output = self._call_rich_repr(obj, rich_repr_kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py", line 583, in _call_rich_repr
    return obj._rich_repr_(self, **rich_repr_kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 684, in _rich_repr_
    self.save, kwds, suffix, outputType)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py", line 713, in graphics_from_save
    save_function(filename, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 1080, in save
    use_ffmpeg=use_ffmpeg, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 613, in gif
    d = self.png()
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/animate.py", line 470, in png
    save_image(filename, **self._kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/graphics.py", line 3045, in save_image
    self.save(filename, *args, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/misc/decorators.py", line 411, in wrapper
    return func(*args, **kwds)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/plot/graphics.py", line 3217, in save
    figure.savefig(filename, **opts)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/figure.py", line 2062, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2212, in print_figure
    **kwargs)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 517, in print_png
    FigureCanvasAgg.draw(self)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 437, in draw
    self.figure.draw(self.renderer)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/figure.py", line 1493, in draw
    renderer, self, artists, self.suppressComposite)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2635, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/axis.py", line 1202, in draw
    self._update_label_position(renderer)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/axis.py", line 2275, in _update_label_position
    bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/axis.py", line 2260, in _get_tick_boxes_siblings
    tlb, tlb2 = axx.yaxis._get_tick_bboxes(ticks_to_draw, renderer)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/axis.py", line 1130, in _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/text.py", line 914, in get_window_extent
    tx, ty = self._get_xy_display()
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/text.py", line 228, in _get_xy_display
    return self.get_transform().transform_point((x, y))
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/matplotlib/transforms.py", line 1529, in transform_point
    return self.transform(np.asarray([point]))[0]
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/numpy/core/numeric.py", line 538, in asarray
    return array(a, dtype, copy=False, order=order)
  File "src/cysignals/signals.pyx", line 320, in cysignals.signals.python_check_interrupt
KeyboardInterrupt
__SAGE__
%hide %auto solns(A) = solve((cos(2*A) == 2*cos(A)^2-1),cos(A)) html('Using the <i>third</i> formula but solving for $\cos(A)$ gives') solns(A)[0].show() html('or') solns(A)[1].show() html('Replacing $A$ with $A/2$ (using the $+$ formula) gives $\cos(A/2)$') solns(A/2)[0].show()