The Mathematics of LEGO Bricks: Lecture Page

World Record Set! Under 10 1/2 minutes! Best videos are the first videos from each camera. While we didn't break our 10 minute goal, we broke several other targets (30 minutes, 20 minutes, 15 minutes, 12:34 minutes, 11:23 minutes or the Fibonacci time, and a time that rounds to 10 and not 11, also known as 10 1/2 minutes). We learned a lot, had a lot of fun, and are looking forward to our next project! Please email sjm1@williams.edu if you were here and participated (and not enrolled in the class) so we can properly credit you, or if you want updates about the LEGO club we're forming. Thanks to all for coming out and supporting us, for pitching in and helping. Special thanks to Dining Services and ECom for the festivities and funding help. It was great to see so many people from so many parts of the Williamstown Community come together, from faculty and staff to students and children. LEG GODT. --Steve (PS: We averaged a tad over 5.075 pieces per second, or about 304.54 pieces a minute! If we had averaged exactly 5 pieces a second the time would have been.... 10 minutes, 30.402 seconds! Looking at it that way, 10:30 is a pretty natural barrier, and we beat that! I feel a bit better.)

Practice videos:

• Day 1: January 7, 2014:
• Lecture Video 0: January 7, 2014: Introduction to the course:  Introductory remarks about the class, basics of efficiency and optimization, game theory and symmetries, how many ways to combine brick....
• Problems to consider:
1. How many distinct games of tic-tac-toe are there? Do both in the case when we consider mirror images / flips to be the same and when we don't. Remember as soon as there are three in a row the game is over!
2. Redo the problem above, but now do it on a $$3 \times 3 \times 3$$ tic-tac-toe board.
3. Redo the above problem but on a $$3 \times 3 \times \cdots \times 3$$ board, where we have a total of $$n$$ dimensions!
4. Write a program to figure out how many ways to combine $$n$$ bricks, where all bricks are the same. Do this for bricks that are $$m \times n$$ for various $$m$$ and $$n$$.
6. We talked about chirality and mirror images in biology; there are a lot of great articles on this. Look at http://www.rowland.harvard.edu/rjf/fischer/background.php . Related to this is a wonderful story by Isaac Asimov, Mirror Image (click on the pdf file and search for Mirror Image to get to the story).
7. We also discussed scaling issues with LEGO sets, specifically how the number of pieces grows as a function of the set. There are lots of great reads, relating this to biological and other complexities.  Go to Wired: http://www.wired.com/wiredscience/2012/01/the-mathematics-of-LEGO/ (BY SAMUEL ARBESMAN 01.06.12), Scaling and LEGO: http://www.changizi.com/org.pdf (Scaling of Differentiation in Networks: Nervous Systems, Organisms, Ant Colonies, Ecosystems, Businesses, Universities, Cities,
Electronic Circuits, and LEGO: M. A. Changizinw, M. A. McDannaldwand D. Widdersw, J. Theor. Biology (2002) 218, 215–237). See also Science article where LEGO bricks are mentioned.
8. Related to the above: look at the price of different LEGO sets as a function of the number of pieces and what line it is (general city, Star Wars, Harry Potter, Lone Ranger, LEGO Friends, ...). Try to find relationships (if you know regression here's a terrific place to use it!).
• Lecture Video 1: January 7, 2014: Introduction to the math: Telescoping sums, Babylonian Mathematics, Look-up Tables, Fibonacci Numbers, Recurrence and Difference Equations, Method of Divine Inspiration, Binet's Formula, Binomial Theorem, Derivative of x^r, Evaluating sums efficiently.
• Problems to consider:
1. Let's say that if you multiply an $$m$$ digit number and an $$n$$ digit number that the cost is $$mn$$, as this is the number of digit multiplications you need to do (of course, a better approach is to also include a cost of the additions, but that's a little harder as there are possible carries). Try to figure out how to compare the run-time of directly computing a product $$xy$$ and using the Babylonian formula $$xy = \frac12 \left( (x+y)^2 - x^2 - y^2\right)$$; note that with the Babylonian formula you need to make an assumption about how long it takes to read in a number and then do subtraction and division by 2.
2. Read the notes here on solving difference equations, and try some of the problems. If you know eigenvalues and eigenvectors, use those to attack the matrix formulation of the Fibonacci numbers and reach Binet's formula that way.
3. Read pages 44 to 49 of this talk of mine on generating functions, another way to solve recurrence relations and reach Binet's formula.
4. Notes on analysis review (includes proofs by induction): For us most important part is page 3, where it talks about binomial coefficients and the binomial theorem. Try Exercise 1.1.7 (note it is possible to prove each claim by telling an appropriate story). After proving the binomial theorem find an expansion for $$(x+y+z)^n$$,
5. Show $$x^r = \exp(r \log x$$ and use the chain rule to prove its derivative is $$r x^{r-1}$$. Note the proof of the derivative is very different than the proof of the derivative of $$x^n$$ for $$n$$ an integer. That just uses the binomial theorem. If we have $$x^{a/b}$$ for a rational number $$a/b$$ then the proof is by the power rule: if $$f(x) = x^{a/b}$$ then set $$g(x) = f(x)^b = x^a$$, and now we can find the derivative of $$g(x)$$, from which we can get the derivative of $$f(x)$$. Fill in the details of these arguments.
6. Create a look-up table for values of $$\sin x$$ and $$\cos x$$. You need to start with inputs where you know the output; good choices are to take $$x = m \pi/2^n$$ for integers $$m, n$$, as we can get these values from the half-angle or double-angle formulas. Continue by using Taylor series (reviewed in the analysis notes, page 6).
7. Come up with a good way to evaluate $$\sum_{k=0}^n \left({n \atop k}\right) x^k y^{n-k}$$ by looking at the modification term by term as you go down. In other words, it's expensive to calculate each summand from scratch. If $$a_k = \left({n \atop k}\right) x^k y^{n-k}$$ find a simple formula relating $$a_{k+1}$$ to $$a_k$$, and use that to march down the line.
• Lecture Video 2: January 8, 2014: Recurrence relations and combinatorics: Recurrence relations and roulette (the roulette video is available here: http://www.youtube.com/watch?v=Esa2TYwDmwA), combinatorics (factorials, binomial coefficients, Pascal's triangles, proofs by story, the cookie problem).
• Problems to consider:
1. What is $$\sum_{k=0}^n \left({n \atop k}\right)^2$$? Hint: $$\left({n \atop k}\right)^2 = \left({n \atop k}\right) \left({n \atop n-k}\right)$$. Tell a story.
2. More generally, can you figure out what the right' sum of a product of three binomial coefficients is? One difficulty is you have to figure out what's the right triple!
3. To solve the roulette recurrence from the video involves finding the roots of a polynomial of degree 5; sadly in general there's no analogue of the quadratic formula to give us the solution in terms of the coefficients (there are cubic and quartic formulas for polynomials of degree 3 and 4). Look up methods on how to numerically approximate roots, such as Divide and Conquer' and `Newton's Method'.
4. Try to impose upper bounds in the cookie problem (say 12 people, 100 cookies, no one gets more than 20). Interestingly, I know of no good way to impose upper bound constraints, even though lower bounds aren't too bad. One possibility is to try using Inclusion-Exclusion.
5. Read about the Gamma function. Prove $$\Gamma(s+1) = s\Gamma(s)$$ by integrating by parts. Deduce $$\Gamma(n+1) = n!$$ for $$n$$ a non-negative integer. Look up the proofs that $$\Gamma(1/2) = \sqrt{\pi}$$; this is a very important result in statistics and probability.
6. The cookie problem can be cast more number-theoretically as Waring's problem where the exponents are 1; look up Waring's problem and think about fragmentation problems where the pieces split so that a sum of squares equals the given number: $$x_1^2 + \cdots + x_s^2 = C$$.
• Lecture Video 3: January 8, 2014: Efficiencies: Horner's algorithm, Fast Multiplication, Strassen's algorithm.
• Problems to consider:
1. The best known algorithm is the Coopersmith-Winograd algorithm, which is of the order of $$N^{2.376}$$ multiplications. See also this paper for some comparison analysis, or email me if you want to see some of these papers.
2. If instead of evaluating a function at an integer you instead evaluated it at a matrix, could you still use Horner's algorithm? Why or why not?
3. We saw how to do fast multiplication. Show that it takes at most $$2 \log_2 n$$ multiplications to compute $$x^n$$.
4. We saw Horner's algorithm does significantly better than brute force, standard polynomial evaluation. What if instead we used fast multiplication to compute the different powers of $$x$$; is that enough to beat Horner? Why or why not.
5. Look up RSA and see how fast exponentiation is used to make it useable.
6. Consider the following problem. You're given a large number, for definiteness say 100, and you want to split it into a number of summands such that each summand is a positive integer and the product of the summands is as large as possible. How do you do this, and what is the product?
7. Redo the last problem but now remove the restriction that the summands are integers (they must still be positive). Now what's the answer? How many pieces do you want, and what are their sizes? The answer is very interesting.
• Lecture Video 4: January 9, 2014: Game of Life, Pascal's Triangle Modulo 2, Sorting:   Part I        Part II   (sadly video camera had issues today!).