Every year Money magazine selects several cities in the United States as the “best” cities to live in, based on a wide array of statistics about each city. This is a small example of how the editors of Money might arrive at a single number that consolidates the statistics about a city. We will analyze Los Angeles, Chicago and New York City, based on four criteria: average high temperature in July (Farenheit), number of colleges and universities in a 30-mile radius, number of toxic waste sites in the Superfund environmental clean-up program and a personal crime index based on FBI statistics (average = 100, smaller is safer). It should be apparent how to generalize the example to a greater number of cities and a greater number of statistics.
We begin by building a table of statistics. The rows will be labeled with the cities, and the columns with statistical categories. These values are from Money’s website in early 2005.
City |
Temp |
Colleges |
Superfund |
Crime |
Los Angeles |
77 |
28 |
93 |
254 |
Chicago |
84 |
38 |
85 |
363 |
New York |
84 |
99 |
1 |
193 |
Conceivably these data might reside in a spreadsheet. Now we must combine the statistics for each city. We could accomplish this by weighting each category, scaling the values and summing them. The sizes of the weights would depend upon the numerical size of each statistic generally, but more importantly, they would reflect the editors opinions or beliefs about which statistics were most important to their readers. Is the crime index more important than the number of colleges and universities? Of course, there is no right answer to this question.
Suppose the editors finally decide on the following weights to employ: temperature, \(0.23\text{;}\) colleges, \(0.46\text{;}\) Superfund, \(-0.05\text{;}\) crime, \(-0.20\text{.}\) Notice how negative weights are used for undesirable statistics. Then, for example, the editors would compute for Los Angeles
\begin{equation*}
(0.23)(77) + (0.46)(28) + (-0.05)(93) + (-0.20)(254) = -24.86
\end{equation*}
This computation might remind you of an inner product, but we will produce the computations for all of the cities as a matrix-vector product. Write the table of raw statistics as a matrix
\begin{equation*}
T=
\begin{bmatrix}
77 & 28 & 93 & 254\\
84 & 38 & 85 & 363\\
84 & 99 & 1 & 193
\end{bmatrix}
\end{equation*}
and the weights as a vector
\begin{equation*}
\vect{w}=\colvector{0.23\\0.46\\-0.05\\-0.20}
\end{equation*}
\begin{equation*}
T\vect{w}=
(0.23)\colvector{77\\84\\84}+
(0.46)\colvector{28\\38\\99}+
(-0.05)\colvector{93\\85\\1}+
(-0.20)\colvector{254\\363\\193}
=
\colvector{-24.86\\-40.05\\26.21}\text{.}
\end{equation*}
This vector contains a single number for each of the cities being studied, so the editors would rank New York best (\(26.21\)), Los Angeles next (\(-24.86\)), and Chicago third (\(-40.05\)). Of course, the mayor’s offices in Chicago and Los Angeles are free to counter with a different set of weights that cause their city to be ranked best. These alternative weights would be chosen to play to each cities’ strengths, and minimize their problem areas.
Notice how the vector of weights, \(\vect{w}\text{,}\) is naturally indexed by the four statistics used, while the matrix-vector product, \(T\vect{w}\text{,}\) is naturally indexed by the three cities. If a speadsheet were used to make these computations, a row of weights would be entered somewhere near the table of data and the formulas in the spreadsheet would effect a matrix-vector product. This example is meant to illustrate how “linear” computations (addition, multiplication) can be organized as a matrix-vector product.
Another example would be the matrix of numerical scores on examinations and exercises for students in a class. The rows would be indexed by students and the columns would be indexed by exams and assignments. The instructor could then assign weights to the different exams and assignments, and via a matrix-vector product, compute a single score for each student.