<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[The ryg blog]]></provider_name><provider_url><![CDATA[https://fgiesen.wordpress.com]]></provider_url><author_name><![CDATA[fgiesen]]></author_name><author_url><![CDATA[https://fgiesen.wordpress.com/author/fgiesen/]]></author_url><title><![CDATA[Trig identities from complex&nbsp;exponentials]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>There&#8217;s tons of useful trig identities. You could spend the time to learn them by heart, or just look them up on Wikipedia when necessary. But I&#8217;ve always had problems remembering where the signs and such go when trying to memorize this directly. At least for me, what worked way better is this: spend a few hours familiarizing yourself with complex numbers if you haven&#8217;t done so already; after that, most identities that you need in practice are easy to derive from Euler&#8217;s formula:</p>
<p><img src="https://s0.wp.com/latex.php?latex=e%5E%7Bix%7D+%3D+%5Cexp%28ix%29+%3D+%5Ccos%28x%29+%2B+i+%5Csin%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=e%5E%7Bix%7D+%3D+%5Cexp%28ix%29+%3D+%5Ccos%28x%29+%2B+i+%5Csin%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=e%5E%7Bix%7D+%3D+%5Cexp%28ix%29+%3D+%5Ccos%28x%29+%2B+i+%5Csin%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="e^{ix} = &#92;exp(ix) = &#92;cos(x) + i &#92;sin(x)" class="latex" /></p>
<p>Let&#8217;s do the basic addition formulas first. Euler&#8217;s formula gives:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%2B+i+%5Csin%28x%2By%29+%3D+%5Cexp%28i%28x%2By%29%29+%3D+%5Cexp%28ix%29+%5Cexp%28iy%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%2B+i+%5Csin%28x%2By%29+%3D+%5Cexp%28i%28x%2By%29%29+%3D+%5Cexp%28ix%29+%5Cexp%28iy%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%2B+i+%5Csin%28x%2By%29+%3D+%5Cexp%28i%28x%2By%29%29+%3D+%5Cexp%28ix%29+%5Cexp%28iy%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x+y) + i &#92;sin(x+y) = &#92;exp(i(x+y)) = &#92;exp(ix) &#92;exp(iy)" class="latex" /></p>
<p>and once we apply the identity again we get:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%28%5Ccos%28x%29+%2B+i+%5Csin%28x%29%29+%28%5Ccos%28y%29+%2B+i+%5Csin%28y%29%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%28%5Ccos%28x%29+%2B+i+%5Csin%28x%29%29+%28%5Ccos%28y%29+%2B+i+%5Csin%28y%29%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%28%5Ccos%28x%29+%2B+i+%5Csin%28x%29%29+%28%5Ccos%28y%29+%2B+i+%5Csin%28y%29%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="(&#92;cos(x) + i &#92;sin(x)) (&#92;cos(y) + i &#92;sin(y))" class="latex" /></p>
<p>multiplying out:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%28%5Ccos%28x%29+%5Ccos%28y%29+-+%5Csin%28x%29+%5Csin%28y%29%29+%2B+i+%28%5Csin%28x%29+%5Ccos%28y%29+%2B+%5Ccos%28x%29+%5Csin%28y%29%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%28%5Ccos%28x%29+%5Ccos%28y%29+-+%5Csin%28x%29+%5Csin%28y%29%29+%2B+i+%28%5Csin%28x%29+%5Ccos%28y%29+%2B+%5Ccos%28x%29+%5Csin%28y%29%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%28%5Ccos%28x%29+%5Ccos%28y%29+-+%5Csin%28x%29+%5Csin%28y%29%29+%2B+i+%28%5Csin%28x%29+%5Ccos%28y%29+%2B+%5Ccos%28x%29+%5Csin%28y%29%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="(&#92;cos(x) &#92;cos(y) - &#92;sin(x) &#92;sin(y)) + i (&#92;sin(x) &#92;cos(y) + &#92;cos(x) &#92;sin(y))" class="latex" /></p>
<p>The terms in parentheses are all real numbers; equating them with our original expression yields the result</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%3D+%5Ccos%28x%29+%5Ccos%28y%29+-+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%3D+%5Ccos%28x%29+%5Ccos%28y%29+-+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%3D+%5Ccos%28x%29+%5Ccos%28y%29+-+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x+y) = &#92;cos(x) &#92;cos(y) - &#92;sin(x) &#92;sin(y)" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+%3D+%5Csin%28x%29+%5Ccos%28y%29+%2B+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+%3D+%5Csin%28x%29+%5Ccos%28y%29+%2B+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+%3D+%5Csin%28x%29+%5Ccos%28y%29+%2B+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(x+y) = &#92;sin(x) &#92;cos(y) + &#92;cos(x) &#92;sin(y)" class="latex" /></p>
<p>Both addition formulas for the price of one. (In fact, this exploits that the addition formulas for trigonometric functions and the addition formula for exponents are really the same thing). The main point being that if you know complex multiplication, you never have to remember what the grouping of factors and the signs are, something I used to have trouble remembering.</p>
<p>Plugging in x=y into the above also immediately gives the double-angle formulas:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(2x) = &#92;cos(x)^2 - &#92;sin(x)^2" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Csin%282x%29+%3D+2+%5Csin%28x%29+%5Ccos%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%282x%29+%3D+2+%5Csin%28x%29+%5Ccos%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%282x%29+%3D+2+%5Csin%28x%29+%5Ccos%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(2x) = 2 &#92;sin(x) &#92;cos(x)" class="latex" /></p>
<p>so if you know the addition formulas there&#8217;s really no reason to learn these separately.</p>
<p>Then there&#8217;s the well-known</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5E2+%2B+%5Csin%28x%29%5E2+%3D+1&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5E2+%2B+%5Csin%28x%29%5E2+%3D+1&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5E2+%2B+%5Csin%28x%29%5E2+%3D+1&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x)^2 + &#92;sin(x)^2 = 1" class="latex" /></p>
<p>but it&#8217;s really just the Pythagorean theorem in disguise (since cos(x) and sin(x) are the side lengths of a right-angled triangle). So not really a new formula either!</p>
<p>Moving either the cosine or sine terms to the right-hand side gives the two <em>immensely</em> useful equations:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5E2+%3D+1+-+%5Csin%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5E2+%3D+1+-+%5Csin%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5E2+%3D+1+-+%5Csin%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x)^2 = 1 - &#92;sin(x)^2" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Csin%28x%29%5E2+%3D+1+-+%5Ccos%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28x%29%5E2+%3D+1+-+%5Ccos%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28x%29%5E2+%3D+1+-+%5Ccos%28x%29%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(x)^2 = 1 - &#92;cos(x)^2" class="latex" /></p>
<p>In particular, that second one is perfect if you need the sine squared of an angle that you only have the cosine of (usually because you&#8217;ve determined it using a dot product). Judicious application of these two tends to be a great way to simplify superfluous math in shaders (and elsewhere), one of my <a href="https://fgiesen.wordpress.com/2010/10/21/finish-your-derivations-please/">pet peeves</a>.</p>
<p>For practice, let&#8217;s apply these two identities to the cosine double-angle formula:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2+%3D+2+%5Ccos%28x%29%5E2+-+1+%5CLeftrightarrow+cos%28x%29%5E2+%3D+%28cos%282x%29+%2B+1%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2+%3D+2+%5Ccos%28x%29%5E2+-+1+%5CLeftrightarrow+cos%28x%29%5E2+%3D+%28cos%282x%29+%2B+1%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2+%3D+2+%5Ccos%28x%29%5E2+-+1+%5CLeftrightarrow+cos%28x%29%5E2+%3D+%28cos%282x%29+%2B+1%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(2x) = &#92;cos(x)^2 - &#92;sin(x)^2 = 2 &#92;cos(x)^2 - 1 &#92;Leftrightarrow cos(x)^2 = (cos(2x) + 1) / 2" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2+%3D+1+-+2+%5Csin%28x%29%5E2+%5CLeftrightarrow+sin%28x%29%5E2+%3D+%281+-+cos%282x%29%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2+%3D+1+-+2+%5Csin%28x%29%5E2+%5CLeftrightarrow+sin%28x%29%5E2+%3D+%281+-+cos%282x%29%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%282x%29+%3D+%5Ccos%28x%29%5E2+-+%5Csin%28x%29%5E2+%3D+1+-+2+%5Csin%28x%29%5E2+%5CLeftrightarrow+sin%28x%29%5E2+%3D+%281+-+cos%282x%29%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(2x) = &#92;cos(x)^2 - &#92;sin(x)^2 = 1 - 2 &#92;sin(x)^2 &#92;Leftrightarrow sin(x)^2 = (1 - cos(2x)) / 2" class="latex" /></p>
<p>why, it&#8217;s the half-angle formulas! Fancy meeting you here!</p>
<p>Can we do something with the sine double-angle formula too? Well, it&#8217;s not too fancy, but we can get this:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Csin%282x%29+%3D+2+%5Csin%28x%29+%5Ccos%28x%29+%5CLeftrightarrow+%5Csin%28x%29+%5Ccos%28x%29+%3D+%5Csin%282x%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%282x%29+%3D+2+%5Csin%28x%29+%5Ccos%28x%29+%5CLeftrightarrow+%5Csin%28x%29+%5Ccos%28x%29+%3D+%5Csin%282x%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%282x%29+%3D+2+%5Csin%28x%29+%5Ccos%28x%29+%5CLeftrightarrow+%5Csin%28x%29+%5Ccos%28x%29+%3D+%5Csin%282x%29+%2F+2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(2x) = 2 &#92;sin(x) &#92;cos(x) &#92;Leftrightarrow &#92;sin(x) &#92;cos(x) = &#92;sin(2x) / 2" class="latex" /></p>
<p>Now, let&#8217;s go back to the original addition formulas and let&#8217;s see what happens when we plug in negative values for y. Using <img src="https://s0.wp.com/latex.php?latex=%5Csin%28-x%29+%3D+-%5Csin%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28-x%29+%3D+-%5Csin%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28-x%29+%3D+-%5Csin%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(-x) = -&#92;sin(x)" class="latex" /> and <img src="https://s0.wp.com/latex.php?latex=%5Ccos%28-x%29+%3D+%5Ccos%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28-x%29+%3D+%5Ccos%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28-x%29+%3D+%5Ccos%28x%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(-x) = &#92;cos(x)" class="latex" />, we get:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x-y%29+%3D+%5Ccos%28x%29+%5Ccos%28y%29+%2B+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x-y%29+%3D+%5Ccos%28x%29+%5Ccos%28y%29+%2B+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x-y%29+%3D+%5Ccos%28x%29+%5Ccos%28y%29+%2B+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x-y) = &#92;cos(x) &#92;cos(y) + &#92;sin(x) &#92;sin(y)" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Csin%28x-y%29+%3D+%5Csin%28x%29+%5Ccos%28y%29+-+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28x-y%29+%3D+%5Csin%28x%29+%5Ccos%28y%29+-+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28x-y%29+%3D+%5Csin%28x%29+%5Ccos%28y%29+-+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(x-y) = &#92;sin(x) &#92;cos(y) - &#92;cos(x) &#92;sin(y)" class="latex" /></p>
<p>Hey look, flipped signs! This means that we can now add these to (or subtract them from) the original formulas to get <em>even more</em> identities!</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%2B+%5Ccos%28x-y%29+%3D+2+%5Ccos%28x%29+%5Ccos%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%2B+%5Ccos%28x-y%29+%3D+2+%5Ccos%28x%29+%5Ccos%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x%2By%29+%2B+%5Ccos%28x-y%29+%3D+2+%5Ccos%28x%29+%5Ccos%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x+y) + &#92;cos(x-y) = 2 &#92;cos(x) &#92;cos(y)" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x-y%29+-+%5Ccos%28x%2By%29+%3D+2+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x-y%29+-+%5Ccos%28x%2By%29+%3D+2+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x-y%29+-+%5Ccos%28x%2By%29+%3D+2+%5Csin%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x-y) - &#92;cos(x+y) = 2 &#92;sin(x) &#92;sin(y)" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+%2B+%5Csin%28x-y%29+%3D+2+%5Csin%28x%29+%5Ccos%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+%2B+%5Csin%28x-y%29+%3D+2+%5Csin%28x%29+%5Ccos%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+%2B+%5Csin%28x-y%29+%3D+2+%5Csin%28x%29+%5Ccos%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(x+y) + &#92;sin(x-y) = 2 &#92;sin(x) &#92;cos(y)" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+-+%5Csin%28x-y%29+%3D+2+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+-+%5Csin%28x-y%29+%3D+2+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28x%2By%29+-+%5Csin%28x-y%29+%3D+2+%5Ccos%28x%29+%5Csin%28y%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(x+y) - &#92;sin(x-y) = 2 &#92;cos(x) &#92;sin(y)" class="latex" /></p>
<p>It&#8217;s the product-to-sum identities this time. I got one more! We&#8217;ve deliberately flipped signs and then added/subtracted the addition formulas to get the above set. What if we do the same trick in reverse to get rid of those x+y and x-y terms? Let&#8217;s set <img src="https://s0.wp.com/latex.php?latex=x+%3D+%28a+%2B+b%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=x+%3D+%28a+%2B+b%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=x+%3D+%28a+%2B+b%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="x = (a + b)/2" class="latex" /> and <img src="https://s0.wp.com/latex.php?latex=y+%3D+%28b+-+a%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=y+%3D+%28b+-+a%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=y+%3D+%28b+-+a%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="y = (b - a)/2" class="latex" /> and plug that into the identities above and we get:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%28b%29+%2B+%5Ccos%28a%29+%3D+2+%5Ccos%28%28a%2Bb%29%2F2%29+%5Ccos%28%28b-a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28b%29+%2B+%5Ccos%28a%29+%3D+2+%5Ccos%28%28a%2Bb%29%2F2%29+%5Ccos%28%28b-a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28b%29+%2B+%5Ccos%28a%29+%3D+2+%5Ccos%28%28a%2Bb%29%2F2%29+%5Ccos%28%28b-a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(b) + &#92;cos(a) = 2 &#92;cos((a+b)/2) &#92;cos((b-a)/2)" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Ccos%28a%29+-+%5Ccos%28b%29+%3D+2+%5Csin%28%28a+%2B+b%29%2F2%29+%5Csin%28%28b+-+a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28a%29+-+%5Ccos%28b%29+%3D+2+%5Csin%28%28a+%2B+b%29%2F2%29+%5Csin%28%28b+-+a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28a%29+-+%5Ccos%28b%29+%3D+2+%5Csin%28%28a+%2B+b%29%2F2%29+%5Csin%28%28b+-+a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(a) - &#92;cos(b) = 2 &#92;sin((a + b)/2) &#92;sin((b - a)/2)" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Csin%28b%29+%2B+%5Csin%28a%29+%3D+2+%5Csin%28%28a+%2B+b%29%2F2%29+%5Ccos%28%28b+-+a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28b%29+%2B+%5Csin%28a%29+%3D+2+%5Csin%28%28a+%2B+b%29%2F2%29+%5Ccos%28%28b+-+a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28b%29+%2B+%5Csin%28a%29+%3D+2+%5Csin%28%28a+%2B+b%29%2F2%29+%5Ccos%28%28b+-+a%29%2F2%29&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(b) + &#92;sin(a) = 2 &#92;sin((a + b)/2) &#92;cos((b - a)/2)" class="latex" /></p>
<p>Ta-dah, it&#8217;s the sum-to-product identities. Now, admittedly, we&#8217;ve taken quite a few steps to get here, and looking these up when you need them is going to be faster than walking through the derivation (if you ever need them in the first place &#8211; I don&#8217;t think I&#8217;ve ever used the product/sum identities in practice). But still, working these out is a good exercise, and a lot less likely to go wrong (at least for me) than memorizing lots of similar formulas. (I never can get the signs right that way)</p>
<p>Bonus exercise: work out general expressions for <img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5En&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5En&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x%29%5En&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x)^n" class="latex" /> and <img src="https://s0.wp.com/latex.php?latex=%5Csin%28x%29%5En&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28x%29%5En&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28x%29%5En&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(x)^n" class="latex" />. Hint:</p>
<p><img src="https://s0.wp.com/latex.php?latex=%5Ccos%28x%29+%3D+%28%5Cexp%28ix%29+%2B+%5Cexp%28-ix%29%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Ccos%28x%29+%3D+%28%5Cexp%28ix%29+%2B+%5Cexp%28-ix%29%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Ccos%28x%29+%3D+%28%5Cexp%28ix%29+%2B+%5Cexp%28-ix%29%29%2F2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;cos(x) = (&#92;exp(ix) + &#92;exp(-ix))/2" class="latex" /><br />
<img src="https://s0.wp.com/latex.php?latex=%5Csin%28x%29+%3D+%28%5Cexp%28ix%29+-+%5Cexp%28-ix%29%29%2F2i&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002" srcset="https://s0.wp.com/latex.php?latex=%5Csin%28x%29+%3D+%28%5Cexp%28ix%29+-+%5Cexp%28-ix%29%29%2F2i&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002 1x, https://s0.wp.com/latex.php?latex=%5Csin%28x%29+%3D+%28%5Cexp%28ix%29+-+%5Cexp%28-ix%29%29%2F2i&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x" alt="&#92;sin(x) = (&#92;exp(ix) - &#92;exp(-ix))/2i" class="latex" />.</p>
<p>And I think that&#8217;s enough for now. (At some later point, I might do an extra post about one of the sneakier trig techniques: the <a href="http://en.wikipedia.org/wiki/Weierstrass_substitution">Weierstrass substitution</a>).</p>
]]></html></oembed>