The cosine function coskx has angular wavenumber k.
k is the number of cycles per 2π (see the figures below).
If a 1-dimensional image, I(x), has width N and we want a single cycle to occur across the image, we can map
x→2πxN
So that, for x∈[0,N), the corresponding 2πxN∈[0,2π) and cos2πxN goes through one cycle.
Fourier realized that any periodic or bounded-domain function can be written as a linear combination of sine and cosine functions at different frequencies.
The Fourier basis functions are
sinkx,coskx for k∈0,1,2,…
sin0x,cos0x,sin1x,cos1x,sin2x,cos2x,sin3x,cos3x,…
These basis functions are orthogonal. For all m≠n:
sinmx⋅sinnx=0cosmx⋅cosnx=0
and
sinmx⋅cosnx=0sinmx⋅cosmx=0
Let f(x) be an arbitrary function that is periodic in [0,2π). (If f(x) is instead periodic in [0,N), we reparameterize it as f(2πxN).)
We can project f(x) onto all of these basis functions and get the Real Fourier Series:
f(x)=∞∑k=0akcoskx + ∞∑k=0bksinkx=a0+∞∑k=1akcoskx + ∞∑k=1bksinkx
The ak and bk show how much of coskx and sinkx are present in f(x).
To get ak and bk, project f(x) onto the basis functions:
ak=f(x) ⋅ coskxcoskx ⋅ coskx=∫2π0f(x)coskx dx∫2π0cos2kx dx=∫2π0f(x)coskx dxπ=1π∫2π0f(x)coskx dxbk=f(x) ⋅ sinkxsinkx ⋅ sinkx=∫2π0f(x)sinkx dx∫2π0sin2kx dx=∫2π0f(x)sinkx dxπ=1π∫2π0f(x)sinkx dx
Note that
a0=∫2π0f(x) dx2πb0=0
So a0 is the average of f(x) on the interval [0,2π].
Given acosx+bsinx, what is the corresponding Acos(x−θ) ?
Recall that Acos(x−θ)=(Acosθ)cosx+(Asinθ)sinx.
So, given the a and b in acosx+bsinx, we can find the A and θ of the corresponding Acos(x−θ):
a=Acosθb=Asinθa2+b2=A2(cos2θ+sin2θ)=A2A=√a2+b2ba=AsinθAcosθ=tanθθ=arctanba
This works for any wavenumber, k.
So the kth sin/cos pair can be thought of as a shifted, modulated sinusoid of wavenumber k.
akcoskx+bksinkx=Akcos(kx−θk)where ak=Akcoskθk and bk=Aksinkθk.
In other words, it's a single sinusoid where Ak=√a2k+b2k is the amplitude and θk=arctanbkak is the phase shift.