Math 130 Fall 2007

Assignments
1 · 2 · 3 · 4 · 5 · 6    Nov 10: Note revised due dates!
Nov 28

Review: Combinatorics and old exam questions

Sasha's combinatorics questions, note esp. 5.5-70.

Questions from the 2006 Final Exam: 2, 1, 12, 13.

Homework

Study! Bring problems and questions to class.

Nov 26

Review: Combinatorics

Combinatorics review problems[PDF] and blackboard pics ( 1, 2, 3, 4 ) of their solutions.

Homework

Try redoing the combinatorics problems assigned earlier in the term, and bring any questions or problems that arise to class Wednesday.

Nov 23

LP: The simplex method for minimization ~ A final example

Example: Redo 3.3-25 which we did earlier graphically, using the simplex method. Pics: 1, 2.

Homework

4.3: 9, 13.

Nov 21

LP: The simplex method for minimization

Taking up the quiz: the problem, the blackboard pic.

Taking up the starship problem from the assignment: blackboard pic and the overheads. 1 is the first attempt but the tree gets too large (108 paths, see calculation in blackboard pic), so 2 try not pursuing branches once the time taken is already >17, then 3 notice that some states reoccur and decide to pursue only the quickest way of achieving each state, which 4 leads to noticing that there aren't all that many states, so the graph (as opposed to tree) is managable and the problem can be solved via the Shortest Route algorithm.

Simplex method minimization by example: Problem 4.3-3 Pic (see the yellow box on page 182 for a summary of the steps).

Nov 19

LP: The simplex method

Example: 4.2-19 pic 1, pic 2.

Notes:

Example: 4.4-20 pic

Notes:

Assignment tip: The first good approach most people take is to send the lightest item off the starship with each heavier item, and then to bring the lightest item back, in order to minimize the return travel time. To do better you will need to send the two largest items off together so the weight of the heaviest container can "mask" the weight of the second heaviest one.

Nov 16

LP: The Simplex Method

Example: 4.2-18. Pic. (Note that in the pic we were exploring the system and had changed the space required per B system from what the book specified to 8 cubic feet).

Assignment tip

Nov 14

LP: Final final installment on the graphical approach

Blackboard pics: 3.3-29, 3.2-31.

LP: The Simplex Method

Blackboard pic.

The Simplex method is involved but straightforward (i.e. mechanical):

  1. Formulate problem as for graphical solution, i.e. identify the objective function and the constraints.
  2. Add slack variables to each constraint inequality to make it into an equation (ignore the formal constraints that variables must be non-negative; this assumption is built into the Simplex method).
  3. Rewrite objective function so it equals zero (do it so the coefficients of the independent variables become negative).
  4. Write the equations into the simplex tableau (matrix).

    Notes:

    • Objective function is always the bottom row of the matrix.
    • Label the colums with the relevant variable names.
    • Label the rows with the names of the slack variables they contain.
  5. Pivot the tableau until all the entries in the bottom row are non-negative.
  6. Pivoting rules:
    1. The pivot column is the one with the most negative entry in the final row.
    2. The pivot entry in that column is the one for which the ratio of constant (in the last column) and coefficient is least.

Example: Redo the sleds and toboggans problem using the Simplex method.

Reading solutions at each step from the tableau.

What the pivoting is doing in graphical terms.

Homework

4.2: 17, 21, 23.

Nov 9

Linear Programming: A graphical approach (final installment)

Blackboard pics: 1, 2, 3.

Examples: 3.3-27, 3.3-25.

Nov 7

Linear Programming: A graphical approach continued

Blackboard pics: 1, 2, 3.

Example: Finishing the second example from the LP Problems Overhead

Example: Reducing the apparent dimensionality of a problem 3.3-23

Homework

3.3: 27, 29.

Nov 5

Linear Programming: A graphical approach

Blackboard pics: 1, 2, 3.

Graphical solution of linear programming problems:

  1. Identify the quantity to be optimized, whether it is to be maximized or minimized and a formula for calculating it. This is called the objective function.
  2. Identify the constraints -- natural and formal -- that prevent trivial optimization of the objective function, and express them as inequalities.
  3. Find the feasible set or region by graphing the constraints and shading out the infeasible regions of the plane.
  4. The optimum will occur at one of the "vertices" of the feasible region (or along an edge of it), so calculate the value of the objective function at each corner and select the optimum value.

Examples: Completed the first and began the second problem from the LP Problems Overhead

Homework

3.2 - 1, 3, 5, 9, and 17.

Nov 2

Pivoting matrices

Blackboard pics: 1, 2, 3, 4.

Handouts: Selections from three finite math textbooks. Remember: Green pages have the best descriptions of MST, Shortest route and Critical Path done in the table (but they draw their critical path graphs oddly). Pink pages are from an earlier edition of the text and are good on graph colouring, and Euler problems, but don't provide a useful algorithm for solving Critical Path problems (but does draw the graph correctly). Buff (pale yellow) pages provide solved problems.

Pivoting about an entry in a matrix:

  1. Divide all elements in the pivot row, by the pivot value. This makes the pivot entry 1.
  2. Add/subtract a multiple of the pivot row from each other row to make the other entries in the pivot column 0.
  3. To solve a system of linear equations by pivoting, pivot about each entry of the main diagonal.

ASCII-graphic of a generic solution matrix (that has a unique solution):

 -              -
| 1 0 0 0 ... c1 |
| 0 1 0 0 ... c2 |
| 0 0 1 0 ... c3 |
| ...     ... .. |
| 0 0 0 ... 1 cn |
 -              -
    

Examples: One created in-class (See Pic 2 above). 2.2-10, 2.2-14.

Possible results of attempting to solve a system of equations:

Example of problem formulation and solution: 2.2-27.

Oct 31

Solving systems of linear equations

Method 2: Gaussian elimination.

Method 3: Substitution.

Example: What it looks like when there is no solution: 0=18.

Graphical interpretation of solutions: The intersection of two straight lines (in 2-D, or of three planes in 3-D). When there is no solution it is because the lines are parallel and do not intersect.

Gaussian elimination to solve a system of three equations in three unknowns.

Doing Gaussian elimination in a matrix by pivoting.

Homework

2.1: 25, 29, 31, 45, 47, 49.
2.2: 1, 3, 5, 11, 13, 15. In 2.2 use Gaussian elimination in-the-matrix.

Updated! Supplementary notes on doing the shortest route algorithm in-the-matrix.

Oct 29

Graph connectedness, reachability and matrix multiplication

Review of critical path method.

Matrix multiplication

The result of AB will have as many rows as A and as many columns as B.

To multiply A and B, the number of rows in B must equal the number of columns in A.

If you write the matrices with B above and to the right of A, the result matrix will be to the right of A and below B and each entry in the result matrix is the sum of the products of the elements in the row to its left and the column above it.

Connectedness and Reachability

A matrix is connected if a path exists from every vertex to every other vertex, i.e. if every vertex can be reached from every other. This can be tricky to assess visually, especially if the graph is directed.

The adjacency matrix, A, for a graph has 1s where two vertices are connected by an edge, and 0 otherwise.

The entries in An give the number of paths of length n from one vertex to another.

The longest a path could need to be to get from one vertex to another is N-1 where N is the number of vertices in the graph (because you couldn't have to go through every other vertex more than once).

The Reachability matrix is the sum A + A1 + A2 + ... + AN-1. If it has any 0 entries off the main diagonal then the matrix is not connected.

Hamiltonian Circuits

No easy test for the existence of a Hamiltonian circuit.

Finding the Hamiltonian circuit of minimal weight (popularly known as the travelling salesman problem) efficiently is a famous unsolved problem.

Brute force is an ineffective method because if the graph is complete (i.e. every vertex is directly connected to every other), the complexity increase as the factorial of the number of nodes.

Solving systems of linear equations.

Method 1: Solving by equating.

Oct 26

Example Graph Problems

Do most of the problems from Graph Theory problems 1.

Oct 24

Critical path algorithm

Blackboard pics: 1, 2, 3.

Algorithm ("in the table")

  1. Begin with a table giving the tasks, their duration times and their prerequisites.
  2. Add a column giving the Earliest Start Time for each task.
  3. Add a column giving the Earliest Finish time for each task (the latest time in this column is the earliest the project could be completed).
  4. Add a column giving the Latest Finish Time for each task.
  5. Add a column giving the Latest Start Time for each task.
  6. Add a column giving the Slack Time for each task. The slack time is the Latest Start Time - the Earliest Start Time.

    The tasks with 0 slack time make up the critical path.

Oct 22

Graph Theory: Shortest Route, Colouring, Isomorphism

Blackboard pics: 1, 2, 3, 4, 5.

Review Shortest route on a graph.

Shortest Route (in a matrix) See the blackboard pic for the algorithm.

Supplementary notes on doing the shortest route algorithm in-the-matrix.

Review to compare: MST in a matrix.

Graph Colouring. Problem: What is the smallest number of colours that can be used to colour the vertices of a graph such that no two connected vertices share the same colour?

Graph Equivalence What is necessary for two graphs to be equivalent?

Homework

Graph theory problems 2

Oct 19

Graph Theory: MST and Shortest Route

Blackboard pics: 1, 2. 3.

Jargon: acyclic, tree, span, algorithm, heuristic.

Examining an adjacency matrix: How many nodes? How many edges? Directed or undirected? Isolated nodes?

Review: Minimal spanning tree algorithm 1) on graph, 2) in tree.

Implications of edges having two ends

Shortest Route (on the graph)

Goal: Find the path of least weight from a source node to a destination node.

Algorithm:

  1. Start at source node.
  2. Make shortest route possible to any unreached node.
  3. If the newly reached node is the destination node, stop (since it has just been reached by shortest route possible).
  4. Otherwise, repeat.

Homework

Some Graph Theory problems 1. We haven't seen how to do 5. in class yet, but you can see the example linked above, or wait until Monday.

Oct 17

Introduction to Graph Theory

Blackboard pics: 1, 2.

Jargon: edges, vertices, nodes, circuit, path, degree.

Euler and the bridges of Konigsberg problem.

Minimal Spanning Tree

Goal: Find tree of minimal weight that connects all vertices in a graph.

Algorithm:

  1. Start at any vertex.
  2. Add to the tree the lightest edge that connects to an as-yet-unconnected vertex.
  3. Repeat until all vertices are connected.

Matrix representation of graphs.

Entries show weights of edges connecting vertices.

For undirected graph the matrix will be symmetric about the main diagonal.

Loops will show up as entries on the main diagonal.

Homework

Can you draw a graph in which three vertices have odd degree? If not, why not? (Recall that the degree of a vertex is the number of edges that land on it.)

(Hamiltonian circuits) Similar to the snow plow problem we can imagine a school bus problem. Where the snow plow needs to traverse every road (edge) and doesn't worry about passing through intersections (vertices) more than once, a school bus wants to visit every bus stop (vertex) once, but doesn't need to drive all the roads (edges) in the city. Is there a simple test for whether a graph has a circuit of this type?

Oct 15

Bayes' Theorem

Bayesian problems from the overheads

Bayes' theorem examples.

Comparing three alternative representations for working with conditional probabilities and Bayes theorem:

Multi-way (as opposed to 2-way) Bayesian problems.

Oct 12

Tree Diagrams and Bayes Theorem

Homework

6.6: 5, 11, 13, 15.

6.7: 3, 5, 7, 11, 19.

Oct 10

Conditional probability

Notation: Pr( A | B ) read "The probability of A given that B has occurred".

Formula: Pr( A | B ) = Pr( A ∩ B )/ Pr( B )

Examples: the math class, and the colour blind boy problems.

Homework

6.5 ~ 3, 5, 9, 13, 15, 17, 22, 27, 35, 42, 47, 49, 58.

Oct 8

Simple Probabilities 3

(Election theory)

Example probability problems.

Oct 5

Simple Probabilities 2

(Election theory)

(Take up Assignment 1)

Complementary events. Probabilities of complementary events must add to 1, i.e. Pr(A) + Pr(A') = 1. This is usually used in the form Pr(A) = 1 - Pr(A'). Example: The fuse problem.

Example probability problems.

Oct 3

Simple Probabilities 1

Probability of an event is the chance that it will occur

Probability of 1 of N equally likely outcomes is 1/N

Probability of 1 of a subset of n outcomes from a universe of N equally likely outcomes is n/N

Probabilities range from 0 (probability of an event outside the universe) up to 1 (the probability of any event at all occurring).

Pr(U) = 1.0, Pr(U') = 0.0

Set-based interpretation of probabilities

Inclusion-exclusion principle applies to probabilities as it did to sets: Pr(A ∪ B) = Pr(A) + Pr(B) -Pr(A ∩ B)

The probability of an event not happening is 1 - the probability that it does happen, and vice versa: Pr(E') = 1 - Pr(E) and Pr(E) = 1 - Pr(E')

Probabilities of mutually exclusive outcomes are added, i.e. "the probability of this or this or this"

Examples: Problems 1-4 from the overheads.

For interest, via this CBC story comes the news that a couple in the US just won a $200,000,000 million Powerball lottery. The record US lottery jackpot is $365,000,000.

Homework

6.4 ~ 8, 10, 11, 12, 13, 15, 17, 19, 22, 25, 27, 30, 39.

Oct 1

Combinatorics 3

Discussion of voting systems: Plurality, Runoff/Majority, Borda, Condorcet.

Problems:

To the types of problems from the previous class we added compound problems, where we might have to add the results of two or more ways of counting things out, e.g. SEQUOIA, or where there might multiple different types of choices, e.g. the poker hand.

The navigation problem of getting from one point in a grid to another, can be thought of as choosing a number of times to go west or north. So in the example, we had to choose 4 of 11 movements to be westward ones, giving C(11,4) (or equivalently 7 of 11 movements to be northward ones).

Note that mathematics relies on a relatively small number of solution techniques, but is very creative at finding ways to apply them. So for example we were able to translate the street grid problem into one equivalent to the footbal problem.

Homework

5.6 ~ 4, 13, 15, 17, 20, 24, 29, 31, 33, 39.

Sept 28

Combinatorics 2

Working backwards from combinations to set size: 5.4-28.

A subtle formulation: 5.4-26

Standard problems: 5.5-32, 43, 40, 47-49.

Dealing with "at least", "more than" and their ilk: Counting the membership of multiple sets. 5.6-10, 16.

Sept 26

Combinatorics 1

In combinatorics we saw four types of problems:

The trick with combinatorics is to get good at identifying which type a particular problem is.

A peek ahead: 5.6-34.

Homework

5.4 ~ 2, 5, 7, 9, 15, 17, 22, 27, 29, 31, 40, 53, 55, 59.

5.5 ~ 21, 25, 29, 31, 33, 37, 41, 53, 57.

Sept 24

Using sets to analyze data

Tutorial: More on sketching Venn diagrams.

Example: First those fun-loving MIT students:

A random sampling of 98 students at MIT revealed that: 62 had taken Calculus, Finite Mathematics and Programming, 19 had not taken Calculus, 80 had taken Programming and Finite Mathematics, none had only taken Programming, but 82 had taken Programming in conjunction with another course, 3 had only taken Calculus, and 73 had taken Calculus and Finite Mathematics.

a) How many students had taken only Finite Mathematics?

b) How many had not taken any of Calculus, Finite Mathematics, and Programming?

c) How many had taken Calculus or Programming?

d) How many had not taken Programming, but had taken Finite Mathematics?

Then the newspaper excerpt on handgun deaths:

The number of murder victims in this country [U.S.A.] during the years 1987 and 1988 totalled 36,128 (roughly the same as the number of U.S. battle deaths during the 13 years of the Korean War). Of this total 18,269 were victims during 1988. Handguns were the weapons of choice in dispatching 16,085 of the victims during these two years, while 9,991 of the victims during 1988 met their death with some weapon other than a handgun.

"The increase in handgun death is particular disheartening", said

Sept 21

Set theory

Shading Venn diagrams. How to handle Intersection (shade in opposite directions) and Union (shade in one direction).

The cardinality of sets: n( A ∪ B) = n( A ) + n( B ) - n( A ∩ B )

Beware double counting.

Using set-based techniques to analyze numeric data.

An example:

A survey of 110 lung cancer patients showed that 70 were cigarette smokers, 60 lived in urban areas, and 35 had hazardous occupations. Forty of the smokers lived in urban areas, 15 had hazardous occupations, and 5 were in both categories. Ten of the patients with hazardous occupations neither lived in an urban area, nor smoked.

a) How many of the patients living in urban areas had hazardous occupations?

b) How many of those living in the urban areas neither smoked nor had hazardous occupations?

c) How many patients neither smoked, nor lived in an urban area, nor had a hazardous occupation?

Homework

5.1 ~ 13, 27, 29, 31.

5.2 ~ 3, 5, 9, odd 13 - 43.

5.3 ~ 1, 3, 7, 13, 17, 41, 43, 45, 47, 50, 51.

Sept 19

From logic to sets via Euler diagrams

What you need to be able to do with the tools of logic: See last year's final exam. (Note: 3 hours = 180 minutes for 180 marks, so the value of a question shows approximately how many minutes it should take you to do.
Euler diagrams as a way to deal with arguments containing quantifiers like "all", "some" and "none".
Guidelines:
Examples:

Homework

Try using Euler diagrams to analyze the following arguments.

  1. All joggers are lean. All lean people are healthy. Therefore all joggers are healthy.
  2. Some mathematicians are teachers. Some teachers are bald. Therefore some mathematicians are bald.
  3. All mathematicians are teachers. Some teachers are bald. Therefore some mathematicians are bald.
  4. All mathematicians are teachers. All teachers are bald. Therefore some mathematicians are bald.
  5. Mammals are warm-blooded. Snakes are not mammals. Therefore no snakes are warm-blooded.

Digital logic Review problems

Sept 17

Digital Logic 2

Designing circuits by stating the requirement in English and then translating into circuit elements.
Designing the 1-bit adder: "the output should be high when i1 or i2 is high but not when both i1 and i2 are high"
Using a cascade of 1-bit-with-carry adders to build a multibit adder.
Designing a 1-bit-with-carry adder:
  1. Write the truth table for the circuit.
  2. State the requirement for each output column in English, but constraining yourself to and/not/or constructions.
  3. Translate the English requirements into circuit elements.
  4. Place the circuit into the box.

The tracing problem from the first class

Three categories:
  1. Traceable starting from any corner.
  2. Traceable starting from one of two corners and ending in the other corner.
  3. Not-taceable.
Jargon: Corner = vertex. Degree = number of lines ending at that corner.
Rules:
  1. Category 1 diagrams have all even degree vertices.
  2. Category 2 diagrmas have exactly two vertices of odd degree.
  3. Category 3 diagrams have more than two vertices of odd degree.
Also known as the snow plough problem.
Background: Euler and the bridges of Konigsberg.

Homework

I've also posted some logic review problems and the solutions to them to give you some further practice analyzing arguments.

Try and formulate an English statement to describe this input-output table:

 i1 i2 | output
-------+-------
  0  0 |   1
  0  1 |   0
  1  0 |   0
  1  1 |   1

Try and translate your statement into a symbolic expression.

Try and draw a circuit to match the statement.

Sept 14

Digital Logic

Counting in base 2 (binary).
Converting from binary to decimal (remember the columns are powers of 2 now rather than 10).
Adding binary numbers.
Digital gates: and, or, not.
Analyzing a circuit.
Began working on a circuit to add two 1-bit numbers. (bit = binary digit)
Sept 12

Validating Arguments

Names for common argument forms. See table 1 on page 609.
Reading symbolic argument forms using "happens".
Recall example of Hypothetical Syllogism: "If you tell the truth, you will sleep well. If you sleep well, you will be healthier. Therefore, if you tell the truth you will be healthier."
Validating arguments 2. If the conclusion can be derived from the premises using valid rules of inference then the argument is valid.
Examples.
Preview: Counting in Base 2.

Homework


12.5 - 3, 5, 7, 9. (Click the links to see my solutions).
Sept 10

Logic: Validating arguments

Logical equivalence
de Morgan's theorems
Another logical connector: implication
Validating arguments using truth tables:
  1. Identify the simple statements making up the argument and assign them letters.
  2. Identify the logical connections between the simple statements in terms of and, or and not, and rewrite the argument in symbolic form.
  3. Create a truth table showing the truth values of each premise and the conclusion.
  4. Identify the rows of the truth table in which all the premises are true (we used a checkbox for this).
  5. If the conclusion is False in any of these rows the argument is not valid.
Homework
12.3: 5, 11.
12.5: 11, 13, 17.
You should get some practice working with the truth values for implication so try problems 12.3-5 and 12.3-11.
You should also begin practicing validating arguments. Begin with problems 11, 13 and 17 in section 12.5 of the text. Solutions: 11, 13, 17.

Sept 7

Logic

(But first, the solution to the second homework question from the first class, including the sad story of Gauss as a boy, and a useful formula for finding the sum of the numbers from 1 to n, i.e. 1 + 2 + 3 + ... + n = (n/2)(n+1) ).
Introduction to logic: What an argument is. The overhead showing where we're heading. Simple statements. Logical connectors: ∧ ∨ ∼ and their truth tables. Logical equivalence.
Homework
12.1: 1-21, 23, 25.
12.2: 5, 13, 15, 17, 21, 23, 29.
Sept 5

Course introduction

Course description (see class handout).
Example problem: Tracing a shape (without retracing or lifting your pen from the paper).
Example problem: Where's the other dollar?
Example problem: Carving up the sidewalk.
Homework: Can you find a rule that will tell you if a shape can be traced, and if so if you can start anywhere? What is the largest number of segments one can cut a sidewalk square into by drawing 100 lines?