<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Eli Bendersky's website - Math</title><link href="https://eli.thegreenplace.net/" rel="alternate"></link><link href="https://eli.thegreenplace.net/feeds/math.atom.xml" rel="self"></link><id>https://eli.thegreenplace.net/</id><updated>2026-08-04T03:01:09-07:00</updated><entry><title>Relative velocity and closing speed</title><link href="https://eli.thegreenplace.net/2026/relative-velocity-and-closing-speed/" rel="alternate"></link><published>2026-08-03T20:01:00-07:00</published><updated>2026-08-04T03:01:09-07:00</updated><author><name>Eli Bendersky</name></author><id>tag:eli.thegreenplace.net,2026-08-03:/2026/relative-velocity-and-closing-speed/</id><summary type="html">&lt;p&gt;In Physics simulations or game engines it’s sometimes useful to
determine the speed with which two objects are approaching each other.
This post will discuss the concept of &lt;em&gt;closing speed&lt;/em&gt;, which is the
&lt;em&gt;normal component&lt;/em&gt; of the &lt;em&gt;relative velocity&lt;/em&gt; of two objects.&lt;/p&gt;
&lt;div class="section" id="relative-velocity-and-its-components"&gt;
&lt;h2&gt;Relative velocity and its components&lt;/h2&gt;
&lt;p&gt;Suppose we …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;In Physics simulations or game engines it’s sometimes useful to
determine the speed with which two objects are approaching each other.
This post will discuss the concept of &lt;em&gt;closing speed&lt;/em&gt;, which is the
&lt;em&gt;normal component&lt;/em&gt; of the &lt;em&gt;relative velocity&lt;/em&gt; of two objects.&lt;/p&gt;
&lt;div class="section" id="relative-velocity-and-its-components"&gt;
&lt;h2&gt;Relative velocity and its components&lt;/h2&gt;
&lt;p&gt;Suppose we have objects A and B &lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt; with velocity vectors
&lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/94a17f930633898bbe6d1ef2a6c263573aa3842a.svg" style="height: 20px;" type="image/svg+xml"&gt;\vec{V_A}&lt;/object&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/c4f87fb6f28657fbd625b4bfbc514b0574e80108.svg" style="height: 20px;" type="image/svg+xml"&gt;\vec{V_B}&lt;/object&gt;. The &lt;em&gt;relative velocity&lt;/em&gt; of B
w.r.t. A is:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/27625ffaa87e60a1f991ed3aa390d5b284868118.svg" style="height: 24px;" type="image/svg+xml"&gt;\[\vec{V}_{B|A}=\vec{V}_B-\vec{V}_A\]&lt;/object&gt;
&lt;p&gt;Put differently, it’s the velocity of B in A’s frame of reference.&lt;/p&gt;
&lt;p&gt;This relative velocity is a vector, and we can split it into orthogonal
components. Obviously, the nature of such a split depends on the basis
we want to use. We could look at the vector’s x an y components (we’ll
be using &lt;img alt="\mathbb{R}^2" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/2b688757b3d0949451e1fa97e71ac5f5f284a5e4.png" style="height: 15px;" /&gt; - two dimensional space, but everything
here applies to 3D as well), but for this post we’re interested in
something slightly different:&lt;/p&gt;
&lt;img alt="Normal and tangential components of the relative velocity." class="align-center" src="https://eli.thegreenplace.net/images/2026/normal-and-tangential.png" /&gt;
&lt;p&gt;We draw a line connecting the two objects. The component of
&lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/8ccc4a9163c92ed1e8e723b64a9d7056ada65491.svg" style="height: 24px;" type="image/svg+xml"&gt;\vec{V}_{B|A}&lt;/object&gt; in the direction of this line is called the
&lt;em&gt;normal component&lt;/em&gt; of relative velocity, while the component
perpendicular to this direction is called the &lt;em&gt;tangential component&lt;/em&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="computing-the-normal-component"&gt;
&lt;h2&gt;Computing the normal component&lt;/h2&gt;
&lt;p&gt;How do we find the component of a vector in the direction of a specific
line? By using a &lt;a class="reference external" href="https://eli.thegreenplace.net/2024/projections-and-projection-matrices/"&gt;vector
projection!&lt;/a&gt;.
We’ll represent the line by a vector, and find the projection of
&lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/8ccc4a9163c92ed1e8e723b64a9d7056ada65491.svg" style="height: 24px;" type="image/svg+xml"&gt;\vec{V}_{B|A}&lt;/object&gt; onto this vector.&lt;/p&gt;
&lt;p&gt;The positions of A and B can also be seen as vectors: &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/0cbd4a39e2dc15c143419b61cfab3d08c89dd946.svg" style="height: 20px;" type="image/svg+xml"&gt;\vec{P}_A&lt;/object&gt;
and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/8be98601c153883b6091b8ba841746479c876b9c.svg" style="height: 20px;" type="image/svg+xml"&gt;\vec{P}_B&lt;/object&gt;. The line connecting them can then be expressed as
the vector &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/702505a802f90f2627da0f341f6f28af8a4a2aca.svg" style="height: 20px;" type="image/svg+xml"&gt;\vec{P}_B-\vec{P}_A&lt;/object&gt;:&lt;/p&gt;
&lt;img alt="The relative-position vector is the difference of the two position vectors." class="align-center" src="https://eli.thegreenplace.net/images/2026/the-relative-position.png" /&gt;
&lt;p&gt;All we need from this position difference vector is its direction, not
its magnitude, however &lt;a class="footnote-reference" href="#footnote-2" id="footnote-reference-2"&gt;[2]&lt;/a&gt;. So we’ll use the &lt;em&gt;unit vector&lt;/em&gt; of
&lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/702505a802f90f2627da0f341f6f28af8a4a2aca.svg" style="height: 20px;" type="image/svg+xml"&gt;\vec{P}_B-\vec{P}_A&lt;/object&gt;, denoted as:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/4037effd91b348b652473f482fc242b7dc83ea57.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\widehat{P}=\frac{\vec{P}_B-\vec{P}_A}{|\vec{P}_B-\vec{P}_A|}\]&lt;/object&gt;
&lt;p&gt;Finally, to find the projection of &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/8ccc4a9163c92ed1e8e723b64a9d7056ada65491.svg" style="height: 24px;" type="image/svg+xml"&gt;\vec{V}_{B|A}&lt;/object&gt; onto
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/ae76f98aa161c8e6255ff6aac4741c7745715b54.svg" style="height: 17px;" type="image/svg+xml"&gt;\widehat{P}&lt;/object&gt;, we compute &lt;a class="footnote-reference" href="#footnote-3" id="footnote-reference-3"&gt;[3]&lt;/a&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/bfa87afcdbc16f27582886265e68c81a888a5719.svg" style="height: 24px;" type="image/svg+xml"&gt;\[S_c=\vec{V}_{B|A}\cdot\widehat{P}=(\vec{V}_B-\vec{V}_A)\cdot\widehat{P}\]&lt;/object&gt;
&lt;p&gt;Where the multiplication operator between the vectors is the &lt;em&gt;dot
product&lt;/em&gt;. Note that the result of the dot product is a scalar;
therefore, the quantity &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/b423d57e7c978d9b6f9e3d76c3e02f52cf5a1a17.svg" style="height: 15px;" type="image/svg+xml"&gt;S_c&lt;/object&gt; is called the &lt;em&gt;closing speed&lt;/em&gt; - it
expresses the rate at which the relative distance of the two objects is
changing. If it’s positive, the objects are drifting farther apart; if
it’s negative, the objects are getting closer together. Therefore the
term &amp;quot;closing speed&amp;quot; may be slightly confusing; alternatively, this has
been called a &amp;quot;signed separation speed&amp;quot;, or &amp;quot;normal relative speed&amp;quot; &lt;a class="footnote-reference" href="#footnote-4" id="footnote-reference-4"&gt;[4]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The signs in these calculations can be tricky to get right, so we have
to be very careful. Let’s see a few examples that will help us make
these computations more concrete.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="examples"&gt;
&lt;h2&gt;Examples&lt;/h2&gt;
&lt;p&gt;To build up some intuition and get some practice with the equations,
we’ll review the following examples:&lt;/p&gt;
&lt;img alt="Four relative-motion examples." class="align-center" src="https://eli.thegreenplace.net/images/2026/four-relative-motion.png" /&gt;
&lt;p&gt;&lt;strong&gt;Example I&lt;/strong&gt;: We’ll start by computing the relative position unit
vector &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/ae76f98aa161c8e6255ff6aac4741c7745715b54.svg" style="height: 17px;" type="image/svg+xml"&gt;\widehat{P}&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f28d4a7d06cafd403cd826c0a670975b172ff67a.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\widehat{P}=\frac{\vec{P}_B-\vec{P}_A}{|\vec{P}_B-\vec{P}_A|}=\frac{\langle 4,0\rangle}{|\langle 4,0 \rangle|}=\langle1,0\rangle\]&lt;/object&gt;
&lt;p&gt;Then, the closing speed is:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f3b2874b8233cd8c1751ed5ff2fdfbae1d96c711.svg" style="height: 22px;" type="image/svg+xml"&gt;\[S_c=(\vec{V}_B-\vec{V}_A)\cdot\widehat{P}=\langle -3,0\rangle\cdot\langle1,0\rangle=-3\]&lt;/object&gt;
&lt;p&gt;Based on our convention, the negative sign of &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/b423d57e7c978d9b6f9e3d76c3e02f52cf5a1a17.svg" style="height: 15px;" type="image/svg+xml"&gt;S_c&lt;/object&gt; means that the
objects are approaching each other. Due to the simple nature of the
example, this result is easy to verify, as it can be immediately guessed
just by looking at the diagram.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example II&lt;/strong&gt;: Here &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/ae76f98aa161c8e6255ff6aac4741c7745715b54.svg" style="height: 17px;" type="image/svg+xml"&gt;\widehat{P}&lt;/object&gt; is the same as in the previous
example. The closing speed is:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f66ddd84100e0b1eaafe03b3afed57dc50a82965.svg" style="height: 22px;" type="image/svg+xml"&gt;\[S_c=(\vec{V}_B-\vec{V}_A)\cdot\widehat{P}=\langle 3,0\rangle\cdot\langle1,0\rangle=3\]&lt;/object&gt;
&lt;p&gt;Same magnitude, but different sign from before, because the objects are
moving farther apart.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example III&lt;/strong&gt; This example is to demonstrate that we get consistent
results even if B is to the left of A. Here the relative position unit
vector is:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/e7796cd9ca52dc9cf7de0692372020ef2303bbb8.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\widehat{P}=\frac{\vec{P}_B-\vec{P}_A}{|\vec{P}_B-\vec{P}_A|}=\frac{\langle -2,0\rangle}{|\langle -2,0 \rangle|}=\langle-1,0\rangle\]&lt;/object&gt;
&lt;p&gt;And the closing speed:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/67c72205da69531f03dd92be8d75a04c775e5342.svg" style="height: 22px;" type="image/svg+xml"&gt;\[S_c=(\vec{V}_B-\vec{V}_A)\cdot\widehat{P}=\langle 3,0\rangle\cdot\langle -1,0\rangle=-3\]&lt;/object&gt;
&lt;p&gt;Which is the same as in example I, as expected. The direction of
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/ae76f98aa161c8e6255ff6aac4741c7745715b54.svg" style="height: 17px;" type="image/svg+xml"&gt;\widehat{P}&lt;/object&gt; flipped, but so did the direction of the relative
velocity vector, so the result has the same sign.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Example IV&lt;/strong&gt;: Finally, an example showing more arbitrary positions and
velocities.&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/aa10ecf2964b6bfc8fc7613fe86515408c2fa555.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\widehat{P}=\frac{\vec{P}_B-\vec{P}_A}{|\vec{P}_B-\vec{P}_A|}=\frac{\langle 3,4\rangle}{|\langle 3,4 \rangle|}=\langle0.6,0.8\rangle\]&lt;/object&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/a03119506d85247140be836d2e7c898ba991e46e.svg" style="height: 22px;" type="image/svg+xml"&gt;\[S_c=(\vec{V}_B-\vec{V}_A)\cdot\widehat{P}=\langle -3,-6\rangle\cdot\langle 0.6,0.8\rangle=-6.6\]&lt;/object&gt;
&lt;p&gt;This example is a good opportunity to demonstrate something important
about &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/b423d57e7c978d9b6f9e3d76c3e02f52cf5a1a17.svg" style="height: 15px;" type="image/svg+xml"&gt;S_c&lt;/object&gt;: it’s time-dependent, because positions change with
time. Here, -6.6 is the closing speed at the exact moment when A’s and
B’s positions and velocities are as stated in the example. In the next
time step, the position of A will be &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/2bc27b863835e60fdba1357f797159dc72d77045.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle2,5\rangle&lt;/object&gt; and the
position of B will be &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/2450a84c29d863591b7db00ceada4f084bfb99ea.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle2,3\rangle&lt;/object&gt;, while their velocities
remain the same. The &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/b423d57e7c978d9b6f9e3d76c3e02f52cf5a1a17.svg" style="height: 15px;" type="image/svg+xml"&gt;S_c&lt;/object&gt; then will be quite different. This is a
good segue to the next topic - which is a more physical view of closing
speed.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="closing-speed-as-a-function-of-time"&gt;
&lt;h2&gt;Closing speed as a function of time&lt;/h2&gt;
&lt;p&gt;The computation shown so far represents a static view of the world;
perhaps the right word to use is &lt;em&gt;instantaneous&lt;/em&gt;. Given the positions
and velocities at a given moment, what is the closing speed between the
objects &lt;em&gt;at that exact moment&lt;/em&gt;?&lt;/p&gt;
&lt;p&gt;But there’s no reason to not generalize this using a more standard
physical interpretation of velocity.&lt;/p&gt;
&lt;p&gt;First, let’s state the position vectors of A and B as a function of
time: &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/4eb67887f180834938958d847a67ce8c4e833101.svg" style="height: 22px;" type="image/svg+xml"&gt;\vec{P}_A(t)&lt;/object&gt; and &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/3b69a9ddd6f52dba77380fd33edf1ce5adb8e57d.svg" style="height: 22px;" type="image/svg+xml"&gt;\vec{P}_B(t)&lt;/object&gt;. The relative
position vector between the objects is also a function of time:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/70dfcf594bc9407384d7c009f9a608eb3fef4e73.svg" style="height: 22px;" type="image/svg+xml"&gt;\[\vec{R}(t)=\vec{P}_B(t)-\vec{P}_A(t)\]&lt;/object&gt;
&lt;p&gt;Now we’ll define the scalar distance as the magnitude of this vector:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/7cdc889c6f871266456a41fba1c39755e176be60.svg" style="height: 22px;" type="image/svg+xml"&gt;\[r(t)=|\vec{R}(t)|=|\vec{P}_B(t)-\vec{P}_A(t)|\]&lt;/object&gt;
&lt;p&gt;We’re interested in &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/2e486b6ff05146a7eec038ad6e7e0fc8528811c3.svg" style="height: 24px;" type="image/svg+xml"&gt;\frac{dr(t)}{dt}&lt;/object&gt; - the change in this
distance over time. Let’s start by breaking &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/9f99e0576aed540806bce0791e5746726e6e413e.svg" style="height: 18px;" type="image/svg+xml"&gt;R(t)&lt;/object&gt; down to its
constituents:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f3fe85228247cba64b2cf42ab620ca2ad021f58e.svg" style="height: 51px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \vec{R}(t)&amp;amp;=\langle x(t),y(t)\rangle \\
    r(t)&amp;amp;=\sqrt{x(t)^2+y(t)^2}
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;By the chain rule &lt;a class="footnote-reference" href="#footnote-5" id="footnote-reference-5"&gt;[5]&lt;/a&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/6306fb3b34832bfa2973b4f5f2ce022e50e61bfc.svg" style="height: 100px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \frac{dr(t)}{dt}&amp;amp;=\frac{\frac{d}{dt}(x(t)^2+y(t)^2)}{2\sqrt{x(t)^2+y(t)^2}}\\
    &amp;amp;=\frac{2x(t)x&amp;#x27;(t)+2y(t)y&amp;#x27;(t)}{2\sqrt{x(t)^2+y(t)^2}}
    =\frac{x(t)x&amp;#x27;(t)+y(t)y&amp;#x27;(t)}{\sqrt{x(t)^2+y(t)^2}}
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Switching back to the vector representation: since
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/07a18a0fb49fd212904167765ad6d84a0c82e087.svg" style="height: 22px;" type="image/svg+xml"&gt;\vec{R}(t)=\langle x(t),y(t)\rangle&lt;/object&gt;, the numerator of the
fraction above is then a dot product between &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/7c50f292ef65e21556b433d72d5c11b6e9f87ecf.svg" style="height: 22px;" type="image/svg+xml"&gt;\vec{R}(t)&lt;/object&gt; and
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/4dfa75b6830d41bca1c17cdb195e628f68ed338b.svg" style="height: 22px;" type="image/svg+xml"&gt;\vec{R}&amp;#x27;(t)&lt;/object&gt;, we can write this as:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/a42dd678ac96ed753c3c3526680198572a2fe257.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\frac{dr(t)}{dt}=\frac{\vec{R}(t)\cdot\vec{R}&amp;#x27;(t)}{|\vec{R}(t)|}=\hat{R}(t)\cdot\vec{R}&amp;#x27;(t)\]&lt;/object&gt;
&lt;p&gt;But &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/54361db0be49009bd9ab092a77a7a00ddf8a1639.svg" style="height: 21px;" type="image/svg+xml"&gt;\hat{R}(t)&lt;/object&gt; is precisely &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/1787f35be0deea91d648e299fd551f3dcb3e44b5.svg" style="height: 17px;" type="image/svg+xml"&gt;\hat{P}&lt;/object&gt; from the earlier
section, as a function of time. Moreover:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/a98048e9ed9db3cf9b4799aa6f6146b7dd2cb992.svg" style="height: 22px;" type="image/svg+xml"&gt;\[\vec{R}&amp;#x27;(t)=\vec{P}&amp;#x27;_B(t)-\vec{P}&amp;#x27;_A(t)=\vec{V}_B(t)-\vec{V}_A(t)\]&lt;/object&gt;
&lt;p&gt;Because velocity is the time derivative of position. Therefore, we end
up with the same equation, just as a function of time:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/e3e0da99f86f0ff329cba714e12223664276b75c.svg" style="height: 38px;" type="image/svg+xml"&gt;\[\frac{dr(t)}{dt}=\hat{P}(t)\cdot(\vec{V}_B(t)-\vec{V}_A(t))\]&lt;/object&gt;
&lt;p&gt;This formulation is more precise because it makes it very obvious that
all the quantities we’re dealing with are time dependent.&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Throughout this post, we assume our objects are sufficiently far
apart that they can be treated as &lt;em&gt;points&lt;/em&gt; (or &lt;em&gt;particles&lt;/em&gt;) without
any shape, area or volume.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;The velocity components should be the same regardless of how far
apart the two objects are.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-3"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;In the standard projection formula we’d also divide by the magnitude
of &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/ae76f98aa161c8e6255ff6aac4741c7745715b54.svg" style="height: 17px;" type="image/svg+xml"&gt;\widehat{P}&lt;/object&gt;, but in our case it’s a unit vector anyway.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-4" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-4"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;In some online sources you may see the closing speed described as
closing velocity because it has a direction. IMHO this is the wrong
framing. Scalars can be signed! The closing speed is certainly a
scalar, not a vector.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-5"&gt;[5]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;The notation &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/8cef7d030134448b059cf3ccf9ef9edc29b769c0.svg" style="height: 18px;" type="image/svg+xml"&gt;x&amp;#x27;(t)&lt;/object&gt; means &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/153450414b2add185e4ad0b5fe515c2835446bfe.svg" style="height: 24px;" type="image/svg+xml"&gt;\frac{dx(t)}{dt}&lt;/object&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="misc"></category><category term="Math"></category></entry><entry><title>Notes on the Fourier Transform</title><link href="https://eli.thegreenplace.net/2026/notes-on-the-fourier-transform/" rel="alternate"></link><published>2026-07-14T20:04:00-07:00</published><updated>2026-07-15T03:04:11-07:00</updated><author><name>Eli Bendersky</name></author><id>tag:eli.thegreenplace.net,2026-07-14:/2026/notes-on-the-fourier-transform/</id><summary type="html">&lt;link rel="stylesheet" href="https://eli.thegreenplace.net/demos/fourier/windowed.css"&gt;&lt;p&gt;The Fourier series is a great tool for analyzing periodic functions. But
what about functions that don’t repeat? &lt;a class="reference external" href="https://eli.thegreenplace.net/2026/notes-on-fourier-series/"&gt;We’ve
seen&lt;/a&gt;
that we can compute Fourier series for a non-periodic function defined
on a finite interval, as long as we don’t care about its behavior beyond
that interval …&lt;/p&gt;</summary><content type="html">&lt;link rel="stylesheet" href="https://eli.thegreenplace.net/demos/fourier/windowed.css"&gt;&lt;p&gt;The Fourier series is a great tool for analyzing periodic functions. But
what about functions that don’t repeat? &lt;a class="reference external" href="https://eli.thegreenplace.net/2026/notes-on-fourier-series/"&gt;We’ve
seen&lt;/a&gt;
that we can compute Fourier series for a non-periodic function defined
on a finite interval, as long as we don’t care about its behavior beyond
that interval.&lt;/p&gt;
&lt;p&gt;Let’s extend this idea to functions that &lt;em&gt;never&lt;/em&gt; repeat; that is,
non-periodic functions defined on the interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/1cf8fee97b88d4aa5eb4787c05b533d0db945e98.svg" style="height: 18px;" type="image/svg+xml"&gt;(-\infty,\infty)&lt;/object&gt;.&lt;/p&gt;
&lt;div class="section" id="visualizing-fourier-series-for-non-repeating-functions"&gt;
&lt;h2&gt;Visualizing Fourier series for non-repeating functions&lt;/h2&gt;
&lt;p&gt;To motivate the subject ahead, let’s look back at the example used in
the earlier &lt;a class="reference external" href="https://eli.thegreenplace.net/2026/notes-on-fourier-series/"&gt;post about Fourier
series&lt;/a&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/219270dd9765adc74c363412ff71219137e90f0c.svg" style="height: 51px;" type="image/svg+xml"&gt;\[t(x)=
\begin{cases}
    x     &amp;amp;  0 \leq x \leq 1 \\
    2-x   &amp;amp;  1 &amp;lt; x \leq 2  \\
\end{cases}\]&lt;/object&gt;
&lt;p&gt;With an odd extension into &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/8291e9956dc145c0d40503664cdb2aa8907faeec.svg" style="height: 17px;" type="image/svg+xml"&gt;[-2,0]&lt;/object&gt;. In that post, to make the
Fourier series work, we assumed &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; keeps repeating with a
period &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/8f459dda90739295986eb4ce950ace772ec696f7.svg" style="height: 12px;" type="image/svg+xml"&gt;2L=4&lt;/object&gt; on the entire &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; axis. Here, let’s face the
reality that it does not - in fact - repeat, and observe how our Fourier
series work out.&lt;/p&gt;
&lt;p&gt;Recall that the Fourier series approximating &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; are the sine
series (since it’s an odd function):&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/7942a20004aaf07d850b012826c56720f6efa3ce.svg" style="height: 41px;" type="image/svg+xml"&gt;\[t(x)=\frac{8}{\pi^2}\bigg[ sin\frac{\pi x}{2}-\frac{1}{3^2} sin\frac{3\pi x}{2}+\frac{1}{5^2}sin\frac{5\pi x}{2}-\cdots\bigg]\]&lt;/object&gt;
&lt;p&gt;The following visualization is interactive. By default, it shows
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; (with its odd extension) and no Fourier series
approximation. We’ll proceed by a series of steps and observe the
outcome:&lt;/p&gt;
&lt;div class="plot-stack"&gt;
  &lt;canvas id="series-canvas" class="canvas" width="760" height="470"&gt;&lt;/canvas&gt;

  &lt;div class="controls"&gt;
    &lt;div class="number-controls"&gt;
      &lt;div class="number-control"&gt;
        &lt;label for="terms-number"&gt;n (terms in the Fourier series)&lt;/label&gt;
        &lt;input id="terms-number" type="number" min="0" max="500" step="1" value="0"&gt;
      &lt;/div&gt;

      &lt;div class="number-control"&gt;
        &lt;label for="interval-l"&gt;L&lt;/label&gt;
        &lt;input id="interval-l" type="number" min="2" max="128" step="1" value="2"&gt;
      &lt;/div&gt;

      &lt;div class="number-control"&gt;
        &lt;label for="x-min"&gt;x min&lt;/label&gt;
        &lt;input id="x-min" type="number" min="-512" max="511" step="1" value="-16"&gt;
      &lt;/div&gt;

      &lt;div class="number-control"&gt;
        &lt;label for="x-max"&gt;x max&lt;/label&gt;
        &lt;input id="x-max" type="number" min="-511" max="512" step="1" value="16"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;canvas id="coeffs-canvas" class="canvas" width="760" height="260"&gt;&lt;/canvas&gt;
&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: set &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt; to some non-zero number; already at 3, the
approximation is very good.&lt;/p&gt;
&lt;p&gt;The frequency spacing is &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/5a600bbe993cfd18233241243dff681270daa29f.svg" style="height: 19px;" type="image/svg+xml"&gt;\frac{\pi}{L}&lt;/object&gt; (this is the coefficient
of &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; in the sines). Note that the Fourier series repeats every
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/8dde33545500de38fae974b4b18036def142e9e3.svg" style="height: 12px;" type="image/svg+xml"&gt;2L&lt;/object&gt;, as expected.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: increase &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt; to 6. This means our series are
constructed assuming &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; has a period of 12, not 4. Note how
the Fourier series look now - they repeat every 12, and they don’t match
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; as well as before. We can increase &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt; to a higher
number to make the match better. As &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt; grows, the spacing between
adjacent frequencies decreases.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: increase &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt; to 10. We no longer see the repetitions,
so feel free to increase the values of &lt;em&gt;x min&lt;/em&gt; and &lt;em&gt;x max&lt;/em&gt; until you do.
Note again that we need to add more and more coefficients to match
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; better with this larger &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt;, and the spacing adjacent
frequencies grows smaller.&lt;/p&gt;
&lt;p&gt;Increasing &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt; means our function repeats at larger and larger
intervals. The logical conclusion of this progression is to ask - what
happens if the function &lt;em&gt;never&lt;/em&gt; repeats, meaning
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/7024b94c8e1c4e174500651fed6f4034b91338e2.svg" style="height: 12px;" type="image/svg+xml"&gt;L\rightarrow\infty&lt;/object&gt;? While not mathematically rigorous, the
visual experiment here lets us make some conjectures: we’ll likely need
an infinite number of coefficients for a good approximation, and
moreover, the spacing between these coefficients will tend to zero.&lt;/p&gt;
&lt;p&gt;In other words, instead of a discrete set of coefficients, we’ll end up
with a continuous line, or &lt;em&gt;function&lt;/em&gt;. The function produced by this
process is the Fourier transform of &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt;, and the next section
shows its mathematical derivation.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="fourier-series-with-l-rightarrow-infty-leading-to-fourier-transform"&gt;
&lt;h2&gt;Fourier series with &lt;object class="valign-0 latex-math heading-math" data="https://eli.thegreenplace.net/images/math/7024b94c8e1c4e174500651fed6f4034b91338e2.svg" style="height: 18px;" type="image/svg+xml"&gt;L\rightarrow\infty&lt;/object&gt; leading to Fourier transform&lt;/h2&gt;
&lt;p&gt;In these notes, we’ll be using the complex exponential formulation of
Fourier series:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/0330fae433a3379cfef316d192bfe32e38e0c9c9.svg" style="height: 47px;" type="image/svg+xml"&gt;\[f(x)=\sum_{n=-\infty}^{\infty}C_n\cdot e^{in\pi x/L}\]&lt;/object&gt;
&lt;p&gt;With:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/d70fa4e75b4b604398d8d3c108a75bea622e72ef.svg" style="height: 43px;" type="image/svg+xml"&gt;\[C_n=\frac{1}{2L}\int_{-L}^{L}f(x)e^{-in\pi x/L}dx\]&lt;/object&gt;
&lt;p&gt;We’re interested in a non-periodic &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; defined on the interval
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/1cf8fee97b88d4aa5eb4787c05b533d0db945e98.svg" style="height: 18px;" type="image/svg+xml"&gt;(-\infty,\infty)&lt;/object&gt;. So we’ll be exploring the above equations for
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/7024b94c8e1c4e174500651fed6f4034b91338e2.svg" style="height: 12px;" type="image/svg+xml"&gt;L\rightarrow\infty&lt;/object&gt;.&lt;/p&gt;
&lt;p&gt;First, let’s make a slight change of notation. Instead of writing
formulae in terms of the period (&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/8dde33545500de38fae974b4b18036def142e9e3.svg" style="height: 12px;" type="image/svg+xml"&gt;2L&lt;/object&gt;), we’ll be using the n-th
harmonic angular frequency &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/a155ec23f6c406ec631eab262deac5c2207fc6f0.svg" style="height: 10px;" type="image/svg+xml"&gt;w_n&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/a8298e8efef6e84054c4b533455925ee5428587e.svg" style="height: 32px;" type="image/svg+xml"&gt;\[w_n=\frac{n\pi}{L}\]&lt;/object&gt;
&lt;p&gt;So we can slightly rewrite our series as:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/425809fafb73e6c3b365009d48f60e3c8b97c3f6.svg" style="height: 50px;" type="image/svg+xml"&gt;\[f(x)=\sum_{n=-\infty}^{\infty}C_n\cdot e^{i w_n x}=\sum_{n=-\infty}^{\infty}C_n\cdot e^{i\cdot n \Delta w x}\]&lt;/object&gt;
&lt;p&gt;Using &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/485c352e1532df3fe1ad52c8ac1ec6cdcefae85f.svg" style="height: 12px;" type="image/svg+xml"&gt;\Delta w&lt;/object&gt; as the difference between two consecutive
frequencies:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/4a4e5e3ca5b4efb65f808b54881624aab7e7786d.svg" style="height: 38px;" type="image/svg+xml"&gt;\[\Delta w=w_n-w_{n-1}=\frac{n\pi}{L}-\frac{(n-1)\pi}{L}=\frac{\pi}{L}\]&lt;/object&gt;
&lt;p&gt;Using this notation, &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e6456786af3c999a8eda7658e37f7bf5d1bb0db0.svg" style="height: 14px;" type="image/svg+xml"&gt;C_n&lt;/object&gt; is expressed as:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/0afc21dea01d897ed8870f1614de19df218852df.svg" style="height: 49px;" type="image/svg+xml"&gt;\[C_n=\frac{\Delta w}{2\pi}\int_{-\pi/\Delta w}^{\pi/\Delta w}f(x)e^{-i\cdot n \Delta w x}dx\]&lt;/object&gt;
&lt;p&gt;So far there are no new insights here, just some new notation. Now we’re
going to use it to facilitate the next step.&lt;/p&gt;
&lt;p&gt;Since &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/2655eaa60b6a8bca030a08db9d96cdf601c2313f.svg" style="height: 12px;" type="image/svg+xml"&gt;L\rightarrow \infty&lt;/object&gt;, then &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/96155e6778d2196553d71682f0d84e6dae76c5bf.svg" style="height: 12px;" type="image/svg+xml"&gt;\Delta w\rightarrow 0&lt;/object&gt;.
Let’s calculate the limit of the Fourier series representation of
&lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; when &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/96155e6778d2196553d71682f0d84e6dae76c5bf.svg" style="height: 12px;" type="image/svg+xml"&gt;\Delta w\rightarrow 0&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/3dd92646779c57175e26c408f74a5bc4685a082a.svg" style="height: 50px;" type="image/svg+xml"&gt;\[f(x)=\lim_{\Delta w\rightarrow 0}\sum_{n=-\infty}^{\infty}C_n\cdot e^{i\cdot n \Delta w x}\]&lt;/object&gt;
&lt;p&gt;And substitute the latest &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e6456786af3c999a8eda7658e37f7bf5d1bb0db0.svg" style="height: 14px;" type="image/svg+xml"&gt;C_n&lt;/object&gt; into this equation, changing its
dummy integration variable from &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; to &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/8efd86fb78a56a5145ed7739dcb00c78581c5375.svg" style="height: 11px;" type="image/svg+xml"&gt;t&lt;/object&gt; to avoid
confusion &lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/36a8195b73e44ed8613e73e0d7021aa8eb6767fb.svg" style="height: 54px;" type="image/svg+xml"&gt;\[f(x)=\lim_{\Delta w\rightarrow 0}\sum_{n=-\infty}^{\infty}\left[\frac{\Delta w}{2\pi}\int_{-\pi/\Delta w}^{\pi/\Delta w}f(t)e^{-i\cdot n \Delta w t}dt\right]\cdot e^{i\cdot n \Delta w x}\]&lt;/object&gt;
&lt;p&gt;Reordering slightly, and also replacing &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/0c1caf138427d4c92d372c96fcff58fd614da6b0.svg" style="height: 12px;" type="image/svg+xml"&gt;n\Delta w&lt;/object&gt; by &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/a155ec23f6c406ec631eab262deac5c2207fc6f0.svg" style="height: 10px;" type="image/svg+xml"&gt;w_n&lt;/object&gt;
in the complex exponents:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/b30de7a7210644adeebf557aff3ab51cb7404071.svg" style="height: 54px;" type="image/svg+xml"&gt;\[f(x)=\frac{1}{2\pi}\lim_{\Delta w\rightarrow 0}\sum_{n=-\infty}^{\infty}\left[\int_{-\pi/\Delta w}^{\pi/\Delta w}f(t)e^{-i\cdot w_n t}dt\right]\cdot e^{i\cdot w_n x}\Delta w\]&lt;/object&gt;
&lt;p&gt;Looking at the limit with the sum carefully, this is a Riemann sum (see
Appendix A)! &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/a155ec23f6c406ec631eab262deac5c2207fc6f0.svg" style="height: 10px;" type="image/svg+xml"&gt;w_n&lt;/object&gt; is the &amp;quot;sampled&amp;quot; version of &lt;img alt="w" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 7px;" /&gt;, and
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/96155e6778d2196553d71682f0d84e6dae76c5bf.svg" style="height: 12px;" type="image/svg+xml"&gt;\Delta w\rightarrow 0&lt;/object&gt;. We can therefore replace it by an
integral, changing &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/a155ec23f6c406ec631eab262deac5c2207fc6f0.svg" style="height: 10px;" type="image/svg+xml"&gt;w_n&lt;/object&gt; to &lt;img alt="w" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 7px;" /&gt; and &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/485c352e1532df3fe1ad52c8ac1ec6cdcefae85f.svg" style="height: 12px;" type="image/svg+xml"&gt;\Delta w&lt;/object&gt; to
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/e2c44c572970480e0089da2b6ef90adce84d30fd.svg" style="height: 12px;" type="image/svg+xml"&gt;dw&lt;/object&gt; &lt;a class="footnote-reference" href="#footnote-2" id="footnote-reference-2"&gt;[2]&lt;/a&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/0d75ff66b6512adbf6049eae18dcd320e5908736.svg" style="height: 43px;" type="image/svg+xml"&gt;\[f(x)=\frac{1}{2\pi}\int_{-\infty}^{\infty}\left[\int_{-\infty}^{\infty}f(t)e^{-i\cdot wt}dt\right]\cdot e^{i\cdot w x}dw\]&lt;/object&gt;
&lt;p&gt;The inner integral is called the &lt;em&gt;Fourier transform&lt;/em&gt; of &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; and
denoted &lt;a class="footnote-reference" href="#footnote-3" id="footnote-reference-3"&gt;[3]&lt;/a&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/07b9baf87b9916d224d769466df53dbf352d2a1b.svg" style="height: 52px;" type="image/svg+xml"&gt;\[\boxed{\hat{f}(w)=\mathcal{F}\left[f(x)\right]=\int_{-\infty}^{\infty}f(x)e^{-i\cdot wx}dx}\]&lt;/object&gt;
&lt;p&gt;And the full equation for &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; is then the &lt;em&gt;inverse&lt;/em&gt; Fourier
transform:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/47a2a5bfdc5feed1ef59d8e8311c47539c409ce7.svg" style="height: 52px;" type="image/svg+xml"&gt;\[\boxed{f(x)=\mathcal{F}^{-1}\left[\hat{f}(w)\right]=\frac{1}{2\pi}\int_{-\infty}^{\infty}\hat{f}(w)e^{i\cdot w x}dw}\]&lt;/object&gt;
&lt;/div&gt;
&lt;div class="section" id="example-calculation-of-fourier-transform"&gt;
&lt;h2&gt;Example calculation of Fourier transform&lt;/h2&gt;
&lt;p&gt;Let’s take our favorite odd triangular pulse example and calculate its
Fourier transform. The function’s mathematical definition and plot are
shown earlier in this post. Note that we’re not extending this function
periodically - it’s zero beyond the range &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/e3408d8a911334402313d66a53871a1c3b55607b.svg" style="height: 18px;" type="image/svg+xml"&gt;[-2,2]&lt;/object&gt;; this is
exactly why we need the Fourier transform here - as we’ve seen, Fourier
series won’t do because the function they reconstruct eventually starts
repeating.&lt;/p&gt;
&lt;p&gt;We’re looking to find:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/5506bcc40980dfd48a97a2b91f74d4c50727287f.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\hat{t}(w)=\int_{-\infty}^{\infty}t(x)e^{-iwx}dx\]&lt;/object&gt;
&lt;p&gt;To calculate the integral, let’s decompose the complex exponent using
Euler’s formula:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/292ca30113586e23eea20039364286010326b698.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\hat{t}(w)=\int_{-\infty}^{\infty}t(x)cos(wx)dx-i\int_{-\infty}^{\infty}t(x)sin(wx)dx\]&lt;/object&gt;
&lt;p&gt;Since our &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; is odd, the &lt;a class="reference external" href="https://eli.thegreenplace.net/2025/notes-on-even-and-odd-functions/"&gt;first integral is
zero&lt;/a&gt;.
Also &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/4a37025f97bbb1bd1112f679a4d4a835b0655d9a.svg" style="height: 18px;" type="image/svg+xml"&gt;t(x)sin(wx)&lt;/object&gt; is even, so we can write:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/8f6ce1d110a97ebbeed69dd3d0c1d13005d61f29.svg" style="height: 42px;" type="image/svg+xml"&gt;\[\hat{t}(w)=-2i\int_{0}^{\infty}t(x)sin(wx)dx\]&lt;/object&gt;
&lt;p&gt;We’ve already calculated a very similar integral in the &lt;a class="reference external" href="https://eli.thegreenplace.net/2026/notes-on-fourier-series/"&gt;post on Fourier
series&lt;/a&gt;,
so let’s just skip to the result:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/04fd51ed0652d76467822ab94caff1646ac72c72.svg" style="height: 38px;" type="image/svg+xml"&gt;\[\hat{t}(w)=-2i\cdot\frac{2\cdot sin(w)-sin(2w)}{w^2}\]&lt;/object&gt;
&lt;p&gt;The only remaining difficulty is its value at 0, which seems undefined
at first (division by zero). However, note that as
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/29f6b518c7088d0c00dca4681f333cf8aa8dac2c.svg" style="height: 12px;" type="image/svg+xml"&gt;w\rightarrow 0&lt;/object&gt;, the numerator also tends to 0, so we can use
L’Hopital’s rule (twice!) to find that:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/22b22759b568da532013a7b794fd45efc56bd45a.svg" style="height: 27px;" type="image/svg+xml"&gt;\[\lim_{w\rightarrow 0} \hat{t}(w)=0\]&lt;/object&gt;
&lt;p&gt;Therefore:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/273a16b2d33abc3b6237a01b85c051fd8964c7aa.svg" style="height: 54px;" type="image/svg+xml"&gt;\[\hat{t}(w)=
\begin{cases}
    -2i\cdot\frac{2\cdot sin(w)-sin(2w)}{w^2}     &amp;amp;  w\neq 0 \\
0   &amp;amp;  w=0  \\
\end{cases}\]&lt;/object&gt;
&lt;p&gt;This function is complex-valued; in fact, it’s purely imaginary. How do
we visualize it? A common way to visualize complex-valued functions is
by plotting their magnitude and phase separately.&lt;/p&gt;
&lt;p&gt;The magnitude of &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/0e6e891eb70ed9e095f8516b2fc3f201c0bf9d8e.svg" style="height: 20px;" type="image/svg+xml"&gt;\hat{t}(w)&lt;/object&gt; is:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/c77013c89e8bff5b08d1a65f7b4446b2b58be3c4.svg" style="height: 43px;" type="image/svg+xml"&gt;\[|\hat{t}(w)|=\sqrt{\hat{t}(w)\cdot\hat{t}(w)^*}=2\left|\frac{2\cdot sin(w)-sin(2w)}{w^2} \right|\]&lt;/object&gt;
&lt;p&gt;Since &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/0e6e891eb70ed9e095f8516b2fc3f201c0bf9d8e.svg" style="height: 20px;" type="image/svg+xml"&gt;\hat{t}(w)&lt;/object&gt; is purely imaginary, there are only two options
for the phase:&lt;/p&gt;
&lt;p&gt;When the numerator is positive, we get a negative imaginary number with
phase &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/2adf81a4226f7a9a304fbb318c5cebf66d36767a.svg" style="height: 18px;" type="image/svg+xml"&gt;-\pi/2&lt;/object&gt;, and when the numerator is negative, we get a
positive imaginary number with phase &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/9a0abc6cd5f06f21e0cde768dd87e46761225d7c.svg" style="height: 18px;" type="image/svg+xml"&gt;\pi/2&lt;/object&gt;. Finally, when
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/34f7cc2b88e04307f30fd5ec74afec4960849abb.svg" style="height: 20px;" type="image/svg+xml"&gt;\hat{t}(w)=0&lt;/object&gt; (which happens at &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/ed0fa1c268b0a22f58e3bbc08ee1bc0b03b10ce6.svg" style="height: 12px;" type="image/svg+xml"&gt;w=0&lt;/object&gt;, by our earlier
analysis, but also whenever &lt;img alt="w" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 7px;" /&gt; is a whole multiple of
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6ac47b6d7372b4087583cfd048d20f4c1571f5cf.svg" style="height: 7px;" type="image/svg+xml"&gt;\pi&lt;/object&gt;), the phase is undefined.&lt;/p&gt;
&lt;p&gt;Here’s the magnitude and phase of &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/0e6e891eb70ed9e095f8516b2fc3f201c0bf9d8e.svg" style="height: 20px;" type="image/svg+xml"&gt;\hat{t}(w)&lt;/object&gt; plotted against
&lt;img alt="w" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 7px;" /&gt;:&lt;/p&gt;
&lt;img alt="Magnitude and phase of the fourier transform of t(x)" class="align-center" src="https://eli.thegreenplace.net/images/2026/ft-triangle.png" /&gt;
&lt;p&gt;It is common to talk about &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/0e6e891eb70ed9e095f8516b2fc3f201c0bf9d8e.svg" style="height: 20px;" type="image/svg+xml"&gt;\hat{t}(w)&lt;/object&gt; as the &lt;em&gt;frequency domain&lt;/em&gt;
representation of &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="the-frequency-domain-representation-of-functions"&gt;
&lt;h2&gt;The frequency domain representation of functions&lt;/h2&gt;
&lt;p&gt;When the functions we’re working with have &lt;em&gt;time&lt;/em&gt; as their domain (e.g.
the &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; in &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; represents time), which is often the case
in the study of signals and systems, the Fourier transform can be seen
as computing the &lt;em&gt;frequency domain&lt;/em&gt; representation of the function.&lt;/p&gt;
&lt;p&gt;Here’s the Fourier transform formula again:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/2205c7692318aadcd75f8fc3daf794dabccf4b1c.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\hat{f}(w)=\mathcal{F}\left[f(x)\right]=\int_{-\infty}^{\infty}f(x)e^{-i\cdot wx}dx\]&lt;/object&gt;
&lt;p&gt;It takes &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; - the &lt;em&gt;time domain&lt;/em&gt; representation of a function,
and converts it to &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/9bff3d85604c5a00197a2164be2410dac224875c.svg" style="height: 22px;" type="image/svg+xml"&gt;\hat{f}(w)&lt;/object&gt; - a &lt;em&gt;frequency domain&lt;/em&gt;
representation. For well-behaved functions, these two representations
are dual - each one describes the function completely, just in a
different way.&lt;/p&gt;
&lt;p&gt;To convert back from a frequency domain representation to the time
domain, we use the inverse Fourier transform:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/2de25f35b6f53ae6a33c7113aaf818605e809eb5.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}^{-1}\left[\hat{f}(w)\right]=\frac{1}{2\pi}\int_{-\infty}^{\infty}\hat{f}(w)e^{i\cdot w x}dw\]&lt;/object&gt;
&lt;p&gt;While a time-domain plot (&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt;) shows how a signal changes over
time, a frequency-domain plot (&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/0e6e891eb70ed9e095f8516b2fc3f201c0bf9d8e.svg" style="height: 20px;" type="image/svg+xml"&gt;\hat{t}(w)&lt;/object&gt;) shows how the signal
is distributed across all possible frequencies. Moreover, as we’ve seen,
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/0e6e891eb70ed9e095f8516b2fc3f201c0bf9d8e.svg" style="height: 20px;" type="image/svg+xml"&gt;\hat{t}(w)&lt;/object&gt; is complex valued. Each frequency therefore has both
a magnitude and a phase: the magnitude tells us how strongly that
frequency contributes, while the phase tells us how that component is
shifted.&lt;/p&gt;
&lt;p&gt;The frequency domain is extremely useful in signal analysis; for
example, when designing filters.&lt;/p&gt;
&lt;p&gt;The Fourier transform also has a number of properties that are very
useful in signal analysis and processing. But first, let’s discuss what
a &amp;quot;well-behaved function&amp;quot; means for the purpose of applying Fourier
transforms.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="existence-condition-for-the-fourier-transform"&gt;
&lt;h2&gt;Existence condition for the Fourier transform&lt;/h2&gt;
&lt;p&gt;The simplest existence condition for Fourier transforms is absolute
integrability (also known as Lebesgue integrable):&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/a84f50b71f5f603ba8615fa9ce011a0bdf724c9f.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\int_{-\infty}^{\infty}|f(x)|dx&amp;lt;\infty\]&lt;/object&gt;
&lt;p&gt;With this condition, &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/9bff3d85604c5a00197a2164be2410dac224875c.svg" style="height: 22px;" type="image/svg+xml"&gt;\hat{f}(w)&lt;/object&gt; exists on the entire &lt;img alt="w" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 7px;" /&gt;
domain, is continuous and vanishes (tends to 0) as
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/ada7e71c306e8a50144d68218845379d20e80e2a.svg" style="height: 18px;" type="image/svg+xml"&gt;|w|\rightarrow\infty&lt;/object&gt;  &lt;a class="footnote-reference" href="#footnote-4" id="footnote-reference-4"&gt;[4]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;While this condition is sufficient, it’s not necessary; there are less
well-behaved functions that also have Fourier transforms defined with
some limitations. In these notes, we’re mostly interested in
well-behaved functions that are used in real-world engineering, so we
won’t discuss the other cases.&lt;/p&gt;
&lt;p&gt;Another assumption commonly made for real-world functions is that they
vanish (tend to 0) as &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/82b120c729a8ff220a8f0fe52ac392486c01b204.svg" style="height: 18px;" type="image/svg+xml"&gt;|x|\rightarrow\infty&lt;/object&gt;. While this is not a
direct outcome of absolute integrability &lt;a class="footnote-reference" href="#footnote-5" id="footnote-reference-5"&gt;[5]&lt;/a&gt;, it’s a reasonable
assumption in engineering. After all, real-world signals have finite
energies.&lt;/p&gt;
&lt;p&gt;Intuitively, when we also assume &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; is &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Uniform_continuity"&gt;uniformly
continuous&lt;/a&gt;, the
assumption of vanishing at &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/82b120c729a8ff220a8f0fe52ac392486c01b204.svg" style="height: 18px;" type="image/svg+xml"&gt;|x|\rightarrow\infty&lt;/object&gt; is a logical
conclusion, because otherwise how can the total area for &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/f81ff470d42c28556754b096c397ea462c3950b9.svg" style="height: 18px;" type="image/svg+xml"&gt;|f(x)|&lt;/object&gt;
be finite?&lt;/p&gt;
&lt;p&gt;An important outcome of this discussion is that the Fourier transform is
unsuitable for periodic functions. Functions that repeat at intervals
&lt;em&gt;are not absolute integrable&lt;/em&gt;. For periodic functions, we use Fourier
series.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="some-useful-properties-of-fourier-transforms"&gt;
&lt;h2&gt;Some useful properties of Fourier transforms&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Linearity&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Fourier transform is a linear operator, because the integral is
linear:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/9a9c05c7059486e502bb8ef0ff3c868ac6597406.svg" style="height: 115px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \mathcal{F}\left[\alpha f(x)+\beta g(x)\right]&amp;amp;=\int_{-\infty}^{\infty}\alpha f(x)e^{-i\cdot wx}dx+\int_{-\infty}^{\infty}\beta g(x)e^{-i\cdot wx}dx\\
    &amp;amp;=\alpha\int_{-\infty}^{\infty}f(x)e^{-i\cdot wx}dx+\beta\int_{-\infty}^{\infty}g(x)e^{-i\cdot wx}dx\\
    &amp;amp;=\alpha\mathcal{F}\left[f(x)\right]+\beta\mathcal{F}\left[g(x)\right]
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;So is the inverse Fourier transform; it’s similarly easy to show that:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/ceb89864f3fa7c77f1a9e6ed8f63fa75aedd368a.svg" style="height: 32px;" type="image/svg+xml"&gt;\[\mathcal{F}^{-1}\left[\alpha\hat{f}(w)+\beta\hat{g}(w)\right]=
\alpha\mathcal{F}^{-1}\left[\hat{f}(w)\right]+\beta\mathcal{F}^{-1}\left[\hat{g}(w)\right]\]&lt;/object&gt;
&lt;p&gt;&lt;strong&gt;Scaling&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If we scale the domain of a function by a constant, its transform
changes only slightly:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/1c9ad54d80807d0cbeaa45001191bfc428550eca.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[f(ax)\right]=\int_{-\infty}^{\infty}f(ax)e^{-i\cdot wx}dx\]&lt;/object&gt;
&lt;p&gt;Let’s do the variable substitution &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6bc4494513070aed18d92705ed2b2f6d3f11c06e.svg" style="height: 8px;" type="image/svg+xml"&gt;u=ax&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/afeab98c97af01549cebd9b6865d3eee363d7c54.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[f(ax)\right]=\frac{1}{a}\int_{-\infty}^{\infty}f(u)e^{-i\cdot \frac{wu}{a}}du\]&lt;/object&gt;
&lt;p&gt;This is the Fourier transform evaluated at &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/96bad6acb3e083e5c40a140be76e315fc38a0200.svg" style="height: 19px;" type="image/svg+xml"&gt;\frac{w}{a}&lt;/object&gt;, so:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/9bd358bb9fbe2b08ec4aa6ed1967b52abc440b30.svg" style="height: 36px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[f(ax)\right]=\frac{1}{a}\hat{f}\left(\frac{w}{a}\right)\]&lt;/object&gt;
&lt;p&gt;There’s one small caveat here; when &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/86f7e437faa5a7fce15d1ddcb9eaeaea377667b8.svg" style="height: 7px;" type="image/svg+xml"&gt;a&lt;/object&gt; is negative, the integral
bounds should be flipped, causing a minus sign in front of the
transform. So we can write:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/b7e9ea4076f6b14c02d31e9efa69739dbc49e418.svg" style="height: 40px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[f(ax)\right]=\frac{1}{|a|}\hat{f}\left(\frac{w}{a}\right)\]&lt;/object&gt;
&lt;p&gt;Which works for any &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/bea889333f2129c15a3c4d1075622fe6d3af6091.svg" style="height: 16px;" type="image/svg+xml"&gt;a\ne 0&lt;/object&gt;.&lt;/p&gt;
&lt;p&gt;This property is intuitive when thinking about signals: suppose
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/496e056115bfe6ab294623525a9f7892000e8dcb.svg" style="height: 12px;" type="image/svg+xml"&gt;a&amp;gt;0&lt;/object&gt;, then &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/80a7826fb0e21d406f279cfd05998f9ca6d7ddd9.svg" style="height: 18px;" type="image/svg+xml"&gt;f(ax)&lt;/object&gt; means the signal is &lt;em&gt;compressed&lt;/em&gt; in the
time domain by a factor &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/86f7e437faa5a7fce15d1ddcb9eaeaea377667b8.svg" style="height: 7px;" type="image/svg+xml"&gt;a&lt;/object&gt;. The scaling property says that the
frequency domain is &lt;em&gt;expanded&lt;/em&gt; using the same factor; in other words,
the higher frequencies become more prominent because we need sharper
transitions to represent the compressed signal.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Time shifting&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;What happens to the Fourier transform if we time-shift the input signal
by some constant: &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/90aa755a71f6fd6a4007dad9bbc63a2c476cdaaf.svg" style="height: 18px;" type="image/svg+xml"&gt;f(x-x_0)&lt;/object&gt;. By definition:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/9ca72dc1140fbec6eaeaf5addeb6d58647c46e9f.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[f(x-x_0)\right]=\int_{-\infty}^{\infty}f(x-x_0)e^{-i\cdot wx}dx\]&lt;/object&gt;
&lt;p&gt;Substituting &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/f0c6d185a731f9b08b4a02bc1360bbeec100f728.svg" style="height: 13px;" type="image/svg+xml"&gt;u=x-x_0&lt;/object&gt;, we get &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/febc1f31b2dbfc3e5d91801704e4d37f73c047af.svg" style="height: 12px;" type="image/svg+xml"&gt;du=dx&lt;/object&gt;, so:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/cb6d354e88f41065c1ea89c6f5c1211f5c191b10.svg" style="height: 116px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \mathcal{F}\left[f(x-x_0)\right]&amp;amp;=\int_{-\infty}^{\infty}f(u)e^{-i\cdot w(u+x_0)}du\\
    &amp;amp;=e^{-iwx_0}\int_{-\infty}^{\infty}f(u)e^{-i\cdot wu}du\\
    &amp;amp;=e^{-iwx_0}\mathcal{F}\left[f(x)\right]
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;&lt;strong&gt;Transform of a derivative&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;An extremely useful property that’s often employed in the solution of
partial differential equations; let’s calculate the Fourier transform of
the derivative of &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/c68df7988f98d39063d8653406b37eec649db284.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[f&amp;#x27;(x)\right]=\int_{-\infty}^{\infty}f&amp;#x27;(x)e^{-i\cdot wx}dx\]&lt;/object&gt;
&lt;p&gt;We’ll use integration by parts, where &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/9105027cd130b253982e71ba3781a3d2cab76497.svg" style="height: 18px;" type="image/svg+xml"&gt;dv=f&amp;#x27;(x)&lt;/object&gt; and
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6c8c2392ded19fe4785df9e93e8f5a9afafb0b57.svg" style="height: 15px;" type="image/svg+xml"&gt;u=e^{-i\cdot wx}&lt;/object&gt;. Therefore, &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/6e01683a36aeafb75c36f6f53287e0f3526e009d.svg" style="height: 18px;" type="image/svg+xml"&gt;v=f(x)&lt;/object&gt; and
&lt;object class="valign-m1 latex-math" data="https://eli.thegreenplace.net/images/math/a571d1529809275d168f3927dc0bf3596dcfd6bd.svg" style="height: 16px;" type="image/svg+xml"&gt;du=-iw\cdot e^{-i\cdot wx}&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/404b14a4142a051740bd0295f55730fdad2cb914.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[f&amp;#x27;(x)\right]=\left[f(x)e^{-i\cdot wx}\right]^{\infty}_{-\infty}-\int_{-\infty}^{\infty}f(x)(-iw\cdot e^{-i\cdot wx})dx\]&lt;/object&gt;
&lt;p&gt;Recall the assumption made in the &amp;quot;Existence condition...&amp;quot; section about
&lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; vanishing at infinities. So the first part of the equation
above is zero, and we’re left with:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/dc5d418235b7eba338e8e89f81294a0ea47e17b4.svg" style="height: 115px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \mathcal{F}\left[f&amp;#x27;(x)\right]&amp;amp;=-\int_{-\infty}^{\infty}f(x)(-iw\cdot
    e^{-i\cdot wx})dx\\
    &amp;amp;=iw\int_{-\infty}^{\infty}f(x)e^{-i\cdot wx}dx\\
    &amp;amp;=iw\cdot\mathcal{F}\left[f(x)\right]
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;&lt;strong&gt;Transform of convolution&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The convolution between two continuous functions &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; and
&lt;object class="valign-m5 latex-math" data="https://eli.thegreenplace.net/images/math/65405422ff71ebf2db437dbd89a41355f4f19183.svg" style="height: 19px;" type="image/svg+xml"&gt;g(x)&lt;/object&gt; is defined as:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/64d3b7f12adaf1aed1e65d923a25dc918750d92c.svg" style="height: 43px;" type="image/svg+xml"&gt;\[(f\ast g)(x)=\int_{-\infty}^{\infty}f(\xi)g(x-\xi)d\xi\]&lt;/object&gt;
&lt;p&gt;Let’s calculate the Fourier transform of this function:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/a8f307d6edd7b1ac3fde4cda60dc344115e7800b.svg" style="height: 91px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \mathcal{F}\left[(f\ast g)(x)\right]&amp;amp;=\int_{-\infty}^{\infty}e^{-i\cdot wx}\left[\int_{-\infty}^{\infty}f(\xi)g(x-\xi)d\xi\right]dx\\
    &amp;amp;=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-i\cdot wx}f(\xi)g(x-\xi)d\xi\ dx
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;This step of combining the integrals into a double integral, as well as
the next step (changing the order of integration) is possible due to
&lt;a class="reference external" href="https://en.wikipedia.org/wiki/Fubini%27s_theorem"&gt;Fubini’s theorem&lt;/a&gt;
and our assumption that &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; and &lt;object class="valign-m5 latex-math" data="https://eli.thegreenplace.net/images/math/65405422ff71ebf2db437dbd89a41355f4f19183.svg" style="height: 19px;" type="image/svg+xml"&gt;g(x)&lt;/object&gt; are Lebesgue
integrable.&lt;/p&gt;
&lt;p&gt;Switch order of integration:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/df9fde5e4b753f4c41e5c292f37db1068710b14e.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[(f\ast g)(x)\right]=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-i\cdot wx}f(\xi)g(x-\xi)dx\ d\xi\]&lt;/object&gt;
&lt;p&gt;Now, &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/2585072601e53de18cd0041cba511465ff8265d2.svg" style="height: 18px;" type="image/svg+xml"&gt;f(\xi)&lt;/object&gt; in the inner integral doesn’t depend on &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt;,
so we can pull it out:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/c59ef4659d72edb37cba1d180020f83dfc36d5a5.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[(f\ast g)(x)\right]=\int_{-\infty}^{\infty}f(\xi)\int_{-\infty}^{\infty}e^{-i\cdot wx}g(x-\xi)dx\ d\xi\]&lt;/object&gt;
&lt;p&gt;The inner integral is just the Fourier transform of a time-shifted
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/58ff017207a2364bb206cc8fa1b5ee6ff77b4fd9.svg" style="height: 18px;" type="image/svg+xml"&gt;g(x-\xi)&lt;/object&gt;, so we can write:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/088b586186d1a9dcb52289cf64705d389fff8cbf.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[(f\ast g)(x)\right]=\int_{-\infty}^{\infty}f(\xi)e^{-i\cdot w\xi}\mathcal{F}\left[g(x)\right]d\xi=\mathcal{F}\left[g(x)\right]\int_{-\infty}^{\infty}e^{-i\cdot w\xi}f(\xi)d\xi\]&lt;/object&gt;
&lt;p&gt;And the remaining integral is the Fourier transform of &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;, so:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/54626bd17186b72917424dd6c746874be19eb1c7.svg" style="height: 18px;" type="image/svg+xml"&gt;\[\mathcal{F}\left[(f\ast g)(x)\right]=\mathcal{F}\left[f\right]\cdot\mathcal{F}\left[g\right]\]&lt;/object&gt;
&lt;p&gt;Convolution in the time domain translates to multiplication in the
frequency domain! This result is so important in signal processing that
it’s called &lt;em&gt;the convolution theorem&lt;/em&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="appendix-a-riemann-sum-and-the-definite-integral"&gt;
&lt;h2&gt;Appendix A: Riemann sum and the definite integral&lt;/h2&gt;
&lt;p&gt;Suppose we have some function &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; and we want to know the area
bounded between this function’s graph and the &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; axis in a
certain interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/1475c39442659c6febe03b2e1809dbde6ec5fb5a.svg" style="height: 18px;" type="image/svg+xml"&gt;[a,b]&lt;/object&gt;. One way to do this is to take a
&lt;a class="reference external" href="https://en.wikipedia.org/wiki/Partition_of_an_interval"&gt;partition&lt;/a&gt;
of the interval:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/11ef50ee14b24c3f7713698e491860e9fdd68d4a.svg" style="height: 16px;" type="image/svg+xml"&gt;\[a=x_0&amp;lt;x_1&amp;lt;\cdots&amp;lt;x_{n-1}&amp;lt;x_n=b\]&lt;/object&gt;
&lt;p&gt;And calculate the area under &lt;img alt="f" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/4a0a19218e082a343a1b17e5333409af9d98f0f5.png" style="height: 15px;" /&gt; for every element of the
partition. We can then approximate such sub-areas by rectangles, as
follows:&lt;/p&gt;
&lt;img alt="Riemann sum plot" class="align-center" src="https://eli.thegreenplace.net/images/2026/riemann-sum.png" /&gt;
&lt;p&gt;We’ll denote the area of each rectangle as
&lt;object class="valign-m5 latex-math" data="https://eli.thegreenplace.net/images/math/7795c99dae5b64c326a3108b4a697e32ce2263aa.svg" style="height: 18px;" type="image/svg+xml"&gt;f(x^*_i)\cdot\Delta x&lt;/object&gt;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/dc13de28bfc406ce5a194900ced006c8ada8fce9.svg" style="height: 18px;" type="image/svg+xml"&gt;\Delta x=(b-a)/n&lt;/object&gt; is the width of one interval (assuming a
uniform partition, but the math works just as well for non-uniform
ones).&lt;/li&gt;
&lt;li&gt;&lt;object class="valign-m5 latex-math" data="https://eli.thegreenplace.net/images/math/306d0e72ecd01369e781c973043a0c39fa258a8a.svg" style="height: 17px;" type="image/svg+xml"&gt;x^*_i&lt;/object&gt; is some value in the interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/2408e92610b98a2ab3b45a54e2776cfad31c8e73.svg" style="height: 18px;" type="image/svg+xml"&gt;[x_{i-1},x_i]&lt;/object&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are many ways to choose which point of the interval
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/2408e92610b98a2ab3b45a54e2776cfad31c8e73.svg" style="height: 18px;" type="image/svg+xml"&gt;[x_{i-1},x_i]&lt;/object&gt; to denote as &lt;object class="valign-m5 latex-math" data="https://eli.thegreenplace.net/images/math/306d0e72ecd01369e781c973043a0c39fa258a8a.svg" style="height: 17px;" type="image/svg+xml"&gt;x^*_i&lt;/object&gt;: left point
(&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/83baeffb5c41a6ad721e8c1a677f379b9dc8722c.svg" style="height: 12px;" type="image/svg+xml"&gt;x_{i-1}&lt;/object&gt;), right point (&lt;img alt="x_i" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/34e03e6559b14df9fe5a97bbd2ed10109dfebbd3.png" style="height: 10px;" /&gt;), mid-point between the two
(which is what our plot shows) or anything in between. The distinction
doesn’t really matter for our purpose, as we will soon see.&lt;/p&gt;
&lt;p&gt;We can approximate the area under the curve of &lt;img alt="f" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/4a0a19218e082a343a1b17e5333409af9d98f0f5.png" style="height: 15px;" /&gt; in the interval
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/1475c39442659c6febe03b2e1809dbde6ec5fb5a.svg" style="height: 18px;" type="image/svg+xml"&gt;[a,b]&lt;/object&gt; with the &lt;strong&gt;Riemann sum&lt;/strong&gt;, using a uniform partition:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/fb8aacc8d67e04353800371d56263c334fa42889.svg" style="height: 49px;" type="image/svg+xml"&gt;\[S=\sum_{i=1}^{n}f(x^*_i)\Delta x\]&lt;/object&gt;
&lt;p&gt;If &lt;img alt="f" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/4a0a19218e082a343a1b17e5333409af9d98f0f5.png" style="height: 15px;" /&gt; is continuous on &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/1475c39442659c6febe03b2e1809dbde6ec5fb5a.svg" style="height: 18px;" type="image/svg+xml"&gt;[a,b]&lt;/object&gt;, then as
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/806d3bb52101b325f342d5a3b8ecfd32a067dc3b.svg" style="height: 8px;" type="image/svg+xml"&gt;n\rightarrow \infty&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/81b22f1f683f913271c4cc8599761a3d95b24c70.svg" style="height: 50px;" type="image/svg+xml"&gt;\[S=\lim_{n\rightarrow \infty}\sum_{i=1}^{n}f(x^*_i)\Delta x=\int_{a}^{b}f(x)dx\]&lt;/object&gt;
&lt;p&gt;This is known as the &lt;strong&gt;Riemann integral&lt;/strong&gt;, or just the definite
integral. The limit is why the exact choice of &lt;object class="valign-m5 latex-math" data="https://eli.thegreenplace.net/images/math/306d0e72ecd01369e781c973043a0c39fa258a8a.svg" style="height: 17px;" type="image/svg+xml"&gt;x^*_i&lt;/object&gt; doesn’t
matter: as &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d700d1d5bd9381b68e71b723ba8f231ee62dd3f4.svg" style="height: 8px;" type="image/svg+xml"&gt;n\rightarrow\infty&lt;/object&gt; we have
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/68c3d05c11aecce6ca6c6c45e1369f8e21440a47.svg" style="height: 12px;" type="image/svg+xml"&gt;\Delta x\rightarrow 0&lt;/object&gt;, and all points within
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/ee05ac539c5cac9ca6b187b374a09e20a3e587c9.svg" style="height: 18px;" type="image/svg+xml"&gt;[x_{i-1}, x_i]&lt;/object&gt; are equally good.&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Note that &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e6456786af3c999a8eda7658e37f7bf5d1bb0db0.svg" style="height: 14px;" type="image/svg+xml"&gt;C_n&lt;/object&gt; is not a function of &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt;; in its
definition, &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; only serves as a dummy integration variable and
can be called anything we choose. When we substitute &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e6456786af3c999a8eda7658e37f7bf5d1bb0db0.svg" style="height: 14px;" type="image/svg+xml"&gt;C_n&lt;/object&gt; into
the equation for &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;, which &lt;em&gt;is&lt;/em&gt; a function of &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt;, we
have to be careful. Thus the renaming.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Note we apply the limit; therefore, the bounds of the inner integral
(in the square brackets) are now also between &lt;object class="valign-m1 latex-math" data="https://eli.thegreenplace.net/images/math/18787d835dea1ca698e365c252f82b506cecfce7.svg" style="height: 12px;" type="image/svg+xml"&gt;-\infty&lt;/object&gt; and
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/9b97f26fbeb1b84327c736de515f10980d9c7d68.svg" style="height: 8px;" type="image/svg+xml"&gt;\infty&lt;/object&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-3"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;We change the dummy integration variable back to &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; here, for
consistency. Once again, since &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; is just the integration
variable and the integral is definite, the final result doesn’t
depend on &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt;. It’s a function of &lt;img alt="w" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 7px;" /&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-4" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-4"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;The vanishing at infinity part is the Riemann-Lebesgue lemma; you can
find a proof on Wikipedia&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-5"&gt;[5]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;A pathological absolute-integrable function can have spikes at
infinity but still have a finite total area.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;script src="https://eli.thegreenplace.net/demos/fourier/windowed.js"&gt;
&lt;/script&gt;&lt;/div&gt;
</content><category term="misc"></category><category term="Math"></category></entry><entry><title>Dot product: Component vs. Geometric definition</title><link href="https://eli.thegreenplace.net/2026/dot-product-component-vs-geometric-definition/" rel="alternate"></link><published>2026-07-10T18:42:00-07:00</published><updated>2026-07-11T01:45:03-07:00</updated><author><name>Eli Bendersky</name></author><id>tag:eli.thegreenplace.net,2026-07-10:/2026/dot-product-component-vs-geometric-definition/</id><summary type="html">&lt;p&gt;The goal of this post is to answer a simple question: why are the
following two definitions of the vector dot product in Euclidean
space &lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt; equivalent for vectors &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/1e37c650a8e07c81d1a1b03f075bdf45139d65e9.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}&lt;/object&gt; and &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/71fa108edb785ca9f729fa3cd5ad18556dd682e4.svg" style="height: 18px;" type="image/svg+xml"&gt;\vec{b}&lt;/object&gt;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Component definition:
&lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/ceda7d1aeff7f71ec163c06a1027301880a1a11a.svg" style="height: 23px;" type="image/svg+xml"&gt;\vec{a}\cdot\vec{b}=\sum_{i=1}^{n}a_i b_i&lt;/object&gt;&lt;/li&gt;
&lt;li&gt;Geometric definition:
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/18295d9ada05bf75a8c4e834b5cdb5a1fb8236b7.svg" style="height: 22px;" type="image/svg+xml"&gt;\vec …&lt;/object&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;The goal of this post is to answer a simple question: why are the
following two definitions of the vector dot product in Euclidean
space &lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt; equivalent for vectors &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/1e37c650a8e07c81d1a1b03f075bdf45139d65e9.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}&lt;/object&gt; and &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/71fa108edb785ca9f729fa3cd5ad18556dd682e4.svg" style="height: 18px;" type="image/svg+xml"&gt;\vec{b}&lt;/object&gt;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Component definition:
&lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/ceda7d1aeff7f71ec163c06a1027301880a1a11a.svg" style="height: 23px;" type="image/svg+xml"&gt;\vec{a}\cdot\vec{b}=\sum_{i=1}^{n}a_i b_i&lt;/object&gt;&lt;/li&gt;
&lt;li&gt;Geometric definition:
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/18295d9ada05bf75a8c4e834b5cdb5a1fb8236b7.svg" style="height: 22px;" type="image/svg+xml"&gt;\vec{a}\cdot\vec{b}=|\vec{a}||\vec{b}|cos(\theta)&lt;/object&gt;, where
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/0cab7c57b6f3ee6067b1490781094dd2a0b060ee.svg" style="height: 18px;" type="image/svg+xml"&gt;|\vec{a}|&lt;/object&gt; is the magnitude of &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/1e37c650a8e07c81d1a1b03f075bdf45139d65e9.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}&lt;/object&gt; and
&lt;img alt="\theta" class="valign-0" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt; is the angle between the vectors’ directions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here’s a graphical depiction of our vectors (focusing on
&lt;img alt="\mathbb{R}^2" class="valign-0" src="https://eli.thegreenplace.net/images/math/2b688757b3d0949451e1fa97e71ac5f5f284a5e4.png" style="height: 15px;" /&gt; for clarity, though this applies to any-dimensional
vectors). It shows both the components of the vectors and the angle
between them. The &lt;em&gt;length&lt;/em&gt; of the arrow for &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/1e37c650a8e07c81d1a1b03f075bdf45139d65e9.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}&lt;/object&gt; is
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/0cab7c57b6f3ee6067b1490781094dd2a0b060ee.svg" style="height: 18px;" type="image/svg+xml"&gt;|\vec{a}|&lt;/object&gt;.&lt;/p&gt;
&lt;img alt="Vectors a and b in the cartesian plane" class="align-center" src="https://eli.thegreenplace.net/images/2026/vec-ab.png" /&gt;
&lt;p&gt;We’ll show two proofs of the equivalence here, the &lt;em&gt;geometric proof&lt;/em&gt; and
the &lt;em&gt;projection proof&lt;/em&gt;. The Appendix describes some properties of dot
products that facilitate these proofs.&lt;/p&gt;
&lt;div class="section" id="geometric-proof"&gt;
&lt;h2&gt;Geometric proof&lt;/h2&gt;
&lt;p&gt;We’ll be using this diagram of our vectors &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/1e37c650a8e07c81d1a1b03f075bdf45139d65e9.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}&lt;/object&gt; and
&lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/71fa108edb785ca9f729fa3cd5ad18556dd682e4.svg" style="height: 18px;" type="image/svg+xml"&gt;\vec{b}&lt;/object&gt;, as well as the vector &lt;object class="valign-m1" data="https://eli.thegreenplace.net/images/math/8a5592cb1eea55d16a0003f0821da2c56d6b57b9.svg" style="height: 19px;" type="image/svg+xml"&gt;\vec{c}=\vec{a}-\vec{b}&lt;/object&gt;:&lt;/p&gt;
&lt;img alt="Vectors a, b and c in the cartesian plane" class="align-center" src="https://eli.thegreenplace.net/images/2026/vec-abc.png" /&gt;
&lt;p&gt;Using the law of cosines &lt;a class="footnote-reference" href="#footnote-2" id="footnote-reference-2"&gt;[2]&lt;/a&gt; on the triangle formed by the three
vectors:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/240ccea2153ff31cc6fe50d5e304555cf1cdf7dc.svg" style="height: 22px;" type="image/svg+xml"&gt;\[|\vec{c}|^2=|\vec{a}|^2+|\vec{b}|^2-2|\vec{a}||\vec{b}|cos(\theta)\]&lt;/object&gt;
&lt;p&gt;Since for any vector &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/1e37c650a8e07c81d1a1b03f075bdf45139d65e9.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}&lt;/object&gt;, we have
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/b422cc5da6849fe3e73781c1b45524a245325e75.svg" style="height: 19px;" type="image/svg+xml"&gt;\vec{a}\cdot\vec{a}=|\vec{a}|^2&lt;/object&gt; (see Appendix), let’s rewrite
this equation as:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/6695944214e34273aa1cf3c5fc019631d3d949eb.svg" style="height: 22px;" type="image/svg+xml"&gt;\[\vec{c}\cdot\vec{c}=\vec{a}\cdot\vec{a}+\vec{b}\cdot\vec{b}-2|\vec{a}||\vec{b}|cos(\theta)\]&lt;/object&gt;
&lt;p&gt;But &lt;object class="valign-m1" data="https://eli.thegreenplace.net/images/math/8a5592cb1eea55d16a0003f0821da2c56d6b57b9.svg" style="height: 19px;" type="image/svg+xml"&gt;\vec{c}=\vec{a}-\vec{b}&lt;/object&gt; and the dot product obeys the
distributive property (see Appendix). Therefore:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/e2a2ea0a8703cc17b1247e08f88c0a930f457727.svg" style="height: 110px;" type="image/svg+xml"&gt;\[\begin{aligned}
(\vec{a}-\vec{b})\cdot(\vec{a}-\vec{b})&amp;amp;=\vec{a}\cdot\vec{a}+\vec{b}\cdot\vec{b}-2|\vec{a}||\vec{b}|cos(\theta)\\
\vec{a}\cdot\vec{a}-2\vec{a}\cdot\vec{b}+\vec{b}\cdot\vec{b}&amp;amp;=\vec{a}\cdot\vec{a}+\vec{b}\cdot\vec{b}-2|\vec{a}||\vec{b}|cos(\theta)\\
-2\vec{a}\cdot\vec{b}&amp;amp;=-2|\vec{a}||\vec{b}|cos(\theta)\\
\vec{a}\cdot\vec{b}&amp;amp;=|\vec{a}||\vec{b}|cos(\theta)
\end{aligned}\]&lt;/object&gt;
&lt;/div&gt;
&lt;div class="section" id="projection-proof"&gt;
&lt;h2&gt;Projection proof&lt;/h2&gt;
&lt;p&gt;For this proof, we’ll assume the geometric definition is correct and
will see how it leads to the component definition. We’ll begin by
denoting vectors &lt;object class="valign-m3" data="https://eli.thegreenplace.net/images/math/620cb2dfecf64377c0514f58bb921df1a50bf1cc.svg" style="height: 16px;" type="image/svg+xml"&gt;\vec{e}_1,\vec{e}_2\dots\vec{e}_n&lt;/object&gt; as the
standard orthonormal basis for &lt;img alt="\mathbb{R}^n" class="valign-0" src="https://eli.thegreenplace.net/images/math/98165cf6e8d5d442e040d1fa47aa6845f09294c5.png" style="height: 12px;" /&gt;. For example, in 2D
space, these basis vectors are &lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/70f6d3f52a446d8fc6697e813283690b52f564f5.svg" style="height: 18px;" type="image/svg+xml"&gt;\vec{e}_1=[1\ 0]&lt;/object&gt; and
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/09f035a2ceccb1ee6e2299b8f3b39fcba5a50415.svg" style="height: 18px;" type="image/svg+xml"&gt;\vec{e}_2=[0\ 1]&lt;/object&gt;, shown in
this diagram:&lt;/p&gt;
&lt;img alt="Projection of vector a on basis vectors" class="align-center" src="https://eli.thegreenplace.net/images/2026/vec-a-proj.png" /&gt;
&lt;p&gt;If we take an arbitrary &lt;object class="valign-m1" data="https://eli.thegreenplace.net/images/math/e308d2dc4c91a30f229484326d392f20443ae2af.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}\in\mathbb{R}^n&lt;/object&gt; and calculate its
dot product with a basis vector, we can use the geometric definition:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/186133bb5f8369bd1ecf10d5d2b4d943add95e16.svg" style="height: 18px;" type="image/svg+xml"&gt;\[\vec{a}\cdot\vec{e}_i=|\vec{a}||\vec{e}_i|cos(\theta_i)=|\vec{a}|cos(\theta_i)=a_i\]&lt;/object&gt;
&lt;p&gt;where &lt;object class="valign-m3" data="https://eli.thegreenplace.net/images/math/1ba9b59bdee92f38c1698c784b67ba70f803331d.svg" style="height: 10px;" type="image/svg+xml"&gt;a_i&lt;/object&gt; is the component of &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/1e37c650a8e07c81d1a1b03f075bdf45139d65e9.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}&lt;/object&gt; in the direction
of &lt;object class="valign-m3" data="https://eli.thegreenplace.net/images/math/affb5dee8540bbf9212209541eb1f5ae1c892c57.svg" style="height: 15px;" type="image/svg+xml"&gt;\vec{e}_i&lt;/object&gt;. The diagram makes it easy to see why this is true
from basic trigonometry, but in the more general case this is just a
&lt;a class="reference external" href="https://eli.thegreenplace.net/2024/projections-and-projection-matrices/"&gt;vector
projection&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Now let’s represent vectors &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/1e37c650a8e07c81d1a1b03f075bdf45139d65e9.svg" style="height: 13px;" type="image/svg+xml"&gt;\vec{a}&lt;/object&gt; and &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/71fa108edb785ca9f729fa3cd5ad18556dd682e4.svg" style="height: 18px;" type="image/svg+xml"&gt;\vec{b}&lt;/object&gt; as
linear combinations of the basis vectors:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/c8e0903b930bb28b24c17ed4c11523763abb143e.svg" style="height: 107px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \vec{a}&amp;amp;=\sum_{i=1}^{n}a_i\vec{e}_i\\
    \vec{b}&amp;amp;=\sum_{i=1}^{n}b_i\vec{e}_i\\
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;And calculate the dot product &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/b1048f974a85e79f143668b8f14b1304450e32a3.svg" style="height: 18px;" type="image/svg+xml"&gt;\vec{a}\cdot\vec{b}&lt;/object&gt;, beginning by
rewriting &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/71fa108edb785ca9f729fa3cd5ad18556dd682e4.svg" style="height: 18px;" type="image/svg+xml"&gt;\vec{b}&lt;/object&gt; with its linear combination of basis vectors
representation:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/e9e1a0ea9925cbc19e45d6003b550319677f2e7f.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\vec{a}\cdot\vec{b}=\vec{a}\cdot\sum_{i=1}^{n}b_i\vec{e}_i\]&lt;/object&gt;
&lt;p&gt;Using the fact that the dot product distributes over linear
combinations:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/d5be2ada840bb5b42dc39f2a4cc4bd250b8ca6e6.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\vec{a}\cdot\vec{b}=\sum_{i=1}^{n}b_i(\vec{a}\cdot\vec{e}_i)\]&lt;/object&gt;
&lt;p&gt;But earlier we’ve shown that &lt;object class="valign-m3" data="https://eli.thegreenplace.net/images/math/8fd516937d096de273bbe7affffe0b4366c8aff8.svg" style="height: 15px;" type="image/svg+xml"&gt;\vec{a}\cdot\vec{e}_i=a_i&lt;/object&gt;.
Therefore:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/6f9531542f40b48ecd92cb463422c7496338a28d.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\vec{a}\cdot\vec{b}=\sum_{i=1}^{n}b_i a_i=\sum_{i=1}^{n}a_i b_i\]&lt;/object&gt;
&lt;p&gt;Which is the component definition &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/4a4e9e431da45a27bc880a8a1ca44d8b1b9bc143.svg" style="height: 12px;" type="image/svg+xml"&gt;\blacksquare&lt;/object&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="appendix-a-inner-product-space"&gt;
&lt;h2&gt;Appendix A: Inner product space&lt;/h2&gt;
&lt;p&gt;A generalization of dot products in &lt;img alt="\mathbb{R}^n" class="valign-0" src="https://eli.thegreenplace.net/images/math/98165cf6e8d5d442e040d1fa47aa6845f09294c5.png" style="height: 12px;" /&gt; is the &lt;em&gt;inner
product&lt;/em&gt;, which is an operation meeting some specific requirements,
defined on a vector space.&lt;/p&gt;
&lt;p&gt;The inner product is denoted as
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/cbdca019cccdd6a52a31e7801d2df0ab11ea3308.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle x,y\rangle:\mathbb{R}^n\times\mathbb{R}^n\to\mathbb{R}&lt;/object&gt;,
and must satisfy the following requirements for all vectors
&lt;object class="valign-m3" data="https://eli.thegreenplace.net/images/math/e4dc4820e1769287ccf66b5dd55d01e585bebe28.svg" style="height: 16px;" type="image/svg+xml"&gt;x,y,z\in\mathbb{R}^n&lt;/object&gt; and scalars &lt;object class="valign-m3" data="https://eli.thegreenplace.net/images/math/30f42e11547408a4df5cc14e588f8866c8df08b1.svg" style="height: 16px;" type="image/svg+xml"&gt;a,b\in\mathbb{R}&lt;/object&gt;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Symmetry: &lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/3c2a6a5c6c97ba865770875225c2b5a66c80eeb4.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle x,y\rangle=\langle y,x\rangle&lt;/object&gt;&lt;/li&gt;
&lt;li&gt;Linearity in the first argument:
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/89712b4ea716fa8e6cd8b9d87122b79bb1a9667d.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle ax+by,z\rangle=a\langle x,z\rangle+b\langle y,z\rangle&lt;/object&gt;&lt;/li&gt;
&lt;li&gt;Positive-definiteness: if &lt;object class="valign-m3" data="https://eli.thegreenplace.net/images/math/b236da2dfef47fa5412296162341115b27b43299.svg" style="height: 16px;" type="image/svg+xml"&gt;x\ne 0&lt;/object&gt; then
&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/9535942c7e10297e079a7e3454b38d7950ae2310.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle x,x\rangle&amp;gt;0&lt;/object&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For &lt;img alt="\mathbb{R}^n" class="valign-0" src="https://eli.thegreenplace.net/images/math/98165cf6e8d5d442e040d1fa47aa6845f09294c5.png" style="height: 12px;" /&gt;, we define the inner product operation in its
component formulation as:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/9aaa1b0476e540ca44c95a3c19027636f3206a46.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\langle x,y\rangle=\sum_{i=1}^{n}x_i\cdot y_i\]&lt;/object&gt;
&lt;p&gt;Let’s prove the requirements listed above for this operation; this is
fairly straightforward, given the well-known properties of scalar
multiplication and addition on &lt;img alt="\mathbb{R}" class="valign-0" src="https://eli.thegreenplace.net/images/math/0ed839b111fe0e3ca2b2f618b940893eaea88a57.png" style="height: 12px;" /&gt;:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Symmetry:&lt;/strong&gt;&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/0b40b68141de632daf8ad29a268134ff95bd8913.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\langle x,y\rangle=\sum_{i=1}^{n}x_i\cdot y_i=\sum_{i=1}^{n}y_i\cdot x_i=\langle y,x\rangle\]&lt;/object&gt;
&lt;p&gt;&lt;strong&gt;Linearity in the first argument:&lt;/strong&gt;&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/da1d69b138c0cd509829247a3df234b2584fc0f8.svg" style="height: 165px;" type="image/svg+xml"&gt;\[\begin{aligned}
\langle ax+by,z\rangle&amp;amp;=\sum_{i=1}^{n}(ax+by)_i\cdot z_i\\
&amp;amp;=\sum_{i=1}^{n}a x_i\cdot z_i+b y_i\cdot z_i\\
&amp;amp;=a\sum_{i=1}^{n}x_i\cdot z_i+b\sum_{i=1}^{n}y_i\cdot z_i=a\langle x,z\rangle+b\langle y,z\rangle
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;&lt;strong&gt;Positive-definiteness:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Consider the components &lt;img alt="x_i" class="valign-m3" src="https://eli.thegreenplace.net/images/math/34e03e6559b14df9fe5a97bbd2ed10109dfebbd3.png" style="height: 10px;" /&gt; of vector &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt;. Clearly,
&lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/b612a557dba4596d6c60e575490f16b1ba8ae091.svg" style="height: 19px;" type="image/svg+xml"&gt;\forall i\quad x_i\cdot x_i=x_i^2\ge 0&lt;/object&gt;. Since the vector
&lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; is not the zero vector, at least one of its components
&lt;img alt="x_i" class="valign-m3" src="https://eli.thegreenplace.net/images/math/34e03e6559b14df9fe5a97bbd2ed10109dfebbd3.png" style="height: 10px;" /&gt; is nonzero, and for that component &lt;object class="valign-m3" data="https://eli.thegreenplace.net/images/math/c5bf177ea7d8fd17a6ca8070c2fdf6d1efb32d66.svg" style="height: 14px;" type="image/svg+xml"&gt;x_i\cdot x_i&amp;gt;0&lt;/object&gt;.
Therefore:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/27f090f1d43176fc69c95eac63d2ff17cbafc55b.svg" style="height: 49px;" type="image/svg+xml"&gt;\[\langle x,x\rangle=\sum_{i=1}^{n}x_i\cdot x_i&amp;gt;0\]&lt;/object&gt;
&lt;p&gt;Now that we’ve proved all the inner product requirements on our
operation &lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/6ca9deb1a76b8e6935f570856eb9bda46220ce25.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle x,y\rangle&lt;/object&gt;, we can say that
&lt;img alt="\mathbb{R}^n" class="valign-0" src="https://eli.thegreenplace.net/images/math/98165cf6e8d5d442e040d1fa47aa6845f09294c5.png" style="height: 12px;" /&gt; is an &lt;em&gt;inner product space&lt;/em&gt; with this operation.&lt;/p&gt;
&lt;p&gt;By meeting these requirements, it can be readily shown that our inner
product operation has additional useful properties:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/2ee7d071087a18edac9b46e15b6ca6afbf9a6df8.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle x,0\rangle=\langle 0,x\rangle=0&lt;/object&gt;&lt;/li&gt;
&lt;li&gt;&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/900b54a8839adf1b8c8bb63303fff2f26f6b0776.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle x,x\rangle=0&lt;/object&gt; if and only if &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/8bdf21367eee06097384c37b0448375f07f950f0.svg" style="height: 12px;" type="image/svg+xml"&gt;x=0&lt;/object&gt;&lt;/li&gt;
&lt;li&gt;&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/997f3a8fe7a79d7774e2b83acfa72f3ffc56a0df.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle x,ay+bz\rangle=a\langle x,y\rangle+b\langle x,z\rangle&lt;/object&gt;&lt;/li&gt;
&lt;li&gt;&lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/685267fd1c951d09b34d3a7cd0f27361649b58cf.svg" style="height: 18px;" type="image/svg+xml"&gt;\langle x+y,x+y\rangle=\langle x,x\rangle+2\langle x,y\rangle+\langle y,y\rangle&lt;/object&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The third property is particularly helpful, because it means the inner
product is &lt;em&gt;bilinear&lt;/em&gt;, and thus is distributive over addition.&lt;/p&gt;
&lt;p&gt;Note that these are shown for the component definition of dot product.
It’s not too hard to prove distributivity for the geometric definition
using the notion of projections and how they add up.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Norm&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;norm&lt;/em&gt; of a vector &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt; in an inner product space is defined as
&lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/a7bda7d6e7e2e0cad0e29b07b00cf1e660e9e231.svg" style="height: 22px;" type="image/svg+xml"&gt;|x|=\sqrt{\langle x,x\rangle}&lt;/object&gt;. Therefore, the square of the norm
is &lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/d27b2e10b83103098eda64097cdab1a29d01a7f4.svg" style="height: 19px;" type="image/svg+xml"&gt;|x|^2=\langle x,x\rangle&lt;/object&gt;.&lt;/p&gt;
&lt;p&gt;The norm is used to express the notion of &lt;em&gt;magnitude&lt;/em&gt;, or &lt;em&gt;length&lt;/em&gt; of a
vector. If you think of a vector &lt;object class="valign-m1" data="https://eli.thegreenplace.net/images/math/33bd5495eaecc64262186977afff85eba0a94885.svg" style="height: 13px;" type="image/svg+xml"&gt;x\in\mathbb{R}^n&lt;/object&gt; in Cartesian
coordinates, the definition of the norm is a generalization of the
Pythagorean theorem.&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;By this we mean &lt;img alt="\mathbb{R}^n" class="valign-0" src="https://eli.thegreenplace.net/images/math/98165cf6e8d5d442e040d1fa47aa6845f09294c5.png" style="height: 12px;" /&gt;, where each vector is an n-tuple
of real numbers, with the usual mathematical operations making this a
vector space.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Which is a very fundamental theorem in geometry; it is (or rather,
its non-trigonometric version) is proven from the basic Euclidean
axioms in &lt;em&gt;The Elements&lt;/em&gt;.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="misc"></category><category term="Math"></category></entry><entry><title>Notes on Fourier series</title><link href="https://eli.thegreenplace.net/2026/notes-on-fourier-series/" rel="alternate"></link><published>2026-05-27T19:30:00-07:00</published><updated>2026-07-15T12:52:07-07:00</updated><author><name>Eli Bendersky</name></author><id>tag:eli.thegreenplace.net,2026-05-27:/2026/notes-on-fourier-series/</id><summary type="html">&lt;link rel="stylesheet" href="https://eli.thegreenplace.net/demos/fourier/fourier-plot.css"&gt;&lt;p&gt;The trigonometric Fourier series is a beautiful mathematical theory that
shows how to decompose a periodic function into an infinite sum of
sinusoids. These are my notes on the subject, with some examples and the
connection to linear algebra in Hilbert space.&lt;/p&gt;
&lt;div class="section" id="coefficients-of-fourier-series"&gt;
&lt;h2&gt;Coefficients of Fourier series&lt;/h2&gt;
&lt;p&gt;Let’s assume that …&lt;/p&gt;&lt;/div&gt;</summary><content type="html">&lt;link rel="stylesheet" href="https://eli.thegreenplace.net/demos/fourier/fourier-plot.css"&gt;&lt;p&gt;The trigonometric Fourier series is a beautiful mathematical theory that
shows how to decompose a periodic function into an infinite sum of
sinusoids. These are my notes on the subject, with some examples and the
connection to linear algebra in Hilbert space.&lt;/p&gt;
&lt;div class="section" id="coefficients-of-fourier-series"&gt;
&lt;h2&gt;Coefficients of Fourier series&lt;/h2&gt;
&lt;p&gt;Let’s assume that &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; is a &lt;em&gt;well-behaved&lt;/em&gt; &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/8dde33545500de38fae974b4b18036def142e9e3.svg" style="height: 12px;" type="image/svg+xml"&gt;2L&lt;/object&gt;-periodic &lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt;
function and that we can find coefficients &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt;
such that:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/628f7339c7c4d164a982b8da9b48b213692dd5b3.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f(x)=\sum_{n=0}^{\infty}\left(a_n cos\frac{n\pi x}{L}+b_n sin\frac{n\pi x}{L}\right)\]&lt;/object&gt;
&lt;p&gt;Then we say that the &lt;em&gt;Fourier series&lt;/em&gt; on the right-hand side converges
to &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;. We’ll talk more about the assumptions mentioned above
and convergence in the next section.&lt;/p&gt;
&lt;p&gt;Note that when &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/bfbd617aa9bc9d5a8b0b006de9d1d45d8e688c8d.svg" style="height: 11px;" type="image/svg+xml"&gt;n=0&lt;/object&gt;, the sum becomes just &lt;img alt="a_0" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/4a5997da73aadd118038761e69d01e24586bf958.png" style="height: 10px;" /&gt;; therefore
it’s customary to write the series starting with &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/01ea4b6bd17ee603696dd6e63b08b3ba75b78dce.svg" style="height: 11px;" type="image/svg+xml"&gt;n=1&lt;/object&gt;, with a
separate constant component (which is the function's average over
one period). To make computations nicer, this constant is typically
called &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/770db1916542e8d8eb0e85082134672f66f2544a.svg" style="height: 17px;" type="image/svg+xml"&gt;a_0 / 2&lt;/object&gt;, so:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/af4acda237be7c5348b05201f8f6f6c6b75e30b9.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n cos\frac{n\pi x}{L}+b_n sin\frac{n\pi x}{L}\right)\]&lt;/object&gt;
&lt;p&gt;Our goal is to find the coefficients &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt; that
satisfy this equation. We’ll do this in three steps.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Integrate both sides of the equation between &lt;object class="valign-m1 latex-math" data="https://eli.thegreenplace.net/images/math/c20a39eb3af4897aa4dea2bd9a1ba1a16fa16352.svg" style="height: 13px;" type="image/svg+xml"&gt;-L&lt;/object&gt; and
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt;  &lt;a class="footnote-reference" href="#footnote-2" id="footnote-reference-2"&gt;[2]&lt;/a&gt;.&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/d846619340aeef0b7af2015c25413e6d9947e659.svg" style="height: 46px;" type="image/svg+xml"&gt;\[\int_{-L}^{L}f(x)dx=\int_{-L}^{L}\frac{a_0}{2}dx+\sum_{n=1}^{\infty}\bigg (\int_{-L}^{L}a_n cos\frac{n\pi x}{L}dx+\int_{-L}^{L}b_n sin\frac{n\pi x}{L}dx\bigg )\]&lt;/object&gt;
&lt;p&gt;Per Appendix A, all integrals within the sum are zero, so we’re left
with:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/63c90dd5684c96b1f14a49bfb6c7a6dd7e8fcbd3.svg" style="height: 46px;" type="image/svg+xml"&gt;\[\int_{-L}^{L}f(x)dx=\int_{-L}^{L}\frac{a_0}{2}dx=\bigg[\frac{x\cdot a_0}{2}\bigg]_{-L}^{L}=a_0\cdot L\]&lt;/object&gt;
&lt;p&gt;And thus we find &lt;img alt="a_0" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/4a5997da73aadd118038761e69d01e24586bf958.png" style="height: 10px;" /&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/455f8d7d3f17720a2f2c577004b50b71999e5ac8.svg" style="height: 43px;" type="image/svg+xml"&gt;\[a_0=\frac{1}{L}\int_{-L}^{L}f(x)dx\]&lt;/object&gt;
&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Multiply both sides by &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/32329deb8300f4dcae316379bcc624efe02d10d9.svg" style="height: 18px;" type="image/svg+xml"&gt;cos\frac{m\pi x}{L}&lt;/object&gt;
(where &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6b0d31c0d563223024da45691584643ac78c96e8.svg" style="height: 7px;" type="image/svg+xml"&gt;m&lt;/object&gt; is a positive integer constant) and integrate between
&lt;object class="valign-m1 latex-math" data="https://eli.thegreenplace.net/images/math/c20a39eb3af4897aa4dea2bd9a1ba1a16fa16352.svg" style="height: 13px;" type="image/svg+xml"&gt;-L&lt;/object&gt; and &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt;.&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/1584e8cb2c704d84ba6e4d6fab63a999698b1e13.svg" style="height: 96px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \int_{-L}^{L}f(x)cos\frac{m\pi x}{L}dx&amp;amp;=\int_{-L}^{L}\frac{a_0}{2}cos\frac{m\pi x}{L}dx\\
    &amp;amp;+\sum_{n=1}^{\infty}\bigg (\int_{-L}^{L}a_n cos\frac{n\pi x}{L}cos\frac{m\pi x}{L}dx+\int_{-L}^{L}b_n sin\frac{n\pi x}{L}cos\frac{m\pi x}{L}dx\bigg )
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Looking at the right-hand side, the first integral is zero per Appendix
A, and the last integral is zero per Appendix B. We’re left with:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/0bc1f95f24482ce2b1292415f2d9759ed6ac9b3c.svg" style="height: 46px;" type="image/svg+xml"&gt;\[\int_{-L}^{L}f(x)cos\frac{m\pi x}{L}dx=\sum_{n=1}^{\infty}\int_{-L}^{L}a_n cos\frac{n\pi x}{L}cos\frac{m\pi x}{L}dx\]&lt;/object&gt;
&lt;p&gt;Per Appendix B, the integral on the right is zero for all
&lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/3ae4a06555822644174f9ff9419084466b3f7aa4.svg" style="height: 15px;" type="image/svg+xml"&gt;n\neq m&lt;/object&gt;, and &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt; for &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/193bdae8b42385001cd707bc207b1d95bd6dc2b2.svg" style="height: 7px;" type="image/svg+xml"&gt;n=m&lt;/object&gt;. Therefore, we can write:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/67f393e48f6792c8ed7fb23b3388496540507fab.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\int_{-L}^{L}f(x)cos\frac{m\pi x}{L}dx=a_m\cdot L\]&lt;/object&gt;
&lt;p&gt;Recall that &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6b0d31c0d563223024da45691584643ac78c96e8.svg" style="height: 7px;" type="image/svg+xml"&gt;m&lt;/object&gt; is an arbitrary integer, just like &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt;; for
consistency, we’ll replace &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6b0d31c0d563223024da45691584643ac78c96e8.svg" style="height: 7px;" type="image/svg+xml"&gt;m&lt;/object&gt; by &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt; and isolate
&lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f2e9e0215460f6630905ed01ddfbec5116473b88.svg" style="height: 43px;" type="image/svg+xml"&gt;\[a_n=\frac{1}{L}\int_{-L}^{L}f(x)cos\frac{n\pi x}{L}dx\]&lt;/object&gt;
&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Hopefully it’s clear where this is going now; multiply both
sides by &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/8e9b9f212b20b5a5c03a472debd56362a9c7a608.svg" style="height: 18px;" type="image/svg+xml"&gt;sin\frac{m\pi x}{L}&lt;/object&gt; and integrate between &lt;object class="valign-m1 latex-math" data="https://eli.thegreenplace.net/images/math/c20a39eb3af4897aa4dea2bd9a1ba1a16fa16352.svg" style="height: 13px;" type="image/svg+xml"&gt;-L&lt;/object&gt;
and &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt;. Using a very similar reasoning to step 2, we’ll end up
with:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/418eef7e6ac0ffd84fc9d87246f1329d17cb6d4c.svg" style="height: 43px;" type="image/svg+xml"&gt;\[b_n=\frac{1}{L}\int_{-L}^{L}f(x)sin\frac{n\pi x}{L}dx\]&lt;/object&gt;
&lt;p&gt;We’ve just found a way to calculate all the coefficients of our Fourier
series for &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/af4acda237be7c5348b05201f8f6f6c6b75e30b9.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n cos\frac{n\pi x}{L}+b_n sin\frac{n\pi x}{L}\right)\]&lt;/object&gt;
&lt;p&gt;Where:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/425afbd1b4528c1480d81e007c564dc8fdaf02b8.svg" style="height: 140px;" type="image/svg+xml"&gt;\[\begin{aligned}
    a_0&amp;amp;=\frac{1}{L}\int_{-L}^{L}f(x)dx\\
    a_n&amp;amp;=\frac{1}{L}\int_{-L}^{L}f(x)cos\frac{n\pi x}{L}dx\\
    b_n&amp;amp;=\frac{1}{L}\int_{-L}^{L}f(x)sin\frac{n\pi x}{L}dx
\end{aligned}\]&lt;/object&gt;
&lt;/div&gt;
&lt;div class="section" id="conditions-on-f-and-convergence-of-fourier-series"&gt;
&lt;h2&gt;Conditions on &lt;em&gt;f&lt;/em&gt; and convergence of Fourier series&lt;/h2&gt;
&lt;p&gt;The previous section discusses Fourier series for a function
&lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; that is &lt;em&gt;well-behaved&lt;/em&gt; - but what does that mean? The full
answer would lead us deep into analysis, which I’d like to avoid here.
So I’ll keep it brief.&lt;/p&gt;
&lt;p&gt;We typically assume that &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; is &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Square-integrable_function"&gt;square
integrable&lt;/a&gt;,
which is denoted as &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/f1aae083af2c79348dd78712847ebd55537fa6e6.svg" style="height: 14px;" type="image/svg+xml"&gt;L^2&lt;/object&gt;. Moreover, we assume that the function
is &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Piecewise_function"&gt;piecewise
smooth&lt;/a&gt;: each
segment of the function has continuous derivatives. A very simple
example of a piecewise smooth function is &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/b984af7493f86f1c75ccaa101e16d173cf00622f.svg" style="height: 17px;" type="image/svg+xml"&gt;f(x)=|x|&lt;/object&gt;. Another is
the triangular wave function used in the example below.&lt;/p&gt;
&lt;p&gt;These conditions hold for pretty much any reasonable function we want to
approximate using Fourier series, so they aren’t a serious burden.&lt;/p&gt;
&lt;p&gt;For a function &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; that satisfies these conditions, it’s
guaranteed to have a Fourier series that &lt;em&gt;pointwise converges&lt;/em&gt; to it.
This means that at every continuous point of &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;, the Fourier
series converges to it exactly; at every jump point, the Fourier series
converges to the mid-point of the jump.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="cosine-and-sine-series"&gt;
&lt;h2&gt;Cosine and Sine series&lt;/h2&gt;
&lt;p&gt;Sometimes, additional properties of the function &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; can help
us simplify the Fourier series for it. If &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/945519cc8666a0a6bfd3a390a10cd7fb2facc3bc.svg" style="height: 17px;" type="image/svg+xml"&gt;f_e(x)&lt;/object&gt; is an &lt;a class="reference external" href="https://eli.thegreenplace.net/2025/notes-on-even-and-odd-functions/"&gt;even
function&lt;/a&gt;,
then we know that:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/86ec9b5d04ec9bfba3910311d88ecf40e4379983.svg" style="height: 43px;" type="image/svg+xml"&gt;\[b_n=\frac{1}{L}\int_{-L}^{L}f(x)sin\frac{n\pi x}{L}dx=0\]&lt;/object&gt;
&lt;p&gt;Because the function inside the integral is odd, and integrating an
odd function over a symmetric interval results in 0.&lt;/p&gt;
&lt;p&gt;Therefore, the Fourier series for such &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/945519cc8666a0a6bfd3a390a10cd7fb2facc3bc.svg" style="height: 17px;" type="image/svg+xml"&gt;f_e(x)&lt;/object&gt; is a &lt;em&gt;cosine
series&lt;/em&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/abf9730ce5c3f88d7dedd5fbfa57a0b725b7f0d7.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f_e(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n cos\frac{n\pi x}{L}\]&lt;/object&gt;
&lt;p&gt;With coefficients &lt;img alt="a_0" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/4a5997da73aadd118038761e69d01e24586bf958.png" style="height: 10px;" /&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt; given as before.&lt;/p&gt;
&lt;p&gt;Similarly if &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/7616404fc7a2da1d8602d2c3ed0da2e99e4fb021.svg" style="height: 17px;" type="image/svg+xml"&gt;f_o(x)&lt;/object&gt; is an &lt;em&gt;odd&lt;/em&gt; function, then its &lt;img alt="a_0" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/4a5997da73aadd118038761e69d01e24586bf958.png" style="height: 10px;" /&gt;
and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt; are 0, and its Fourier series is a &lt;em&gt;sine series&lt;/em&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/a4517fb01f03c4e5b739f7c626668c3b804c5efc.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f_o(x)=\sum_{n=1}^{\infty}b_n sin\frac{n\pi x}{L}\]&lt;/object&gt;
&lt;/div&gt;
&lt;div class="section" id="fourier-series-for-a-non-periodic-function-defined-on-an-interval"&gt;
&lt;h2&gt;Fourier series for a non-periodic function defined on an interval&lt;/h2&gt;
&lt;p&gt;So far we’ve been talking about &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/8dde33545500de38fae974b4b18036def142e9e3.svg" style="height: 12px;" type="image/svg+xml"&gt;2L&lt;/object&gt;-periodic functions that can
be faithfully represented by Fourier series. But what if we have a
non-periodic function defined on a finite interval?&lt;/p&gt;
&lt;p&gt;E.g. suppose we have &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/f1dbdd3a5b38fafd9f78c329171bfe72dea6faf8.svg" style="height: 17px;" type="image/svg+xml"&gt;f(x)=x&lt;/object&gt; on the interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/6341a223ef0a566153beb0037d5a48d2d4b9d0eb.svg" style="height: 17px;" type="image/svg+xml"&gt;[0,L]&lt;/object&gt;. Can
we approximate it with a Fourier series?&lt;/p&gt;
&lt;p&gt;Yes! First, we have to make a choice of how to extend the function to
the negative interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/e345009799354a67cfdba7a7a8ea8ac4acb4d269.svg" style="height: 17px;" type="image/svg+xml"&gt;[-L,0]&lt;/object&gt;. Then, we simply repeat the
function every &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/8dde33545500de38fae974b4b18036def142e9e3.svg" style="height: 12px;" type="image/svg+xml"&gt;2L&lt;/object&gt; - this is called a &lt;em&gt;periodic extension&lt;/em&gt;. Note
that the Fourier series calculation only cares about the range
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/5f1297a5a8758acc19fd4c325ae19878e7e2fbab.svg" style="height: 17px;" type="image/svg+xml"&gt;[-L,L]&lt;/object&gt;. The resulting series will approximate the generated
periodic function in its entirety, and in particular will also converge
to it in the &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/6341a223ef0a566153beb0037d5a48d2d4b9d0eb.svg" style="height: 17px;" type="image/svg+xml"&gt;[0,L]&lt;/object&gt; interval (except maybe the endpoints,
depending on the mode of extension).&lt;/p&gt;
&lt;p&gt;There are several natural ways to extend a function defined on
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/6341a223ef0a566153beb0037d5a48d2d4b9d0eb.svg" style="height: 17px;" type="image/svg+xml"&gt;[0,L]&lt;/object&gt; into the interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/e345009799354a67cfdba7a7a8ea8ac4acb4d269.svg" style="height: 17px;" type="image/svg+xml"&gt;[-L,0]&lt;/object&gt; &lt;a class="footnote-reference" href="#footnote-3" id="footnote-reference-3"&gt;[3]&lt;/a&gt;:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;Direct periodic repetition: we simply repeat &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; every
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt;: &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/2168e6b40692df7e2d65d2c56516bd3161cf949b.svg" style="height: 17px;" type="image/svg+xml"&gt;f(x+L)=f(x)\ \forall x&lt;/object&gt;.&lt;/li&gt;
&lt;li&gt;Even extension: &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/7e3975e4586db92c8a5b4b1066af313951344cc0.svg" style="height: 17px;" type="image/svg+xml"&gt;f(|x|)&lt;/object&gt;&lt;/li&gt;
&lt;li&gt;Odd extension: &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; when &lt;object class="valign-m2 latex-math" data="https://eli.thegreenplace.net/images/math/e7fbdc98286846014db4fa4f5ef46d5d976c75d5.svg" style="height: 13px;" type="image/svg+xml"&gt;x\ge 0&lt;/object&gt; and
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/3c4482de6e0520991510d97cf67550d03e9e813b.svg" style="height: 17px;" type="image/svg+xml"&gt;-f(-x)&lt;/object&gt; when &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/92e0c7b6f34838a90088599672030c1921292807.svg" style="height: 11px;" type="image/svg+xml"&gt;x&amp;lt;0&lt;/object&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here’s an example of extending our sample function &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/f1dbdd3a5b38fafd9f78c329171bfe72dea6faf8.svg" style="height: 17px;" type="image/svg+xml"&gt;f(x)=x&lt;/object&gt; onto
the full interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/5f1297a5a8758acc19fd4c325ae19878e7e2fbab.svg" style="height: 17px;" type="image/svg+xml"&gt;[-L,L]&lt;/object&gt; and then repeating it periodically
every &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/8dde33545500de38fae974b4b18036def142e9e3.svg" style="height: 12px;" type="image/svg+xml"&gt;2L&lt;/object&gt;:&lt;/p&gt;
&lt;div class="fourier-plot-wrap"&gt;
  &lt;canvas id="function-extensions" class="fourier-plot-canvas" width="760" height="1280"&gt;
  Your browser does not support the HTML5 canvas tag.
  &lt;/canvas&gt;
&lt;/div&gt;&lt;p&gt;Note that the Fourier series for these extended functions will be
different. However, they will all converge to &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; in the
interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/6341a223ef0a566153beb0037d5a48d2d4b9d0eb.svg" style="height: 17px;" type="image/svg+xml"&gt;[0,L]&lt;/object&gt;. Typically, even and odd extensions have the
benefit of producing either cosine or sine series, correspondingly (as
discussed in the previous section).&lt;/p&gt;
&lt;p&gt;We’ve seen that Fourier series work well for periodic functions and also
non-periodic functions defined on a finite domain (because we can extend
these periodically). But what about aperiodic functions defined on the
entire real line? This is where we’ll have to leave Fourier series
behind and &lt;a class="reference external" href="https://eli.thegreenplace.net/2026/notes-on-the-fourier-transform/"&gt;move on to their generalization - the Fourier transform&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="example"&gt;
&lt;h2&gt;Example&lt;/h2&gt;
&lt;p&gt;Let’s take the following triangular function &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; &lt;a class="footnote-reference" href="#footnote-4" id="footnote-reference-4"&gt;[4]&lt;/a&gt;:&lt;/p&gt;
&lt;div class="fourier-plot-wrap"&gt;
  &lt;canvas id="triangle-wave" class="fourier-plot-canvas" width="760" height="510"&gt;
  Your browser does not support the HTML5 canvas tag.
  &lt;/canvas&gt;
&lt;/div&gt;&lt;p&gt;&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; is periodic with period 4. We can define it by starting
with a formula on the interval &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/4223e7fe7292caec8543b085e1c5e0f283d99e07.svg" style="height: 17px;" type="image/svg+xml"&gt;[0,2]&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/219270dd9765adc74c363412ff71219137e90f0c.svg" style="height: 51px;" type="image/svg+xml"&gt;\[t(x)=
\begin{cases}
    x     &amp;amp;  0 \leq x \leq 1 \\
    2-x   &amp;amp;  1 &amp;lt; x \leq 2  \\
\end{cases}\]&lt;/object&gt;
&lt;p&gt;Then making an odd extension into &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/8291e9956dc145c0d40503664cdb2aa8907faeec.svg" style="height: 17px;" type="image/svg+xml"&gt;[-2,0]&lt;/object&gt; and repeating it
periodically. Now we can go ahead to calculate its Fourier coefficients.&lt;/p&gt;
&lt;p&gt;Since this function is odd, we know that we’ll get a &lt;em&gt;sine series&lt;/em&gt;, as
&lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt; are going to be 0 for all &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt;. Let’s calculate
&lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt;; in our case &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/61b388ffea23456a34a8c200e35a624fb3500600.svg" style="height: 12px;" type="image/svg+xml"&gt;L=2&lt;/object&gt; (half the period).&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/842ae33a5aa7760177bcac4d6a4ce14bdb3ad3a3.svg" style="height: 43px;" type="image/svg+xml"&gt;\[b_n=\frac{1}{2}\int_{-2}^{2}t(x)sin\frac{n\pi x}{2}dx\]&lt;/object&gt;
&lt;p&gt;Since &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; is odd and so is the sine, we’re integrating an even
function over a symmetric interval. Therefore, we only have to integrate
on the positive half of the range and multiply the result by two:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/d434617a027c2c9c6c40fda3d5df9efd71d9da5e.svg" style="height: 41px;" type="image/svg+xml"&gt;\[b_n=\int_{0}^{2}t(x)sin\frac{n\pi x}{2}dx\]&lt;/object&gt;
&lt;p&gt;Let’s set &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/0845fe4b9330ab55e9477397cf6a0372b91d9490.svg" style="height: 18px;" type="image/svg+xml"&gt;k=\frac{n\pi}{2}&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/da138d7dfb7e49cbba7719c34fa84063eacac079.svg" style="height: 41px;" type="image/svg+xml"&gt;\[b_n=\int_{0}^{2}t(x)sin(kx)dx\]&lt;/object&gt;
&lt;p&gt;And split up the integral for the different segments of &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/c520bcc563be425bf5eca3c72ccc1dd315148e9d.svg" style="height: 41px;" type="image/svg+xml"&gt;\[b_n=\int_{0}^{1}x\cdot sin(kx)dx+\int_{1}^{2}(2-x)sin(kx)dx\]&lt;/object&gt;
&lt;p&gt;The first integral, by the method described in Appendix C:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f0ab0ff7e24e7e2488aca6dc7b26a5876f95edca.svg" style="height: 44px;" type="image/svg+xml"&gt;\[I_1=\int_{0}^{1}x\cdot sin(kx)dx=\bigg[\frac{-x cos(kx)}{k}+\frac{sin(kx)}{k^2} \bigg]_{0}^{1}=\frac{sin(k)}{k^2}-\frac{cos(k)}{k}\]&lt;/object&gt;
&lt;p&gt;The second integral can also be split into two:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f9bbd9960bbe4f5b7689ca32176c299b111ba79c.svg" style="height: 41px;" type="image/svg+xml"&gt;\[I_2=\int_{1}^{2}2sin(kx)dx - \int_{1}^{2}x\cdot sin(kx)dx\]&lt;/object&gt;
&lt;p&gt;The first of these is trivial to calculate; the second can once again
use Appendix C. After some tedious but straightforward calculations &lt;a class="footnote-reference" href="#footnote-5" id="footnote-reference-5"&gt;[5]&lt;/a&gt;
we’ll get:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/adac1720b14c2fe0786b54bc27aae1aef0fbef48.svg" style="height: 36px;" type="image/svg+xml"&gt;\[I_2=\frac{cos(k)}{k}+\frac{sin(k)-sin(2k)}{k^2}\]&lt;/object&gt;
&lt;p&gt;Adding &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e1d59f2ede2e9c62de3e7071e2f8fe5034aed288.svg" style="height: 14px;" type="image/svg+xml"&gt;I_1+I_2&lt;/object&gt;, we get:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/15e4c796f5a29a762fec37d78ae7c706f4be0ea5.svg" style="height: 77px;" type="image/svg+xml"&gt;\[\begin{aligned}
b_n=I_1+I_2&amp;amp;=\frac{sin(k)}{k^2}-\frac{cos(k)}{k}+\frac{cos(k)}{k}+\frac{sin(k)-sin(2k)}{k^2}\\
&amp;amp;=\frac{2sin(k)-sin(2k)}{k^2}
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Now let’s substitute &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/0845fe4b9330ab55e9477397cf6a0372b91d9490.svg" style="height: 18px;" type="image/svg+xml"&gt;k=\frac{n\pi}{2}&lt;/object&gt; back. This makes
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/bb77ea3f09c1bd70e8755e99c100f6240fbbaee2.svg" style="height: 17px;" type="image/svg+xml"&gt;sin(2k)&lt;/object&gt; zero because the sine of an integer multiple of
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6ac47b6d7372b4087583cfd048d20f4c1571f5cf.svg" style="height: 7px;" type="image/svg+xml"&gt;\pi&lt;/object&gt; is always zero:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/0dd6f332d6b02605b05f4ec20712ba682a73f754.svg" style="height: 46px;" type="image/svg+xml"&gt;\[b_n=\frac{2sin \frac{n\pi}{2}}{\left (\frac{n\pi}{2}\right )^2}=\frac{8sin \frac{n\pi}{2}}{n^2\pi^2}\]&lt;/object&gt;
&lt;p&gt;We have &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt;, so the Fourier series for our &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt; is:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/c3d02d270ba13c4401ff78e0d65bbab33d27fa8f.svg" style="height: 46px;" type="image/svg+xml"&gt;\[t(x)=\sum_{n=1}^{\infty}\frac{8}{n^2\pi^2}sin\frac{n\pi}{2}sin\frac{n\pi x}{2}\]&lt;/object&gt;
&lt;p&gt;Note that for even values of &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt;, &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/4285416a9a4c5ba91639c3d1f777c6de55ce72c2.svg" style="height: 18px;" type="image/svg+xml"&gt;sin \frac{n\pi}{2}&lt;/object&gt; is
zero, so only the odd terms remain:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/7942a20004aaf07d850b012826c56720f6efa3ce.svg" style="height: 41px;" type="image/svg+xml"&gt;\[t(x)=\frac{8}{\pi^2}\bigg[ sin\frac{\pi x}{2}-\frac{1}{3^2} sin\frac{3\pi x}{2}+\frac{1}{5^2}sin\frac{5\pi x}{2}-\cdots\bigg]\]&lt;/object&gt;
&lt;p&gt;Here’s an interactive chart showing how the series &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/75a7147566fd4ba98fe5d85fe008fab6d58d3968.svg" style="height: 17px;" type="image/svg+xml"&gt;t(x)&lt;/object&gt;
converges to our triangular function. You can set the number of terms in
the Fourier series and see the effect (red line). Note that all even
coefficients are zero so it will look the same for &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt; as for
&lt;object class="valign-m1 latex-math" data="https://eli.thegreenplace.net/images/math/81f998c5713fded10a77db292e4114ec87997543.svg" style="height: 12px;" type="image/svg+xml"&gt;n-1&lt;/object&gt; when &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt; is odd.&lt;/p&gt;
&lt;div class="fourier-plot-wrap"&gt;
  &lt;canvas id="triangle-fourier" class="fourier-plot-canvas" width="760" height="510"&gt;
  Your browser does not support the HTML5 canvas tag.
  &lt;/canvas&gt;

  &lt;div class="fourier-plot-controls"&gt;
    &lt;div class="fourier-plot-grid"&gt;
      &lt;label class="fourier-plot-label" for="triangle-fourier-terms"&gt;
        n (terms in the Fourier series)
        &lt;input id="triangle-fourier-terms" class="fourier-plot-input" type="number" value="1" min="1" max="99" step="2"&gt;
      &lt;/label&gt;
    &lt;/div&gt;

    &lt;div id="triangle-fourier-message" class="fourier-plot-message"&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;div class="section" id="compact-formula-using-a-single-phase-shifted-sinusoid"&gt;
&lt;h2&gt;Compact formula using a single phase-shifted sinusoid&lt;/h2&gt;
&lt;p&gt;We’ve written the Fourier series for &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; as follows so far:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/af4acda237be7c5348b05201f8f6f6c6b75e30b9.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n cos\frac{n\pi x}{L}+b_n sin\frac{n\pi x}{L}\right)\]&lt;/object&gt;
&lt;p&gt;We can rewrite this in a somewhat more compact form, using a single
sinusoid with a configurable phase at each &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/0e0b529f628f772b5448c6ec96e6d5884885480b.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}q_n\cdot cos\left(\frac{n\pi x}{L}+\theta_n\right)\]&lt;/object&gt;
&lt;p&gt;Based on Appendix D, &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/0dacaea006b7f9f49020f85f9803b4467a77094b.svg" style="height: 11px;" type="image/svg+xml"&gt;q_n&lt;/object&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/7dde5e64e049b615293b3dd8f94a70defa6a789b.svg" style="height: 14px;" type="image/svg+xml"&gt;\theta_n&lt;/object&gt; can be computed as
follows:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/dfca335ac97ffd88dc5a83a1ae48576dfa84d8b7.svg" style="height: 44px;" type="image/svg+xml"&gt;\[\begin{aligned}
    q_n&amp;amp;=\sqrt{a_n^2+b_n^2}\\
    \theta_n&amp;amp;=\operatorname{atan2}(-b_n,a_n)
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;When Fourier series are used in the context of signal processing, this
formulation is easier to reason about because it represents the
magnitude and phase shift of each harmonic of &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; in the
frequency domain &lt;a class="footnote-reference" href="#footnote-6" id="footnote-reference-6"&gt;[6]&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="complex-fourier-series"&gt;
&lt;h2&gt;Complex Fourier series&lt;/h2&gt;
&lt;p&gt;It should not come as a surprise that the Fourier series, being a
combination of trigonometric functions, can also be represented with
complex exponential functions.&lt;/p&gt;
&lt;p&gt;Specifically, we’ll show that our &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; can be approximated as
follows:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/0330fae433a3379cfef316d192bfe32e38e0c9c9.svg" style="height: 47px;" type="image/svg+xml"&gt;\[f(x)=\sum_{n=-\infty}^{\infty}C_n\cdot e^{in\pi x/L}\]&lt;/object&gt;
&lt;p&gt;Let’s calculate &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e6456786af3c999a8eda7658e37f7bf5d1bb0db0.svg" style="height: 14px;" type="image/svg+xml"&gt;C_n&lt;/object&gt;. We proceed in a manner similar to before,
by multiplying both sides of the equation by &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/e8594d0018e4f868e916c1657b8273bb9bfe2191.svg" style="height: 15px;" type="image/svg+xml"&gt;e^{-im\pi x/L}&lt;/object&gt; and
taking an integral in the range &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/5f1297a5a8758acc19fd4c325ae19878e7e2fbab.svg" style="height: 17px;" type="image/svg+xml"&gt;[-L,L]&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f0a6b29c21ad20ebd950fe01f05b43c1fa67aa22.svg" style="height: 103px;" type="image/svg+xml"&gt;\[\begin{aligned}
\int_{-L}^{L}f(x)e^{-im\pi x/L}dx&amp;amp;=\sum_{n=-\infty}^{\infty}\int_{-L}^{L}C_n\cdot e^{in\pi x/L}e^{-im\pi x/L}dx\\
&amp;amp;=\sum_{n=-\infty}^{\infty}\int_{-L}^{L}C_n\cdot e^{i(n-m)\pi x/L}dx
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;By Appendix A, the sum elements are all zero when &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/3ae4a06555822644174f9ff9419084466b3f7aa4.svg" style="height: 15px;" type="image/svg+xml"&gt;n\neq m&lt;/object&gt;. When
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/193bdae8b42385001cd707bc207b1d95bd6dc2b2.svg" style="height: 7px;" type="image/svg+xml"&gt;n=m&lt;/object&gt;, we get:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/e67fe1e7dabb9b96c06224e0d785d9a6d17601c4.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\int_{-L}^{L}f(x)e^{-im\pi x/L}dx=\int_{-L}^{L}C_m\cdot 1 \cdot dx=2LC_m\]&lt;/object&gt;
&lt;p&gt;Therefore, renaming &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6b0d31c0d563223024da45691584643ac78c96e8.svg" style="height: 7px;" type="image/svg+xml"&gt;m&lt;/object&gt; to &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt; (since it’s just an arbitrary
integer constant):&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/d70fa4e75b4b604398d8d3c108a75bea622e72ef.svg" style="height: 43px;" type="image/svg+xml"&gt;\[C_n=\frac{1}{2L}\int_{-L}^{L}f(x)e^{-in\pi x/L}dx\]&lt;/object&gt;
&lt;p&gt;We’ve found an alternative formulation to Fourier series, using complex
exponentials instead of trigonometric functions. While this was a direct
derivation, another way to achieve the same result is to use the &lt;a class="reference external" href="https://eli.thegreenplace.net/2024/notes-on-the-euler-formula/"&gt;Euler
Formula&lt;/a&gt;
to derive:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/421172c9cfae4c087883b04c9d6c047b8c2a03e9.svg" style="height: 80px;" type="image/svg+xml"&gt;\[\begin{aligned}
    cos\theta&amp;amp;=\frac{e^{i\theta}+e^{-i\theta}}{2}\\
    sin\theta&amp;amp;=\frac{e^{i\theta}-e^{-i\theta}}{2i}
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;And substitute these into the original Fourier series formula. I’ll
leave this as an exercise for the diligent reader; eventually, the
result will be the same. Moreover, it’s possible to show a direct
correspondence between &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt;, &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e6456786af3c999a8eda7658e37f7bf5d1bb0db0.svg" style="height: 14px;" type="image/svg+xml"&gt;C_n&lt;/object&gt;, for
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/98b4f7b1f9e3613bfd676d3fdee9cd7b3b3f2a93.svg" style="height: 11px;" type="image/svg+xml"&gt;n&amp;gt;0&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/5f31bd78b45bb047f333a4257d8aa79cede582cd.svg" style="height: 111px;" type="image/svg+xml"&gt;\[\begin{aligned}
    C_0&amp;amp;=\frac{a_0}{2}\\
    C_n&amp;amp;=\frac{a_n-ib_n}{2}\\
    C_{-n}&amp;amp;=\frac{a_n+ib_n}{2}\\
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Note that &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/0bd1272b8272095400c72ab3f5bd52378bef592e.svg" style="height: 16px;" type="image/svg+xml"&gt;C_{-n}=C_n^*&lt;/object&gt; when both &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt; are
real (which is the case for a real-valued &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;). This helps
explain why the complex formulation has negative frequencies in the sum;
when the function is actually real, each negative frequency is paired up
with a positive frequency and the result is real &lt;a class="footnote-reference" href="#footnote-7" id="footnote-reference-7"&gt;[7]&lt;/a&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/530d1067a8b3fa34b5cc74abccb738a58540022a.svg" style="height: 104px;" type="image/svg+xml"&gt;\[\begin{aligned}
C_n e^{in\pi x/L}+C_{-n} e^{-in\pi x/L}&amp;amp;=C_n e^{in\pi x/L}+C_n^* e^{-in\pi x/L}\\
&amp;amp;=C_n e^{in\pi x/L}+\left(C_{n} e^{in\pi x/L}\right)^*\\
&amp;amp;=2\operatorname{Re}\bigg(C_{n} e^{in\pi x/L}\bigg)
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;So, for a real function we only need to account for positive
frequencies:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/1e0faa05c55997d3b0f2c58c8bb16dca0b701fd0.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f(x)=C_0+\sum_{n=1}^{\infty}2\operatorname{Re}\bigg(C_{n} e^{in\pi x/L}\bigg)\]&lt;/object&gt;
&lt;p&gt;We can take it further. &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e6456786af3c999a8eda7658e37f7bf5d1bb0db0.svg" style="height: 14px;" type="image/svg+xml"&gt;C_n&lt;/object&gt; is a complex number, so let’s
represent it in polar form as &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/1a21212523d9fce12a0769bdee7b76db92fd7e64.svg" style="height: 20px;" type="image/svg+xml"&gt;C_n=\frac{q_n}{2} e^{i\theta_n}&lt;/object&gt;
(the factor of half will make sense soon). Then:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/06c843ccf5621a53bd6a5c9cee599cfabbdc2a85.svg" style="height: 133px;" type="image/svg+xml"&gt;\[\begin{aligned}
\operatorname{Re}\bigg(C_{n} e^{in\pi x/L}\bigg)&amp;amp;=\operatorname{Re}\bigg(\frac{q_n}{2} e^{i\theta_n}e^{in\pi x/L}\bigg)\\
&amp;amp;=\frac{q_n}{2}\operatorname{Re}\bigg(e^{i(n\pi x/L + \theta_n)}\bigg)\\
&amp;amp;=\frac{q_n}{2} cos\bigg(\frac{n\pi x}{L}+\theta_n\bigg)
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;And substituting back into the sum:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/c6d0bb12eb5cc2fbb7f881c0ecf8fcf0f700eeda.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f(x)=C_0+\sum_{n=1}^{\infty}q_n cos\bigg(\frac{n\pi x}{L}+\theta_n\bigg)\]&lt;/object&gt;
&lt;p&gt;This is precisely the compact formulation from the previous section!&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="fourier-orthogonal-basis-in-hilbert-space"&gt;
&lt;h2&gt;Fourier orthogonal basis in Hilbert space&lt;/h2&gt;
&lt;p&gt;The most beautiful aspect of Fourier theory is that it doesn’t just
happen to work by chance, and is deeply connected to linear algebra.
Please read &lt;a class="reference external" href="https://eli.thegreenplace.net/2025/hilbert-space-treating-functions-as-vectors/"&gt;my post on Hilbert
space&lt;/a&gt;
before proceeding.&lt;/p&gt;
&lt;p&gt;The space of real-valued square integrable functions &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/f1aae083af2c79348dd78712847ebd55537fa6e6.svg" style="height: 14px;" type="image/svg+xml"&gt;L^2&lt;/object&gt; forms a
Hilbert space, in which we can define the inner product (assuming real
functions):&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/979d2b712d89bac8c7950b7b13ecf0b895422989.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\langle f,g \rangle=\int_{-L}^{L}f(x)g(x) dx\]&lt;/object&gt;
&lt;p&gt;We’ve demonstrated that the family of functions:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f4bd9b77b937cf139ca1c071a6783fcdeafdd8cf.svg" style="height: 30px;" type="image/svg+xml"&gt;\[1,\qquad cos\frac{n\pi x}{L},\qquad sin\frac{n\pi x}{L}\]&lt;/object&gt;
&lt;p&gt;Are all mutually orthogonal, because their pairwise inner products are
zero! We’ve also shown that any function in &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/f1aae083af2c79348dd78712847ebd55537fa6e6.svg" style="height: 14px;" type="image/svg+xml"&gt;L^2&lt;/object&gt; can be
represented as a weighted sum of these functions:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/af4acda237be7c5348b05201f8f6f6c6b75e30b9.svg" style="height: 46px;" type="image/svg+xml"&gt;\[f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left(a_n cos\frac{n\pi x}{L}+b_n sin\frac{n\pi x}{L}\right)\]&lt;/object&gt;
&lt;p&gt;So these functions form a &lt;em&gt;basis&lt;/em&gt; for &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/f1aae083af2c79348dd78712847ebd55537fa6e6.svg" style="height: 14px;" type="image/svg+xml"&gt;L^2&lt;/object&gt;. When we think of
these functions as vectors (in an infinite Hilbert space), much of what
we did in this post starts feeling like &amp;quot;normal&amp;quot; linear algebra. For
example, when we have a set of basis vectors and we want to know how to
represent some vector &lt;img alt="v" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/7a38d8cbd20d9932ba948efaa364bb62651d5ad4.png" style="height: 7px;" /&gt; in this basis, we usually find the
coefficients by &lt;a class="reference external" href="https://eli.thegreenplace.net/2024/projections-and-projection-matrices/"&gt;projecting
it&lt;/a&gt;
onto the basis. E.g. with a basis vector &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/da8e9997a010be78b20108ce79fec1fb9c63d8dc.svg" style="height: 10px;" type="image/svg+xml"&gt;e_1&lt;/object&gt;, the coefficient of
&lt;img alt="v" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/7a38d8cbd20d9932ba948efaa364bb62651d5ad4.png" style="height: 7px;" /&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/71b725179f33404ddc381f57d651c348ddfbee36.svg" style="height: 40px;" type="image/svg+xml"&gt;\[c=\frac{\langle v, e_1\rangle}{\langle e_1, e_1\rangle}\]&lt;/object&gt;
&lt;p&gt;Similarly, when we calculate the Fourier coefficient &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt; for some
function &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;, we project &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; onto the basis vector
&lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/08cb570d61f7bb6f46cf3bf12e2c407a43e748b8.svg" style="height: 18px;" type="image/svg+xml"&gt;sin\frac{n\pi x}{L}&lt;/object&gt; by calculating:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/40fddd72747ac208870cfe3ee684128d21812cfa.svg" style="height: 43px;" type="image/svg+xml"&gt;\[b_n=\frac{\langle f(x), sin\frac{n\pi x}{L}\rangle}{\langle sin\frac{n\pi x}{L}, sin\frac{n\pi x}{L}\rangle}\]&lt;/object&gt;
&lt;p&gt;From Appendix B, we know that the denominator is &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/d160e0986aca4714714a16f29ec605af90be704d.svg" style="height: 12px;" type="image/svg+xml"&gt;L&lt;/object&gt;, and we’ve
just denoted:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/fc0911ff039b636dc0b1f9ae9cc804c68cab812d.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\langle f(x), sin\frac{n\pi x}{L}\rangle=\int_{-L}^{L}f(x)sin\frac{n\pi x}{L}dx\]&lt;/object&gt;
&lt;p&gt;So we get:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/418eef7e6ac0ffd84fc9d87246f1329d17cb6d4c.svg" style="height: 43px;" type="image/svg+xml"&gt;\[b_n=\frac{1}{L}\int_{-L}^{L}f(x)sin\frac{n\pi x}{L}dx\]&lt;/object&gt;
&lt;p&gt;Which should look familiar!&lt;/p&gt;
&lt;p&gt;This is the core linear-algebra idea behind Fourier series: the
functions &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/356a192b7913b04c54574d18c28d46e6395428ab.svg" style="height: 11px;" type="image/svg+xml"&gt;1&lt;/object&gt;, &lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/0141773559b36de7a9e12feb64f961177df6b9d5.svg" style="height: 18px;" type="image/svg+xml"&gt;cos\frac{n\pi x}{L}&lt;/object&gt;, and
&lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/08cb570d61f7bb6f46cf3bf12e2c407a43e748b8.svg" style="height: 18px;" type="image/svg+xml"&gt;sin\frac{n\pi x}{L}&lt;/object&gt; play the role of orthogonal basis vectors,
while the Fourier coefficients are coordinates of &lt;img alt="f" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/4a0a19218e082a343a1b17e5333409af9d98f0f5.png" style="height: 15px;" /&gt; in this
basis. The integral formulas for &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt; are not
mysterious tricks; they are projections, just like dot products with
basis vectors in ordinary Euclidean space.&lt;/p&gt;
&lt;p&gt;Fourier series therefore let us decompose a function into independent
orthogonal directions, much like decomposing a vector into its
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.svg" style="height: 8px;" type="image/svg+xml"&gt;x&lt;/object&gt;, &lt;img alt="y" class="valign-m3 latex-math" src="https://eli.thegreenplace.net/images/math/95cb0bfd2977c761298d9624e4b4d4c72a39974a.png" style="height: 11px;" /&gt;, and &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/395df8f7c51f007019cb30201c49e884b46b92fa.svg" style="height: 7px;" type="image/svg+xml"&gt;z&lt;/object&gt; components.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="appendix-a-integrals-of-sinusoids"&gt;
&lt;h2&gt;Appendix A: Integrals of sinusoids&lt;/h2&gt;
&lt;p&gt;For any integer &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/797c9948b82583001e2fe0e9343c783ca16709b0.svg" style="height: 15px;" type="image/svg+xml"&gt;n\neq 0&lt;/object&gt; and an arbitrary constant L, we have:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/582e940109a028f515a388f8003ebfbb00823dd3.svg" style="height: 86px;" type="image/svg+xml"&gt;\[\begin{aligned}
\int_{-L}^{L}cos\frac{n\pi x}{L}dx&amp;amp;=\bigg[\frac{L}{n\pi}sin\frac{n\pi x}{L}\bigg]_{-L}^{L}\\
&amp;amp;=\frac{L}{n\pi}(sin(n\pi)-sin(-n\pi))=0
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Similarly:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f5220d0714489c00c6ec8c5ac2df22bf8d8cb1f4.svg" style="height: 86px;" type="image/svg+xml"&gt;\[\begin{aligned}
\int_{-L}^{L}sin\frac{n\pi x}{L}dx&amp;amp;=\bigg[\frac{-L}{n\pi}cos\frac{n\pi x}{L}\bigg]_{-L}^{L}\\
&amp;amp;=\frac{-L}{n\pi}\left(cos(n\pi)-cos(-n\pi)\right)=0
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Using these, we can calculate the integral of a complex exponential
function for an integer &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/797c9948b82583001e2fe0e9343c783ca16709b0.svg" style="height: 15px;" type="image/svg+xml"&gt;n\neq 0&lt;/object&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/3ae1815e617e0b0191a17fa9b07196ededfaf901.svg" style="height: 43px;" type="image/svg+xml"&gt;\[\begin{aligned}
\int_{-L}^{L}e^{in\pi x/L}dx=\int_{-L}^{L}\bigg[ cos\frac{n\pi x}{L} +i\cdot sin\frac{n\pi x}{L}\bigg] dx=0
\end{aligned}\]&lt;/object&gt;
&lt;/div&gt;
&lt;div class="section" id="appendix-b-integrals-of-products-of-sinusoids"&gt;
&lt;h2&gt;Appendix B: Integrals of products of sinusoids&lt;/h2&gt;
&lt;p&gt;We’ll start with the product of two sines, for any positive integers
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/6b0d31c0d563223024da45691584643ac78c96e8.svg" style="height: 7px;" type="image/svg+xml"&gt;m&lt;/object&gt; and &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/e95f65d1c2626cffbdb8e474676708ef6ca38278.svg" style="height: 43px;" type="image/svg+xml"&gt;\[ss=\int_{-L}^{L}sin\frac{m\pi x}{L}\cdot sin\frac{n\pi x}{L}dx\]&lt;/object&gt;
&lt;p&gt;Using the trigonometric identity for a product of sines, we can write:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/06a26e4d08d086b4e29b1c23a918009d9f03886c.svg" style="height: 91px;" type="image/svg+xml"&gt;\[\begin{aligned}
    ss&amp;amp;=\frac{1}{2}\int_{-L}^{L}\bigg(cos\frac{(m-n)\pi x}{L}-cos\frac{(m+n)\pi x}{L}\bigg)dx\\
    &amp;amp;=\frac{1}{2}\int_{-L}^{L}cos\frac{(m-n)\pi x}{L}dx-\frac{1}{2}\int_{-L}^{L}cos\frac{(m+n)\pi x}{L}dx
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Now let’s focus on two different scenarios, &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/c21c6fe891018692f0717e8f38fbd44941a8ab7c.svg" style="height: 15px;" type="image/svg+xml"&gt;m\neq n&lt;/object&gt; and
&lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/49cfc75f5c423bc73e28d59b794e2815d1f4bb54.svg" style="height: 7px;" type="image/svg+xml"&gt;m=n&lt;/object&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/c21c6fe891018692f0717e8f38fbd44941a8ab7c.svg" style="height: 15px;" type="image/svg+xml"&gt;m\neq n&lt;/object&gt;, then each of the integrals constituting &lt;em&gt;ss&lt;/em&gt; are 0
(see on Appendix A), so &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/19db77825a7cd28d0344f9b160251f8230d08b30.svg" style="height: 11px;" type="image/svg+xml"&gt;ss=0&lt;/object&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/49cfc75f5c423bc73e28d59b794e2815d1f4bb54.svg" style="height: 7px;" type="image/svg+xml"&gt;m=n&lt;/object&gt;, then the second integral is still 0, but the first one
isn’t:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/024afeb4e1aa17cd4cf9bfc70fdf0d9d09be7faf.svg" style="height: 91px;" type="image/svg+xml"&gt;\[\begin{aligned}
    ss&amp;amp;=\frac{1}{2}\int_{-L}^{L}cos\frac{0\pi x}{L}dx\\
    &amp;amp;=\frac{1}{2}\int_{-L}^{L}1dx=L
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Therefore:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/85dbc4cbb84044fdfda7f2cd5f42453581bc987f.svg" style="height: 51px;" type="image/svg+xml"&gt;\[ss=\int_{-L}^{L}sin\frac{m\pi x}{L}\cdot sin\frac{n\pi x}{L}dx=
\begin{cases}
    L      &amp;amp; m = n \\
    0      &amp;amp; m \neq n
\end{cases}\]&lt;/object&gt;
&lt;p&gt;We can use exactly the same approach to show that:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/bd73561c5868f1519b9b264f81010d9a513dbae6.svg" style="height: 51px;" type="image/svg+xml"&gt;\[cc=\int_{-L}^{L}cos\frac{m\pi x}{L}\cdot cos\frac{n\pi x}{L}dx=
\begin{cases}
    L      &amp;amp; m = n \\
    0      &amp;amp; m \neq n
\end{cases}\]&lt;/object&gt;
&lt;p&gt;One more variant to cover:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f6b7bc73da6ce073e32f0f1253ab5270d19973c5.svg" style="height: 43px;" type="image/svg+xml"&gt;\[sc=\int_{-L}^{L}sin\frac{m\pi x}{L}\cdot cos\frac{n\pi x}{L}dx\]&lt;/object&gt;
&lt;p&gt;Since sine is an odd function and cosine is an even function, their
product is an odd function. And the integral of an odd function over a
symmetric interval is 0 (see &lt;a class="reference external" href="https://eli.thegreenplace.net/2025/notes-on-even-and-odd-functions/"&gt;this post for more
details&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Therefore:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/8b8669232a6f30dc68a091abffc787858632cb5c.svg" style="height: 43px;" type="image/svg+xml"&gt;\[sc=\int_{-L}^{L}sin\frac{m\pi x}{L}\cdot cos\frac{n\pi x}{L}dx=0\]&lt;/object&gt;
&lt;/div&gt;
&lt;div class="section" id="appendix-c-a-useful-integral"&gt;
&lt;h2&gt;Appendix C: A useful integral&lt;/h2&gt;
&lt;p&gt;Let’s calculate the indefinite integral:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/df863382117243993f6ef34cf6216f181f891d19.svg" style="height: 38px;" type="image/svg+xml"&gt;\[I=\int x\cdot sin(kx) dx\]&lt;/object&gt;
&lt;p&gt;For some constant &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/13fbd79c3d390e5d6585a21e11ff5ec1970cff0c.svg" style="height: 12px;" type="image/svg+xml"&gt;k&lt;/object&gt;. We’ll use integration by parts:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/8033553504b7b9ace816e595172d3942155fa8f1.svg" style="height: 38px;" type="image/svg+xml"&gt;\[\int u\cdot dv =u\cdot v - \int v\cdot du\]&lt;/object&gt;
&lt;p&gt;Here &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/a6327890f9dd75f11f057eb1e4465c365cd3b531.svg" style="height: 7px;" type="image/svg+xml"&gt;u=x&lt;/object&gt;, so &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/febc1f31b2dbfc3e5d91801704e4d37f73c047af.svg" style="height: 12px;" type="image/svg+xml"&gt;du=dx&lt;/object&gt;. Also &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/0a3c6cb92a28005f4435cf19ab35bd121d69cd09.svg" style="height: 17px;" type="image/svg+xml"&gt;dv=sin(kx)&lt;/object&gt;, so
&lt;object class="valign-m6 latex-math" data="https://eli.thegreenplace.net/images/math/850143056c00b486079d9e102e7354b38236fbcb.svg" style="height: 23px;" type="image/svg+xml"&gt;v=-\frac{cos(kx)}{k}&lt;/object&gt;.&lt;/p&gt;
&lt;p&gt;Putting it together:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/552c213e2d0c70d208bd577d07d4fb37f2d19a0c.svg" style="height: 39px;" type="image/svg+xml"&gt;\[I=\frac{-x\cdot cos(kx)}{k}+\int \frac{cos(kx)}{k} dx=\frac{-x\cdot cos(kx)}{k}+\frac{sin(kx)}{k^2}\]&lt;/object&gt;
&lt;/div&gt;
&lt;div class="section" id="appendix-d-sinusoid-with-phase-as-a-sum-of-sin-and-cos"&gt;
&lt;h2&gt;Appendix D: Sinusoid with phase as a sum of sin and cos&lt;/h2&gt;
&lt;p&gt;Let’s take a general sinusoid with magnitude &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/22ea1c649c82946aa6e479e1ffd321e4a318b1b0.svg" style="height: 11px;" type="image/svg+xml"&gt;q&lt;/object&gt;, frequency
&lt;img alt="w" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 7px;" /&gt; and phase &lt;img alt="\theta" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/2c7bd5bad4fe6202ce4cdb40050bd68190b3aeb9.svg" style="height: 17px;" type="image/svg+xml"&gt;\[s(x)=q\cdot cos(wx+\theta)\]&lt;/object&gt;
&lt;p&gt;We’re going to show that &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/68cee1190d7058555e058756fed1d6527ab89855.svg" style="height: 17px;" type="image/svg+xml"&gt;s(x)&lt;/object&gt; can be represented as a sum of a
&lt;em&gt;sine&lt;/em&gt; and a &lt;em&gt;cosine&lt;/em&gt; with no phase. This is related to &lt;a class="reference external" href="https://eli.thegreenplace.net/2023/sum-of-same-frequency-sinusoids/"&gt;my earlier post
on the sum of same-frequency
sinusoids&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let’s start by expanding &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/68cee1190d7058555e058756fed1d6527ab89855.svg" style="height: 17px;" type="image/svg+xml"&gt;s(x)&lt;/object&gt; using a trigonometric identity:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/e8984abab15f66276ebb92fa0d02cfe9eed5c934.svg" style="height: 17px;" type="image/svg+xml"&gt;\[s(x)=q\cdot cos(\theta)cos(wx)-q\cdot sin(\theta)sin(wx)\]&lt;/object&gt;
&lt;p&gt;Now we’ll denote: &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/dcb99eb292280e6a796bbcb514744c3c301f0a35.svg" style="height: 17px;" type="image/svg+xml"&gt;a=q\cdot cos(\theta)&lt;/object&gt; and
&lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/af9b66bdf49b9575a347a5bf3bb7acfad1ef390b.svg" style="height: 17px;" type="image/svg+xml"&gt;b=-q\cdot sin(\theta)&lt;/object&gt;, so:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/fac6a492043d2c4afd90bf19471756cd0177227e.svg" style="height: 17px;" type="image/svg+xml"&gt;\[s(x)=a\cdot cos(wx)+b\cdot sin(wx)\]&lt;/object&gt;
&lt;p&gt;We have &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/86f7e437faa5a7fce15d1ddcb9eaeaea377667b8.svg" style="height: 7px;" type="image/svg+xml"&gt;a&lt;/object&gt; and &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98.svg" style="height: 12px;" type="image/svg+xml"&gt;b&lt;/object&gt; in terms of &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/22ea1c649c82946aa6e479e1ffd321e4a318b1b0.svg" style="height: 11px;" type="image/svg+xml"&gt;q&lt;/object&gt; and
&lt;img alt="\theta" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt;, but what about the other way around?&lt;/p&gt;
&lt;p&gt;Let’s take the equations:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/bed3f7ea8728473d264871af14bedc7371943db4.svg" style="height: 41px;" type="image/svg+xml"&gt;\[\begin{aligned}
    a&amp;amp;=q\cdot cos(\theta)\\
    b&amp;amp;=-q\cdot sin(\theta)
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Square both of them and add together:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/ef69aacd4b99f916e773666322d7664a7f80b416.svg" style="height: 47px;" type="image/svg+xml"&gt;\[\begin{aligned}
    a^2+b^2&amp;amp;=q^2\cdot(cos^2(\theta)+sin^2(\theta))=q^2\\
    &amp;amp;\Rightarrow q=\sqrt{a^2+b^2}
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Now we’ll take the equations for &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98.svg" style="height: 12px;" type="image/svg+xml"&gt;b&lt;/object&gt; and &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/86f7e437faa5a7fce15d1ddcb9eaeaea377667b8.svg" style="height: 7px;" type="image/svg+xml"&gt;a&lt;/object&gt; and divide one
by the other:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/df7db0eac6bb842fe0fd6d76e1cd918a74fce9bb.svg" style="height: 64px;" type="image/svg+xml"&gt;\[\begin{aligned}
    \frac{b}{a}&amp;amp;=\frac{-sin(\theta)}{cos(\theta)}\\
    &amp;amp;\Rightarrow\theta=\operatorname{atan2}(-b,a)
\end{aligned}\]&lt;/object&gt;
&lt;p&gt;Where &lt;a class="reference external" href="https://en.wikipedia.org/wiki/Atan2"&gt;the atan2 function&lt;/a&gt; is
careful to take into account the sign of both numerator and denominator.
Also it’s worth mentioning that &lt;img alt="\theta" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt; is determined up to
additions of &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/0833718ca4569f36e84dbdc7742eaec65e49b150.svg" style="height: 11px;" type="image/svg+xml"&gt;2\pi&lt;/object&gt;.&lt;/p&gt;
&lt;p&gt;To conclude, for any &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/22ea1c649c82946aa6e479e1ffd321e4a318b1b0.svg" style="height: 11px;" type="image/svg+xml"&gt;q&lt;/object&gt;, &lt;img alt="w" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 7px;" /&gt; and &lt;img alt="\theta" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt;:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/f202b285532ca490fbec00a7a182a3ee518d945f.svg" style="height: 17px;" type="image/svg+xml"&gt;\[q\cdot cos(wx+\theta)=a\cdot cos(wx)+b\cdot sin(wx)\]&lt;/object&gt;
&lt;p&gt;With the aforementioned conversion formulas for &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/86f7e437faa5a7fce15d1ddcb9eaeaea377667b8.svg" style="height: 7px;" type="image/svg+xml"&gt;a&lt;/object&gt;, &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98.svg" style="height: 12px;" type="image/svg+xml"&gt;b&lt;/object&gt;.&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;A function &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt; is called periodic if there exists some
constant &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/cf2af45cefa3d7ceadaff0dfa38db6898e6ff301.svg" style="height: 12px;" type="image/svg+xml"&gt;P&amp;gt;0&lt;/object&gt; such that &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/02c74bd56236fce328ac0a48fda293dca178af78.svg" style="height: 17px;" type="image/svg+xml"&gt;f(x+P)=f(x)\ \forall x&lt;/object&gt;. In our
case, we denote the period as &lt;object class="valign-0 latex-math" data="https://eli.thegreenplace.net/images/math/f200dcf24d7a0a3035a4c7023b03459f6b22e3cc.svg" style="height: 12px;" type="image/svg+xml"&gt;P=2L&lt;/object&gt; to make presentation and
calculations neater.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Since &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/9ea1a3c68ad2e5a68e78cff7fe65bf38d08519bb.svg" style="height: 18px;" type="image/svg+xml"&gt;f(x)\in L^2&lt;/object&gt;, we know that it’s integrable on a finite
interval&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-3" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-3"&gt;[3]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;There’s also an infinite number of less natural ways to extend the
function; they will still work, but may make the calculation
needlessly complicated&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-4" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-4"&gt;[4]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;I chose this one because the more common ones like a square wave and
a sawtooth wave have many derivations available online, including on
Wikipedia.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-5" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-5"&gt;[5]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Try it for yourself - it’s a good exercise.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-6" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-6"&gt;[6]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;When &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/7cf469bc52df59c26bf99dd9ecbf71b7f6f5ab78.svg" style="height: 14px;" type="image/svg+xml"&gt;q_n=0&lt;/object&gt; for some &lt;img alt="n" class="valign-0 latex-math" src="https://eli.thegreenplace.net/images/math/d1854cae891ec7b29161ccaf79a24b00c274bdaa.png" style="height: 7px;" /&gt;, the corresponding
&lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/7dde5e64e049b615293b3dd8f94a70defa6a789b.svg" style="height: 14px;" type="image/svg+xml"&gt;\theta_n&lt;/object&gt; can be chosen arbitrarily.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-7" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-7"&gt;[7]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;For a complex-valued &lt;img alt="f(x)" class="valign-m4 latex-math" src="https://eli.thegreenplace.net/images/math/3e03f4706048fbc6c5a252a85d066adf107fcc1f.png" style="height: 17px;" /&gt;, this conjugate symmetry no longer
holds in general. &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/278ab95d3a54aae8eaa25c34af66d93a19b5e75f.svg" style="height: 10px;" type="image/svg+xml"&gt;a_n&lt;/object&gt; and &lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/54d608cbef1529c3089b9281aa6dcb16a2e65f1f.svg" style="height: 14px;" type="image/svg+xml"&gt;b_n&lt;/object&gt; may be complex, so
&lt;object class="valign-m3 latex-math" data="https://eli.thegreenplace.net/images/math/e6456786af3c999a8eda7658e37f7bf5d1bb0db0.svg" style="height: 14px;" type="image/svg+xml"&gt;C_n&lt;/object&gt; and &lt;object class="valign-m4 latex-math" data="https://eli.thegreenplace.net/images/math/bdd14e4abf9623d7582bf4f5ba37adc1b564491f.svg" style="height: 15px;" type="image/svg+xml"&gt;C_{-n}&lt;/object&gt; need not be conjugates.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;script src="https://eli.thegreenplace.net/demos/fourier/fourier-plot.js"&gt;
&lt;/script&gt;&lt;/div&gt;
</content><category term="misc"></category><category term="Math"></category></entry><entry><title>Scaling, stretching and shifting sinusoids</title><link href="https://eli.thegreenplace.net/2026/scaling-stretching-and-shifting-sinusoids/" rel="alternate"></link><published>2026-05-02T07:17:00-07:00</published><updated>2026-05-02T14:18:12-07:00</updated><author><name>Eli Bendersky</name></author><id>tag:eli.thegreenplace.net,2026-05-02:/2026/scaling-stretching-and-shifting-sinusoids/</id><summary type="html">&lt;p&gt;This is a brief and simple &lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt; explanation of how to adjust the
standard sinusoid &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/1f2ea8ffab8deb0e5b854a260a68b42b7eb7b048.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(x)&lt;/object&gt; to change its amplitude, frequency and
phase shift. More precisely, given the general function:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/85a45cfe4c1671765c3ab7e3949d8f74f780a0f3.svg" style="height: 19px;" type="image/svg+xml"&gt;\[s(x)=A\cdot sin(w\cdot x+\theta)\]&lt;/object&gt;
&lt;p&gt;We’ll see how adjusting the parameters &lt;img alt="A" class="valign-0" src="https://eli.thegreenplace.net/images/math/6dcd4ce23d88e2ee9568ba546c007c63d9131c1b.png" style="height: 12px;" /&gt;, &lt;img alt="w" class="valign-0" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 8px;" /&gt; and
&lt;img alt="\theta" class="valign-0" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt; affect the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is a brief and simple &lt;a class="footnote-reference" href="#footnote-1" id="footnote-reference-1"&gt;[1]&lt;/a&gt; explanation of how to adjust the
standard sinusoid &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/1f2ea8ffab8deb0e5b854a260a68b42b7eb7b048.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(x)&lt;/object&gt; to change its amplitude, frequency and
phase shift. More precisely, given the general function:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/85a45cfe4c1671765c3ab7e3949d8f74f780a0f3.svg" style="height: 19px;" type="image/svg+xml"&gt;\[s(x)=A\cdot sin(w\cdot x+\theta)\]&lt;/object&gt;
&lt;p&gt;We’ll see how adjusting the parameters &lt;img alt="A" class="valign-0" src="https://eli.thegreenplace.net/images/math/6dcd4ce23d88e2ee9568ba546c007c63d9131c1b.png" style="height: 12px;" /&gt;, &lt;img alt="w" class="valign-0" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 8px;" /&gt; and
&lt;img alt="\theta" class="valign-0" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt; affect the shape of &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/68cee1190d7058555e058756fed1d6527ab89855.svg" style="height: 19px;" type="image/svg+xml"&gt;s(x)&lt;/object&gt;. Each section below
covers one of these aspects mathematically, and you can use the demo at
the bottom to experiment with the topic visually.&lt;/p&gt;
&lt;div class="section" id="scaling"&gt;
&lt;h2&gt;Scaling&lt;/h2&gt;
&lt;p&gt;Scaling is conceptually the simplest change; we adjust &lt;img alt="A" class="valign-0" src="https://eli.thegreenplace.net/images/math/6dcd4ce23d88e2ee9568ba546c007c63d9131c1b.png" style="height: 12px;" /&gt; to
increase or decrease the amplitude (maximal height) of &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/68cee1190d7058555e058756fed1d6527ab89855.svg" style="height: 19px;" type="image/svg+xml"&gt;s(x)&lt;/object&gt;. Setting
&lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/6a6272d9558de919b19aa13d56dc37e11c358150.svg" style="height: 13px;" type="image/svg+xml"&gt;A=2&lt;/object&gt; will make the &lt;img alt="y" class="valign-m4" src="https://eli.thegreenplace.net/images/math/95cb0bfd2977c761298d9624e4b4d4c72a39974a.png" style="height: 12px;" /&gt; value twice as large (in both the positive
and negative direction) as the original function.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="stretching"&gt;
&lt;h2&gt;Stretching&lt;/h2&gt;
&lt;p&gt;Stretching changes the frequency of &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/1f2ea8ffab8deb0e5b854a260a68b42b7eb7b048.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(x)&lt;/object&gt;, which is inverse
proportional to its period. The baseline function &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/1f2ea8ffab8deb0e5b854a260a68b42b7eb7b048.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(x)&lt;/object&gt; has a
period of &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/0833718ca4569f36e84dbdc7742eaec65e49b150.svg" style="height: 12px;" type="image/svg+xml"&gt;2\pi&lt;/object&gt;, meaning it repeats every &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/0833718ca4569f36e84dbdc7742eaec65e49b150.svg" style="height: 12px;" type="image/svg+xml"&gt;2\pi&lt;/object&gt;. In other
words, &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/48691bfc145b339ef1a94cfac6b43af86264c14b.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(x)=sin(x+2\pi)&lt;/object&gt; for any &lt;img alt="x" class="valign-0" src="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.png" style="height: 8px;" /&gt;.&lt;/p&gt;
&lt;p&gt;If we set &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/c8cb42808e0de9f61517078296f19134ac680422.svg" style="height: 12px;" type="image/svg+xml"&gt;w=2&lt;/object&gt;, we get &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/fd197962a5779ba863ea0db91d1ee9210d07002a.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(2x)&lt;/object&gt;. This function repeats
itself twice as fast as &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/1f2ea8ffab8deb0e5b854a260a68b42b7eb7b048.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(x)&lt;/object&gt;, because &lt;img alt="x" class="valign-0" src="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.png" style="height: 8px;" /&gt; is multiplied
by 2 before being fed into the sinusoid. If &lt;img alt="x" class="valign-0" src="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.png" style="height: 8px;" /&gt; changes by
&lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/6ac47b6d7372b4087583cfd048d20f4c1571f5cf.svg" style="height: 8px;" type="image/svg+xml"&gt;\pi&lt;/object&gt;, the sinusoid’s input changes by &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/0833718ca4569f36e84dbdc7742eaec65e49b150.svg" style="height: 12px;" type="image/svg+xml"&gt;2\pi&lt;/object&gt;.
Therefore, the period of &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/fd197962a5779ba863ea0db91d1ee9210d07002a.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(2x)&lt;/object&gt; is &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/6ac47b6d7372b4087583cfd048d20f4c1571f5cf.svg" style="height: 8px;" type="image/svg+xml"&gt;\pi&lt;/object&gt;, the period of
&lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/fd718cb7cfa198e46efa9f40dda81c2fb2aa26c9.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(4x)&lt;/object&gt; is &lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/7813100388622a69c767d297b453832a9df166fb.svg" style="height: 19px;" type="image/svg+xml"&gt;\frac{\pi}{2}&lt;/object&gt; and so on. &lt;a class="footnote-reference" href="#footnote-2" id="footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;More generally, the period of &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/59349af0e0016059129f0961133daaa009e68aa1.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(wx)&lt;/object&gt; is &lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/af5a5e1f3222c095bbceea6c7cf5e6685bdc0ce5.svg" style="height: 22px;" type="image/svg+xml"&gt;\frac{2\pi}{w}&lt;/object&gt;.
Play with the demo below to see this in action, by changing &lt;img alt="w" class="valign-0" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 8px;" /&gt;
and observing how the waveform changes.&lt;/p&gt;
&lt;p&gt;If we know the period &lt;object class="valign-m4" data="https://eli.thegreenplace.net/images/math/516b9783fca517eecbd1d064da2d165310b19759.svg" style="height: 12px;" type="image/svg+xml"&gt;p&lt;/object&gt; we want, we can easily calculate the
&lt;img alt="w" class="valign-0" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 8px;" /&gt; that gives us this period:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/1e0b7e1350f41a5d194ed4596e24ba19298728ff.svg" style="height: 40px;" type="image/svg+xml"&gt;\[p=\frac{2\pi}{w} \implies w=\frac{2\pi}{p}\]&lt;/object&gt;
&lt;/div&gt;
&lt;div class="section" id="shifting"&gt;
&lt;h2&gt;Shifting&lt;/h2&gt;
&lt;p&gt;The final parameter we discuss is &lt;img alt="\theta" class="valign-0" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt;; it’s called the
&lt;em&gt;phase&lt;/em&gt; of the sinusoid. In the baseline &lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/1f2ea8ffab8deb0e5b854a260a68b42b7eb7b048.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(x)&lt;/object&gt;,
&lt;img alt="\theta=0" class="valign-0" src="https://eli.thegreenplace.net/images/math/a1dffbe89f1ec5a919198de979fca459eb7fdf84.png" style="height: 12px;" /&gt;. The sinusoid is 0 at &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/8bdf21367eee06097384c37b0448375f07f950f0.svg" style="height: 12px;" type="image/svg+xml"&gt;x=0&lt;/object&gt;, achieves its
positive peak at &lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/45cd304b3c843af35927b7c0245ea384eb910e58.svg" style="height: 19px;" type="image/svg+xml"&gt;x=\frac{\pi}{2}&lt;/object&gt;, crosses 0 again at
&lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/772d339297416ff00b9b1bb9e94d4967ed2cd240.svg" style="height: 8px;" type="image/svg+xml"&gt;x=\pi&lt;/object&gt;, negative peak at &lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/93bdc56d302f94f04eabe5a5613f247ae868be72.svg" style="height: 22px;" type="image/svg+xml"&gt;x=\frac{3\pi}{2}&lt;/object&gt; and returns to
its original position at &lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/c40e087d3c6af21cd2ddb732737bcab6381f1feb.svg" style="height: 12px;" type="image/svg+xml"&gt;x=2\pi&lt;/object&gt; where the repetition begins.&lt;/p&gt;
&lt;p&gt;By adding a non-zero &lt;img alt="\theta" class="valign-0" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt;, we don’t affect the sinusoid’s
amplitude or frequency, but we do shift it right or left along the
&lt;img alt="x" class="valign-0" src="https://eli.thegreenplace.net/images/math/11f6ad8ec52a2984abaafd7c3b516503785c2072.png" style="height: 8px;" /&gt; axis. For example, suppose we use the function
&lt;object class="valign-m5" data="https://eli.thegreenplace.net/images/math/f07cc6da4bbe7259442b8c4dc6f9bdaaa2c2933c.svg" style="height: 19px;" type="image/svg+xml"&gt;sin(x+\theta)&lt;/object&gt; with &lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/0debc99bd20cf70823ed08246f837595d0cde3bf.svg" style="height: 19px;" type="image/svg+xml"&gt;\theta=\frac{\pi}{2}&lt;/object&gt;. Then when
&lt;object class="valign-0" data="https://eli.thegreenplace.net/images/math/8bdf21367eee06097384c37b0448375f07f950f0.svg" style="height: 12px;" type="image/svg+xml"&gt;x=0&lt;/object&gt;, we have &lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/f04381be541e525ad448580297568f9bf94dbc5d.svg" style="height: 20px;" type="image/svg+xml"&gt;sin(\frac{\pi}{2})&lt;/object&gt;, so the sinusoid is
already at its positive peak; at &lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/45cd304b3c843af35927b7c0245ea384eb910e58.svg" style="height: 19px;" type="image/svg+xml"&gt;x=\frac{\pi}{2}&lt;/object&gt;, the sinusoid
crosses 0 into the negatives, etc. Everything happens earlier (by
exactly the value of &lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/0debc99bd20cf70823ed08246f837595d0cde3bf.svg" style="height: 19px;" type="image/svg+xml"&gt;\theta=\frac{\pi}{2}&lt;/object&gt;) than in the baseline
sinusoid. In other words, we’ve shifted the function &lt;em&gt;left&lt;/em&gt; by
&lt;object class="valign-m6" data="https://eli.thegreenplace.net/images/math/7813100388622a69c767d297b453832a9df166fb.svg" style="height: 19px;" type="image/svg+xml"&gt;\frac{\pi}{2}&lt;/object&gt;. Similarly, when &lt;img alt="\theta" class="valign-0" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt; is negative,
everything happens later, and the function is shifted &lt;em&gt;right&lt;/em&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="putting-it-all-together"&gt;
&lt;h2&gt;Putting it all together&lt;/h2&gt;
&lt;p&gt;We’ve now gone over all the parameters for the function:&lt;/p&gt;
&lt;object class="align-center" data="https://eli.thegreenplace.net/images/math/85a45cfe4c1671765c3ab7e3949d8f74f780a0f3.svg" style="height: 19px;" type="image/svg+xml"&gt;\[s(x)=A\cdot sin(w\cdot x+\theta)\]&lt;/object&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;img alt="A" class="valign-0" src="https://eli.thegreenplace.net/images/math/6dcd4ce23d88e2ee9568ba546c007c63d9131c1b.png" style="height: 12px;" /&gt; controls the scaling factor (amplitude).&lt;/li&gt;
&lt;li&gt;&lt;img alt="w" class="valign-0" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 8px;" /&gt; is the frequency and controls the repetition period&lt;/li&gt;
&lt;li&gt;&lt;img alt="\theta" class="valign-0" src="https://eli.thegreenplace.net/images/math/cb005d76f9f2e394a770c2562c2e150a413b3216.png" style="height: 12px;" /&gt; controls the phase - how much the sinusoid is shifted
left or right&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use the demo below to adjust these parameters and observe their effect on
the sinusoid:&lt;/p&gt;
&lt;link rel="stylesheet" href="https://eli.thegreenplace.net/demos/sinus/sinus-demo.css"&gt;

&lt;!-- Canvas shows the current graph and legend;
     controls below provide the parameter inputs. --&gt;
&lt;div class="sinus-demo-wrap"&gt;
  &lt;canvas id="sinus-demo-canvas" class="sinus-demo-canvas" width="760" height="390"&gt;
  Your browser does not support the HTML5 canvas tag.
  &lt;/canvas&gt;

  &lt;div class="sinus-demo-controls"&gt;
    &lt;div class="sinus-demo-grid"&gt;
      &lt;label class="sinus-demo-label" for="sinus-demo-amp"&gt;
        A
        &lt;input id="sinus-demo-amp" class="sinus-demo-input" type="number" value="1" step="0.1"&gt;
      &lt;/label&gt;

      &lt;label class="sinus-demo-label" for="sinus-demo-omega"&gt;
        ω
        &lt;input id="sinus-demo-omega" class="sinus-demo-input" type="number" value="1" step="0.1"&gt;
      &lt;/label&gt;

      &lt;label class="sinus-demo-label" for="sinus-demo-theta"&gt;
        θ
        &lt;input id="sinus-demo-theta" class="sinus-demo-input" type="number" value="0" step="0.1"&gt;
      &lt;/label&gt;
    &lt;/div&gt;

    &lt;div id="sinus-demo-message" class="sinus-demo-message"&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;script src="https://eli.thegreenplace.net/demos/sinus/sinus-demo.js"&gt;
&lt;/script&gt;&lt;hr class="docutils" /&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-1" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-1"&gt;[1]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;The math level of this post is high-school, at best. My main goal
here is to test how to integrate interactive demos into my blog
posts.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table class="docutils footnote" frame="void" id="footnote-2" rules="none"&gt;
&lt;colgroup&gt;&lt;col class="label" /&gt;&lt;col /&gt;&lt;/colgroup&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td class="label"&gt;&lt;a class="fn-backref" href="#footnote-reference-2"&gt;[2]&lt;/a&gt;&lt;/td&gt;&lt;td&gt;This can be a bit counter-intuitive at first; we scale &lt;img alt="w" class="valign-0" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 8px;" /&gt; by
2, but the period scales by half. Why? The reason is that &lt;img alt="w" class="valign-0" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 8px;" /&gt;
affects the sinusoid’s &lt;em&gt;domain&lt;/em&gt;, while the period is a property of
its &lt;em&gt;range&lt;/em&gt;. Therefore, an inverse relation is reasonable, once we
put more thought into it. In fact, &lt;img alt="w" class="valign-0" src="https://eli.thegreenplace.net/images/math/aff024fe4ab0fece4091de044c58c9ae4233383a.png" style="height: 8px;" /&gt; is often called the
&lt;em&gt;angular frequency&lt;/em&gt; of the sinusoid, and frequency is inverse
proportional to the period.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</content><category term="misc"></category><category term="Math"></category></entry></feed>