You are on page 1of 18

Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

MATH 4A - Linear Algebra with Applications


Lecture 13: Applications!

29 April 2019

Reading: §1.6, §1.10, and §4.1 from Lay, 5th ed.


Recommended problems from §1.6: 11, 13
Recommended problems from §1.10: 1, 9, 11
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Lecture plan

1 Finishing up determinant as volume

2 Application 1: Network Flow

3 Application 2: webgraph

4 Application 3: Diet design


Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

See board
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

iClicker 1

Determine the volume of the 3-dimensional parallelepiped


determined by the three vectors
     
1 3 0
2 2 0
3 1 1

(a) -4
(b) Not enough information to say
(c) 8
(d) 4
(e) -8
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Networks

A network is a set of junctions, or nodes, together with lines or


arcs connecting the nodes called branches. The branches have
arrows on them to indicate which direction the network flows.

Sometimes we label each branch with a number to indicate that a


certain amount of “stuff” is flowing through that branch. (If we
don’t label the branches, we might think of that as labeling them
all with a 1.)

We are often (but not always) interested in conservative networks


in which the amount of stuff flowing into each node is equal to the
amount of stuff flowing out of each node.
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

There are many interesting questions to ask about a


network

1 Can we recover the behavior of the entire network flow from


just part of the information? (In particular, the “boundary”?)
2 What does a “typical” flow trajectory look like?
3 etc.. . .
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Example 1: traffic in downtown Baltimore


After some surveying using those rubber vehicle counting hoses,
the city of Baltimore has acquired the following incomplete data
for its downtown traffic pattern (units are vehicles per hour):
x3 100

300 x4 400

x2 x5

300 x1 600

500

Can the city determine exactly how the traffic behaves from this
data?
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Example 1: traffic in downtown Baltimore

It’s reasonable to assume that traffic is (approximately)


conservative. Thus, at each node of the network (which
corresponds to an intersection of two roads), the number of cars
going into that intersection is the same as the number of cars
leaving that intersection. Using this, we can set up a linear system
to try to solve for the unknown data.
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Example 1: traffic in downtown Baltimore


x3 100
x4
300 400
x2 x5
300 x1 600
We convert the network 500 into the following
linear system:
300 + 500 = x1 + x2
x1 + x5 = 600
x2 + x4 = 300 + x3
100 + 400 = x4 + x5
which we can rewrite as a matrix vector equation:
 
 x
0 0 0  1
  
1 1 800
1 0 x2   
0 0 1   600
 
 x3  =  
0 1 −1 1 0  x4  300
0 0 0 1 1 500
x
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

iClicker 2

The echelon form of the associated augmented matrix for the


traffic pattern is
 
1 0 0 0 1 600
 0
 1 0 0 −1 200 

 0 0 1 0 0 400 
0 0 0 1 1 500

We wanted to know if the traffic pattern was uniquely determined


by the data that the city had already collected. What do you
think?
(a) Yes, the total traffic pattern is determined.
(b) No, it is not.
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

The webgraph

The webgraph is a representation of the entire Internet as a


network: there is one node for each webpage, and a branch
pointing from node P to node Q for each time the webpage P has
a hyperlink to Q. We don’t label the branches with flow quantities
(so you can think of all of them as being label by 1s).

Is the webgraph conservative? Discuss!


(a) Yes
(b) No
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Example 2: webgraph

This isn’t exactly a “network” representation of the webgraph, but


it is very similar: https://internet-map.net/

Understanding the webgraph is essential for how Google’s


PageRank works. We’ll discuss this more later in the quarter, but
the basic theory underlying it is the following:
1 Start at a random website, and click a random link to another
webpage. Then click another random link. Keep doing this
many times.
2 This random walk generates a probability distribution.
3 The probability that you land at a given webpage P after, say,
a million steps, is the PageRank of that webpage P.
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Example 2: webgraph

In fact, instead of literally doing a bunch of random walks to


approximate the probability distribution, there is a better way to
compute the PageRank using eigenvectors, which we’ll discuss later
in the quarter.

Basically, as long as Google has a good approximation to the


webgraph (which it generates by indexing the internet), it can
efficiently approximate the PageRank well enough most of the time.
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Soylent green is people!

Suppose you want to make a single food that exactly satisfies all of
the various nutritional Recommended Daily Allowances (RDAs)
from the Food and Nutrition Board simultaneously. How would
you do it?

Well, you will have to combine a bunch of different ingredients in


different ratios and solve...

Since nutrients add when you add more ingredients, this is a linear
problem. . . so we can use matrices!
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Example 3: nutrient shake

Suppose we have three ingredients: soy protein isolate, peanuts,


and all-purpose flour, which we want to mix to realize the RDAs
for fat, carbs, and protein. Let’s figure out what mixture is
appropriate.

Here’s the nutritional content of the three ingredients, as well as


the RDA for the nutrients (units in the first three columns are
grams per gram, the last column is just grams):

Nutrient soy peanut flour RDA


fat .04 .49 .01 18
carb .08 .16 .76 130
protein .79 .26 .10 56
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Example 3: nutrient shake


Each ingredient supplies a “nutrient vector”—namely, the
appropriate column in the table:
     
.04 .49 .01
s = .08 p = .16 f = .76
.79 .26 .1

We must solve the linear system

x1 s + x2 p + x3 f = T

where T is the “target” nutrient vector


 
18
T = 130 .

56
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

Example 3: nutrient shake

Of course, we solve this problem by forming the augmented matrix


 
 .04 .49 .01 18
s p f T = .08 .16 .76 130
.79 .26 .10 56

Then we find the echelon form, which is approximately:


 
1 0 0 40.65
 0 1 0 30.14  .
0 0 1 160.42

This tells us we should have 40.65 grams of soy protein, 30.14


grams of peanuts, and 160.42 grams of flour.
Finishing up determinant as volume Application 1: Network Flow Application 2: webgraph Application 3: Diet design

DELICIOUS!

https://www.youtube.com/watch?v=6zAFA-hamZ0

You might also like