Boaz Barak (instructor), Brian Sapozhnikov (Head TF), Albert Chalom, Alexis Ross, Charles O’Mara, Daniel Chen, David Li , Jambay Kinley, Jane Ahn, John Shen, Josh Seides, Laura Pierson, Pranay Tankala, Raymond Lin, Theresa Nguyen, Wanqian Yang, William Fu, Hikari Sorensen (Extension TF), Eric Lu (Patel Fellow), Yueqi Sheng (Advanced section), Chi Ning Chou (Advanced section).
Laptops/phones only on last 5 rows please.
Put course in your Crimson Cart!
PollEv.com/cs121
a.
c.
b.
d.
e. All of the above.
All of the above .. but some have other uses as well
Input: Integers \(a,b\)
Output: \(a\times b\)
Iterated addition algorithm: Add \(a\) to itself \(b\) times.
(Using the deep fact \(a \times b = a + a + \cdots + a\) (\(b\) times))
Babylonian / grade-school algorithm: For \(i\),\(j\), add \(10^{i+j}a_ib_j\) to result.
Goren is a 1st grader that takes 30 seconds to multiply single-digit numbers.
The Summit is world’s fastest supercomputer, can do \(10^{17}\) floating points operations per second.
Q: Goren uses Babylonian and The Summit uses Iterated addition to multiply two \(80\) digit numbers. Who will finish first? (PollEv.com/cs121)
Goren will take about \(80\times 80 \times 30 = 192,000\) seconds \(\approx\) \(53\) hours.
The Summit will take about \(10^{80} \approx 2^{256}\) additions.
How much is \(2^{256}\) operations?
Algorithms matter more than technology.
(of course technology matters a lot too!)
This course: Study algorithms independently of technology.
Our main tool: Math
In 1822 Joseph Fourier proposed solution to “heat equation” using following observation:
Every (“nice”) \(f:[0,1] \rightarrow \mathbb{R}\) can be decomposed as a sum of wave functions of the form \(g(x) = \sin(a x)\) or \(g(x)=\cos(b x)\).
In 1965, Americans wanted to find way to detect Soviet nuclear experiments from seismic data. Can do so with Fourier transform
Problem: Lots of data, Fourier transform too slow
John Tukey came up with “Fast Fourier Transform”: improve running time from \(n^2\) to \(n \log n\): thousand or million times speedup!
Tukey couldn’t publish so collaborated with James Cooley for chemistry application.
On every “top 10 algorithms” list. Applications include signal processing, compression, spectroscopy, engineering, earth sciences, optics, crystallography, …
MRI Imaging:
Q: Can we “skip the middle man” and do MRI with only \(n\) observations?
A: Yes! “Compressed Sensing” (Candes-Romberg-Tao 2006). Sometimes life vs death difference!
Given linear equations \(Ax= b\), can find “short” solution \(x \in \mathbb{R}^n\), minimizing \(\sum |x_i|\). “Linear Programming”
Can we do the same for integer \(x \in \mathbb{Z}^n\)? No! (this course)
Miklos Ajtai and Cynthia Dwork 1997: A public key cryptosystem based on difficulty of this problem.
Our current best hope for “post quantum cryptography”
Google was founded on the PageRank algorithm for a approximating top eigenvector of a random walk matrix.
Backpropagation algorithm is driving much of deep learning, based on computing symbolic derivatives of arithmetic circuits.
Akamai was founded on the consistent hashing data structure for a distributed dynamic hash table.
Was any company founded based on the non existence of algorithm?
Yes! RSA, and many others…
because you have to..
Understand the greatest scientific revolution of 20th (and 21st) centuries.
The ideas that underlie the technologies we use.
New way of thinking
New lens on other phenomena
Hard + Required = Sucks
CS 121 is difficult: need to learn new concepts, acquire a new way of thinking
Other difficult tasks:
(Getting into Harvard..)
Typical introductory math: Student executes an algorithm.
(solve equations, compute derivatives and integrals, manipulate trigonometric functions, etc..)
In CS 121: Analyze algorithms (prove properties of algorithm \(A\)), even meta analyze algorithms (prove existence/non-existence of algorithm of type \(P\))
Good news: It’s a different kind of hard. More thinking, less remembering or calculating.
Bad news: It’s a different kind of hard.
Lots of proofs in this course.
proof: prüf , noun
A sequence of logical deductions that starts from some axioms and ultimately arrives at a conclusion.
proof: prüf , noun
A ritual in which a sequence of meaningless formulas is written under an obvious statement.
A proof is a piece of English text that convinces a knowledgeable but skeptical reader that a statement X is true beyond a shadow of a doubt.
To write a proof:
Don’t go to step \(i+1\) before completing step \(i\).
Err on the side of being more precise.
Even more important (and often harder!) than proofs are definitions.
If you don’t understand what X means, how can you prove it?
Before every lecture you’ll need to read 20-30 pages of mathematical text.
Bad news: It will be slow at start
Good news: One of the most transferable skills.
Would you rather read this?
Or this
No No one has: we execute math reasoning on our “run-from-lions” processor.
Variations in aptitude (mostly speed) and confidence (not very correlated to performance)
Most important trait for succeeding in math (and life) is grit.
Focus on your own growth
Being tall helps in rock climbing.
Ashima Shiraishi, age 17, Height 5’ 1".
“It’s still hard to explain what can be so fascinating about beating your head against the wall for three days, not knowing how to solve something the better way, the beautiful way. But once you find that way, it’s the greatest feeling in the world.”
L. Torvalds, programmer.
(Ask us about “advanced section / CS 121.5”)
Put the course on your crimson cart so you are in canvas.
Join Piazza, download app, activate notifications- our main/only method of communication!
Do Homework zero (bonus) by Thursday night and submit via gradescope.
Read “Chapter 2: representation” today or tomorrow - do canvas quiz on it no later than Thursday 9:30am.
If you didn’t read Chapter 0 and Chapter 1 yet: do so asap.
Pizza Party on Friday 12pm!
We will define a computational model:
\(((2, 0, 1), (3, 0, 2), (4, 1, 2), (5, 3, 4))\)
Need to understand functions, sets, tuples, strings, graphs.
Pizza Party - Friday 12pm - Ground floor Maxwell-Dworkin
Join Piazza and Canvas
Fill survey at http://tiny.cc/121initialsurvey
CS 121 web page: cs121.boazbarak.org or Google “CS 121 Boaz”