the good will hunting problem

3
Fall 2003 Mathematics Math21b Fall 2003 Linear Algebra and Differential Equations Course Head: Oliver knill Office: SciCtr 434 Email: [email protected] The Good Will Hunting Problem (A problem in Linear algebra) In the movie "Good Will Hunting" , the main character Will Hunting (Matt Damon) solves a blackboard problem, which had been assigned as a challenge to a linear algebra class. 1) Find the adjacency matrix A of the graph G 2) Find the matrix giving the number of 3 step walks in G. 3) Find the generating function for walks from point i to j. 4) Find the generating function for walks from points 1 to 3. The adjacency matrix L encodes the graph. The entry L ij is equal to k if there are k connections between node i and j. Otherwise, the entry is zero. Problem 2 asks to find the matrix which encodes all possible paths of length 3. Generating function. To a graph one can assign for pair of nodes i,j a series , where a n (ij) is the number of walks from i to j with n steps. Problem 3) asks for a formula for f(z) and in problem 4) an explicit expression in the case i=1,j=3. Solution to 1). The adjacency matrix L is Solution to 2). [L 2 ] ij is by definition of the matrix product the sum L i 1 L 1 j + L i 2 L 2 j +... + L i n L n j . Each term L i 1 L 1 j is not 0 if and only if there is at least one path of length 2 going from i to j passing through k. Therefore The Good Will Hunting Problem http://www.math.harvard.edu/archive/21b_fall_03/goodwill/ 1 of 3 8/3/2011 12:05 PM

Upload: booker4285

Post on 08-Mar-2015

39 views

Category:

Documents


4 download

TRANSCRIPT

Fall 2003

Mathematics

Math21b

Fall 2003

Linear Algebra and

Differential Equations

Course Head: Oliver knill

Office: SciCtr 434

Email: [email protected]

The Good Will Hunting Problem

(A problem in Linear algebra)

In the movie "Good Will Hunting", the main

character Will Hunting (Matt Damon) solves a

blackboard problem, which had been assigned as

a challenge to a linear algebra class.

1) Find the adjacency

matrix A of the graph G

2) Find the matrix giving

the number of 3 step

walks in G.

3) Find the generating

function for walks from

point i to j.

4) Find the generating

function for walks from

points 1 to 3.

The adjacency matrix L

encodes the graph. The

entry Lij is equal to k if

there are k connections

between node i and j.

Otherwise, the entry is zero.

Problem 2 asks to find the

matrix which encodes all

possible paths of length 3.

Generating function. To a

graph one can assign for

pair of nodes i,j a series

,

where an(ij)

is the number

of walks from i to j with n

steps. Problem 3) asks for a

formula for f(z) and in

problem 4) an explicit

expression in the case

i=1,j=3.

Solution to 1). The adjacency matrix L is

Solution to 2). [L2]ij is by definition of the matrix product

the sum Li 1 L1 j + Li 2 L2 j +... + Li n Ln j. Each term Li 1

L1 j is not 0 if and only if there is at least one path of

length 2 going from i to j passing through k. Therefore

The Good Will Hunting Problem http://www.math.harvard.edu/archive/21b_fall_03/goodwill/

1 of 3 8/3/2011 12:05 PM

[L2]ij is the number of paths of length 2 leading from node

i to j. Similarly, [Ln]ij is the number of paths of length n

going from i to j. The answer is

Solution to 3). The for the summation of a geometric series

holds also for matrices:

. Cramer's rule for the

inverse of a matrix is A-1

= det(Adj(A)ij)/det(A) leads to det( Adj(1-z L)ij)/det(1-z L)

which can also be written as det( Adj(L-z)ij)/det(L-z).

Solution to 4). Especially, when i=1 and j=3, we get det( Adj(A)13 = 2 z2 + 2 z

3 and

det(L-z) = 1-7 z2 - 2 z

3+4 z

4. The result can be written as (2 z

3+2z

3)/(1-7 z

2 - 2 z

3+4

z4)

Here is some Mathematica code to check this:

L={{0,1,0,1}, {1,0,2,1}, {0,2,0,0}, {1,1,0,0}}K[z_]:=IdentityMatrix[4] -z*L;Adj[A_,i_,j_]:=Module[{B=A},B=Delete[B,i];B=Transpose[B];B=Delete[B,j];B];Det[Adj[K[z],1,3]]/Det[K[z]](* check with Inverse[K[z]][[1,3]] *)

The Good Will Hunting Problem http://www.math.harvard.edu/archive/21b_fall_03/goodwill/

2 of 3 8/3/2011 12:05 PM

Back to the main page

The Good Will Hunting Problem http://www.math.harvard.edu/archive/21b_fall_03/goodwill/

3 of 3 8/3/2011 12:05 PM