6.
300 Problem Set 1
This problem set consists of 4 problems total (including this week’s lab):
• Problem 1, about symmetry, starts on page 2.
• Problem 2, about complex numbers, starts on page 5.
• Problem 3, about sampling and aliasing, starts on page 7.
• Problem 4 (this week’s lab) starts on page 8. Note that while your submission for lab-related questions is due on
Monday with the rest of the pset, the lab check-in comes due on Friday at 5pm.
These problems are mostly intended to be done without the aid of computers, graphing libraries, calculators, etc, except
where those tools are explicitly mentioned. For the problems where they are not mentioned, you are welcome to use them to
check your work, but you’ll generally get more out of the experience if you work the problems primarily by hand.
We have also included some brief notes about complex numbers at the end of this handout, on pages 10-15. There are no
required exercises in those pages; they are simply provided as a reference.
Note that some parts of the problem set require having installed the lib6300 software library, which is available at:
https://sigproc.mit.edu/spring23/software
6.300 Signal Processing (Spring 2023) 2 Problem Set 1
Problem 1: Symmetry
1.1 Part 1
Recall the following definitions:
• a CT function is a symmetric function of t if, for all t, x(t) = x(−t)
• a CT function is an antisymmetric function of t, for all t, x(t) = −x(−t)
• a DT function is a symmetric function of n if, for all n, x[n] = x[−n]
• a DT function is an antisymmetric function of n if, for all n, x[n] = −x[−n]
Of the CT signals below, which are symmetric functions of t, which are antisymmetric functions of t, and which are neither?
For the functions represented by graphs, assume that xi (t) = 0 for all values of t that are not shown.
x1 (t) = cos(πt) x2 (t) = cos( π2 t)
x3 (t) = sin(πt) x4 (t) = sin( π2 t)
x5 (t) = cos(πt) − cos(2πt) x6 (t) = sin(πt) − cos(2πt)
x7 (t) = cos(πt) − sin(2πt) x8 (t) = sin(πt) − sin(2πt)
1.00 0.25
0.75
0.20
0.50
0.25 0.15
x10(t)
0.00
x9(t)
0.10
0.25
0.50
0.05
0.75
1.00 0.00
1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00 1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00
t t
0.00
0.2
0.05
0.1
0.10
x11(t)
0.0
x12(t)
0.15
0.1
0.20
0.2
0.25
1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00 1.00 0.75 0.50 0.25 0.00 0.25 0.50 0.75 1.00
t t
2
6.300 Signal Processing (Spring 2023) 3 Problem Set 1
1.2 Part 2
Imagine adding two signals x1 [·] and x2 [·] to produce a new signal x3 [·] such that x3 [n] = (x1 + x2 )[n] = x1 [n] + x2 [n] for all n.
If x1 [n] and x2 [n] are both symmetric functions of n, which of the following best describes x3 [·]?
• x3 [n] will always be a symmetric function of n
• x3 [n] will always be an antisymmetric function of n
• x3 [n] will never be symmetric or antisymmetric
• None of the above
Justify your answer in your submission.
Imagine adding two signals x4 [·] and x5 [·] to produce a new signal x6 [·] such that x6 [n] = (x4 + x5 )[n] = x4 [n] + x5 [n] for all n.
If x4 [n] and x5 [n] are both antisymmetric functions of n, which of the following best describes x6 [·]?
• x6 [n] will always be a symmetric function of n
• x6 [n] will always be an antisymmetric function of n
• x6 [n] will never be symmetric or antisymmetric
• None of the above
Justify your answer in your submission.
Imagine adding two signals x7 [·] and x8 [·] to produce a new signal x9 [·] such that x9 [n] = (x7 + x8 )[n] = x7 [n] + x8 [n] for all n.
If x7 [n] is symmetric and x8 [n] is antisymmetric, which of the following best describes x9 [·]?
• x9 [n] will always be a symmetric function of n
• x9 [n] will always be an antisymmetric function of n
• x9 [n] will never be symmetric or antisymmetric
• None of the above
Justify your answer in your submission.
3
6.300 Signal Processing (Spring 2023) 4 Problem Set 1
1.3 Part 3
We would like to express an arbitrary discrete-time signal x[·] as the sum of a symmetric part xs [·] (where xs [−n] = xs [n]) and
an antisymmetric part xa [·] (where xa [−n] = −xa [n]) such that x[n] = xs [n] + xa [n] for all n.
Is such a decomposition possible for all possible signals x[·]? When the decomposition is possible, is the answer always
unique?
1.4 Part 4
Let x[·] represent the signal whose samples are given by
1 n
(
2 n≥0
x[n] =
0 otherwise
Determine expressions for functions xs [·] and xa [·] such that xs [·] is a symmetric function of n and xa [·] is an antisymmetric
function of n, and xa [n] + xs [n] = x[n] for all n. Try to simplify your expressions down, but it is totally OK to leave the end
result as a piece-wise function.
Once you have that expression, draw (by hand) a sketch of xs [n] and xa [n]. Do their shapes make sense given your work from
part 3?
4
6.300 Signal Processing (Spring 2023) 5 Problem Set 1
Problem 2: Complex Numbers
2.1 Part 1
Consider the following series expansions:
∞
x
X xn x2 x3 x4
e = =1+x+ + + + ...
n=0
n! 2! 3! 4!
∞
x2n x2 x4 x6
cos x =
X
(−1)n =1− + − + ...
n=0
(2n)! 2! 4! 6!
∞
x(2n+1) x3 x5 x7
sin x =
X
(−1)n =x− + − + ...
n=0
(2n + 1)! 3! 5! 7!
Use these expansions to verify Euler’s formula. Show your work.
2.2 Part 2
Use Euler’s formula to prove the following:
ejθ + e−jθ
cos (θ) =
2
ejθ − e−jθ
sin (θ) =
2j
Show your work.
5
6.300 Signal Processing (Spring 2023) 6 Problem Set 1
2.3 Part 3
Express each of the following numbers in rectangular form. Note that you may find it useful to convert some or all parts of
some expressions to polar form as you’re working toward an answer.
3ejπ/3 + 4e−jπ/6
√ 11
3+j
√
−j
√ √ 218
2ejπ/2 + 2ejπ/4 + √2 ej5π/4 + √1 ejπ − √1 j
2 2 2
6
6.300 Signal Processing (Spring 2023) 7 Problem Set 1
Problem 3: Aliased Tune
The ZIP file at https://sigproc.mit.edu/_static/spring23/psets/01/tune.zip contains a file called tune.py. In that
file, there is a description of a tune in the form of a list. Each entry in the list is a tuple of (frequency, duration), where
frequency is the frequency of a note (in Hz) and duration is the length of that note (in seconds).
The file also includes a skeleton of some code that we can use to save an audio file based on those frequencies to play a tune.
But a couple of pieces are missing.
To start, fill in the blanks for Omega and length with appropriate values. After you have done so, try playing the output file
(mystery.wav) in an audio application. Do you recognize the tune? It’s OK if you don’t, but either way, in your writeup,
describe your choice of Omega and length.
Note that all of the frequencies in the given mystery_notes list are in the range (0Hz, 22050Hz]. But it should be possible to
create the same tune (without changing the sampling rate) using frequencies outside of that range.
Write code to generate two new lists of (frequency, duration) tuples that play the same tune. Your first list should only
include continuous frequencies in the range (22050Hz, 44100Hz] and your second should only include continuous frequencies
in the range (44100Hz, 66150Hz].
You are encouraged to write the code and listen to the output to verify that it’s working as expected. When you have it
working, include your code for generating those lists, as well as an explanation (how were the new frequencies calculated and
why does this work?).
7
6.300 Signal Processing (Spring 2023) 8 Problem Set 1
Problem 4: Mystery Signal (Lab)
The ZIP file at https://sigproc.mit.edu/_static/spring23/psets/01/mystery.zip contains two files:
• mystery.py: a skeleton file for you to work in, and
• coeffs.pickle: a pickled Python object containing some data (see below for details)
mystery.py contains code that loads the data from coeffs.pickle into two lists.
The first list, cos_coeffs, contains coefficients c0 , c1 , . . .. Each represents the amplitude of a pure cosine wave: c1 represents
2π
the amplitude of a pure cosine wave with a discrete frequency Ω0 = 23406 . c2 represents the amplitude of a pure cosine wave
at Ω1 = 2Ω0 . c3 represents the amplitude of a pure cosine wave at Ω2 = 3Ω0 . c4 represents the amplitude of a pure cosine
wave at Ω3 = 4Ω0 , and so on.
Similarly, the second list, sin_coeffs, contains coefficients d0 , d1 , d2 , . . .. Each represents the amplitude of a pure sine wave:
d1 represents the amplitude of a pure sine wave at frequency Ω0 , d2 the amplitude of a pure sine wave at 2Ω0 , etc.
Together, these coefficients comprise a representation for an audio signal. Your goal in this exercise is to reconstruct that
audio signal, and explain some effects related to modifications we could make to the ci and di coefficients.
Combining
We’ll start by combining the sines and cosines into a more complicated signal.
Start by creating a Python list of length 23406, containing samples of the cosine wave with the frequency Ω0 given above.
How many cycles would you expect this wave to go through in 23406 samples? Generate a plot to verify that this is working.
Then, repeat this process for all of the remaining cosine waves, scaling each by the appropriate ci value. For each, add these
values element-wise to your result. Then repeat for the sines.
Ultimately, this should result in a signal x[·], where:
x[n] = d0 sin(0n) + c0 cos(0n) + d1 sin(Ω0 n) + c1 cos(Ω0 n) + d2 sin(2Ω0 n) + c2 cos(2Ω0 n) + . . .
Next, use the wav_write function to save this list as a WAV file, using 8000 (samples per second) as the sampling rate.
When you’re done, if you listen to the WAV file, you should hear a short, clear sample of human speech. Make sure to keep
this file around for your check-in.
CHECK-IN
Explain your code and demonstrate your result to a staff member at any of our common hour times. Your should use the
Help Queue to ask for your check-in.
Be prepared to discuss your method, as well as to demonstrate both your output WAV file and a plot of the samples.
When you are done, continue on and answer the following additional questions.
8
6.300 Signal Processing (Spring 2023) 9 Problem Set 1
Additional Questions
Please answer each of these questions and include it in your writeup.
• If you were to use exactly the same process and coefficients (including all Ai and Bi terms), but you generated a list of
length less than 23,406, what would the resulting signal sound like? If you generated more then 23,406 samples, what
would that signal sound like?
• Try flipping the sign of all of the di coefficients and generating a new WAV file. When listening to this file, it sounds like
the original, but played backward. Explain why this is the case.
• How is the output different if all of the di coefficients are set to 0? Explain why this is the case, basing your argument on
the symmetry (or antisymmetry) of various parts of the signal.
• Many of the coefficients are near 0, but one in particular (d0 ) is actually 0. How is the output different if d0 is set to 100
instead? Why is this the case?
Submission
Your submission for the lab should be a ZIP file containing a PDF writeup of these questions, as well as your Python code and
any relevant WAV files and/or plots.
9
6.300 Signal Processing (Spring 2023) 10 Problem Set 1
Tutorial: Complex Numbers and Complex Exponentials
Complex numbers are central to a number of techniques discussed in this class. As such, we’ll use the next few pages to talk a
bit about the nature of complex numbers, but with a particular focus on algebraic and geometric interpretations of operations
on complex numbers. Some of the problems in the pset will give you an opportunity to practice with operations on complex
numbers.
Graphical Representations of Real and Complex Numbers
To start discussing complex numbers, we’ll first consider the real numbers (such as 10, -4, 0.3, -2.2, π, etc.). A real number can
be represented as a point along an infinite one-dimensional number line, which we’ll call the real axis, shown below:
−4 −3 −2 −1 0 1 2 3 4 Re
Any real number can be represented by a single point on this line. For example, the blue dot above represents the real
number π2 .
You may already be familiar with complex numbers written in their rectangular form (also called the Cartesian form), which
separates a complex number into its real and imaginary parts. Complex numbers in rectangular form are written as a0 + b0 j,
√
where both a0 and b0 are themselves real numbers, and j is the imaginary unit1 ( −1). A complex number can be represented
using two real numbers; as such, we can represent a complex number as a point in a two-dimensional space that we’ll refer to
as the complex plane. Below is a diagram showing a portion of the complex plane, with the number 3 + 4j indicated as a point:
Im
1 2 3 4 Re
√
1Throughout this course, as in many engineering disciplines, we will use the letter j to represent the imaginary unit −1. Some other disciplines use
the letter i to represent the imaginary unit, but in engineering, the letter i is traditionally reserved for electrical current.
10
6.300 Signal Processing (Spring 2023) 11 Problem Set 1
Polar Form
Importantly, we can think of this number as a vector in the complex plane, as shown below2. This vector has a magnitude
(let’s call it r) and an angle (φ) in the complex plane.
Im
a0 (real part)
4
3
r b0 (imaginary part)
2
1
φ
1 2 3 4 Re
This representation opens the door to some interesting geometric/graphical interpretation, which can help us reason about
operations on complex numbers. To start with, we can define r and φ in terms of a0 and b0 :
q
r= a20 + b20
b0
φ = tan−1
a0
We can also define a0 and b0 in terms of r and φ:
a0 = r cos(φ)
b0 = r sin(φ)
From there, we can rewrite our rectangular form as r(cos φ + j sin φ), which is called the trigonometric form.
From there, we can use Euler’s equation (ejθ = cos θ + j sin θ) to express our complex number as rejφ . This form, where we
express a complex number in terms of its magnitude and angle (often referred to as its phase) in the complex plane, is referred
to as polar form (also sometimes called the exponential form).
Polar form is the primary form we’ll use throughout this class. However, it is worth noting that both rectangular and polar
forms have their uses: certain operations are easier to perform and/or to understand when working with one form, versus
the other, as we’ll see in the following sections.
Note also that the polar representation of a number is not unique; that is to say that there are many different ways to
represent the same number in polar form. Since increasing φ involves increasing the angle, any number rejφ could also
(equivalently) be represented by rej(φ+2π) . One way to see this is to note that both the real part a0 = r cos(φ) and b0 = r sin(φ)
are both periodic functions of φ, with a period of 2π.
2This kind of diagram, which shows complex numbers as vectors in the complex plane, is often referred to as an Argand diagram.
11
6.300 Signal Processing (Spring 2023) 12 Problem Set 1
Basic Operations
Next, let’s look at arithmetic and geometric interpretations of various operations on complex numbers. As we’ll see, there is
no universal right answer for the question of “which representation is best?” Rather, the operation we perform determines
the form we want to use.
Addition
Let’s start by considering the addition of two complex numbers, c1 and c2 . For addition, rectangular form tends to be the
easiest form, since the real and imaginary parts of these numbers add independently. That is, for imaginary numbers
c1 = a1 + b1 j and c2 = a2 + b2 j, we have:
c1 + c2 = a1 + b1 j + a2 + b2 j = (a1 + a2 ) + (b1 + b2 )j
The result is a new complex number, whose real part is a1 + a2 , and whose imaginary part is b1 + b2 .
Geometrically, this means that, when viewing complex numbers as vectors in the complex plane, they add like regular
vectors. For example, consider the following depiction of adding two complex numbers. On the left, we show vectors
representing two numbers c1 and c2 . On the right, we show those vectors stacked “end-to-end,” as well as their sum:
Im Im
4 4
c2
3 3
c1 c1
2 2
1 1 c1 + c2
−4 −3 −2 −1 1 2 3 4 Re −4 −3 −2 −1 1 2 3 4 Re
−1 c2 −1
−2 −2
−3 −3
−4 −4
Subtraction works similarly in that the real parts and imaginary parts subtract independently:
c1 − c2 = (a1 − a2 ) + (b1 − b2 )j
12
6.300 Signal Processing (Spring 2023) 13 Problem Set 1
Multiplication
Now let’s consider the multiplication of two complex numbers, c1 and c2 . We could approach this by multiplying the
rectangular forms together and applying the “FOIL” rule to compute the product:
c1 c2 = (a1 + b1 j)(a2 + b2 j) = (a1 a2 − b1 b2 ) + (a1 b2 + a2 b1 )j
However, this process is a bit of a pain. It’s already tedious with only two numbers, and it gets even more painful when when
we are considering the product of more than just two numbers. However, thinking about the product becomes a bit easier if
we represent both numbers in their polar forms (c1 = r1 ejφ1 and c2 = r2 ejφ2 ):
c1 c2 = (r1 ejφ1 )(r2 ejφ2 ) = (r1 r2 )ej(φ1 +φ2 )
This is a new complex number with magnitude r1 r2 , and with angle φ1 + φ2 : the magnitudes multiply, and the angles sum.
It’s worth noting that while complex numbers add like vectors, they do not follow the normal rules for vector multiplication.
Rather, multiplication of complex numbers has a different interesting geometric interpretation that involves rotating through
the complex plane.
Im Im
4 4
3 3
2 c1 c2 2
c21 c1 1
−4 −3 −2 −1 1 2 3 4 Re −4 −3 −2 −1 1 2 3 4 Re
−1 −1
−2 −2
−3 −3
−4 −4
Division works in a similar way, producing a new complex number whose magnitude is a ratio of the input magnitudes and
whose angle is the difference of the input angles:
r1 ejφ1
c1 r1
= = ej(φ1 −φ2 )
c2 r2 ejφ2 r2
13
6.300 Signal Processing (Spring 2023) 14 Problem Set 1
Exponentiation
Finally (for now), let’s consider raising a complex number c1 to a power. As with multiplication, we could do this using
rectangular form, but given the relationship between exponentiation and multiplication (and the fact that multiplication was
way easier in polar form than rectangular form), polar form seems like a better bet. If we represent c1 as
x
c1 x = r1 ejφ1 = (r1 x ) ejφ1 x
Note that this result is a new complex number whose magnitude is r1x and whose angle is φ1 · x. For example:
Im
2
(c1 )2
1
c1 √
c1
−2 −1 1 2 Re
−1
−2
√ √ π
In this example, c1 = 1 + j. |c1 | = 2 and 6 c1 = π4 , so it can be represented as c1 = 1 + j = 2ej 4 , which is shown in blue
above. We can also see two results: squaring c1 gives us a new number whose angle is 26 c1 = π2 and whose magnitude is
π
|c1 |2 = 2. This number is 2ej 2 , or 2j, which is shown in black above. Similarly, we can find the square root of c1 by raising it
√ 6
to the 12 power, which gives us a new number whose magnitude is |c1 | = 4 2 and whose angle is 2c1 = π8 . This number is
p
shown in red above.
Operations: Summary
Developing facility with moving between these representations is a crucial skill to develop as we work through 6.300, in part
because different representations lend themselves to performing different operations. As we move forward with the class,
we’ll spend a lot more time talking about these ideas. But for now, we hope that what you take away from these notes is an
exposure to complex numbers (particularly in polar form and a geometric interpretation of those numbers; as well as an idea
about when each representation is useful. Specifically,
• For addition and subtraction, rectangular form tends to be easiest.
• For multiplication, division, and exponentiation, polar form tends to be easiest.
14
6.300 Signal Processing (Spring 2023) 15 Problem Set 1
Real Numbers in Rectangular and Polar Form
It is perhaps worth mentioning, at this point, that we can use any of the above representations to represent a purely real
number as well. If we have a positive, real number n, that’s already represented in rectangular form, where the imaginary
part just happens to be 0. And so we can bring all of the nice geometric interpretation from above to bear on real numbers as
well (those interpretations aren’t limited to numbers with a nonzero imaginary part!).
In polar form, we can gain some insight by plotting that number as a vector on the complex plane, where we can see that this
number has a magnitude of n, and it has an angle of 0, so it can be represented as n = nej0 :
Im
−4 −3 −2 −1 1 2 3 4 Re
−1
−2
−3
−4
In the case of a negative, real-valued number (let’s call it −n), we see something slightly different. Here, the magnitude is n,
but the angle is π, so we can represent it as −n = nejπ :
Im
1 π
−4 −3 −2 −1 1 2 3 4 Re
−1
−2
−3
−4
If you ever wondered about Euler’s identity, ejπ = −1, now we can make sense of it! All that that’s saying is that negative one
is a number whose magnitude is 1 and whose angle in the complex plane is π!
15