document.write( "Question 1179680: During one term in Math 310, Min Lee took seven tests, the last of which carried twice the weight of
\n" ); document.write( "each of the others when averages were computed. Min’s test-score vector for the term was
\n" ); document.write( "[84,78,91,80,72,88,83]. Show that Min’s final average, a weighted average, can be calculated as a dot
\n" ); document.write( "product of this vector with another seven-component vector. How can the teacher obtain a class list of
\n" ); document.write( "test averages by multiplying two matrices?
\n" ); document.write( "
\n" ); document.write( "

Algebra.Com's Answer #850184 by CPhill(1959)\"\" \"About 
You can put this solution on YOUR website!
Absolutely! Let's break down how to represent Min Lee's weighted average as a dot product and how to calculate class averages using matrix multiplication.\r
\n" ); document.write( "\n" ); document.write( "**1. Min Lee's Weighted Average as a Dot Product:**\r
\n" ); document.write( "\n" ); document.write( "* **Min's Test Scores:** [84, 78, 91, 80, 72, 88, 83]
\n" ); document.write( "* **Weights:** The first six tests have a weight of 1, and the last test has a weight of 2. So the weights are [1, 1, 1, 1, 1, 1, 2].
\n" ); document.write( "* **Total Weight:** 1 + 1 + 1 + 1 + 1 + 1 + 2 = 8\r
\n" ); document.write( "\n" ); document.write( "To calculate Min's weighted average as a dot product, we need to normalize the weights by dividing each weight by the total weight:\r
\n" ); document.write( "\n" ); document.write( "* **Normalized Weights:** [1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 2/8] = [0.125, 0.125, 0.125, 0.125, 0.125, 0.125, 0.25]\r
\n" ); document.write( "\n" ); document.write( "Now, we can calculate the dot product of Min's test scores and the normalized weights:\r
\n" ); document.write( "\n" ); document.write( "* Weighted Average = (84 * 0.125) + (78 * 0.125) + (91 * 0.125) + (80 * 0.125) + (72 * 0.125) + (88 * 0.125) + (83 * 0.25)
\n" ); document.write( "* Weighted Average = 10.5 + 9.75 + 11.375 + 10 + 9 + 11 + 20.75
\n" ); document.write( "* Weighted Average = 82.375\r
\n" ); document.write( "\n" ); document.write( "This is the same as:\r
\n" ); document.write( "\n" ); document.write( "```
\n" ); document.write( "import numpy as np\r
\n" ); document.write( "\n" ); document.write( "# Min's test scores
\n" ); document.write( "min_scores = np.array([84, 78, 91, 80, 72, 88, 83])\r
\n" ); document.write( "\n" ); document.write( "# Weights for each test
\n" ); document.write( "weights = np.array([1, 1, 1, 1, 1, 1, 2]) \r
\n" ); document.write( "\n" ); document.write( "# Calculate Min's final average using dot product
\n" ); document.write( "min_average = np.dot(min_scores, weights) / sum(weights) \r
\n" ); document.write( "\n" ); document.write( "print(f\"Min's final average: {min_average}\")
\n" ); document.write( "```\r
\n" ); document.write( "\n" ); document.write( "**2. Class List of Test Averages Using Matrix Multiplication:**\r
\n" ); document.write( "\n" ); document.write( "Let's say the teacher has a class of 'm' students and the same 'n' number of tests. We can represent the test scores in a matrix called 'Scores', where:\r
\n" ); document.write( "\n" ); document.write( "* Scores is an m x n matrix (m rows, n columns).
\n" ); document.write( "* Each row represents a student's test scores.
\n" ); document.write( "* Each column represents the scores for a particular test.\r
\n" ); document.write( "\n" ); document.write( "We can also represent the normalized weights in a column vector called 'Weights', where:\r
\n" ); document.write( "\n" ); document.write( "* Weights is an n x 1 matrix (n rows, 1 column).
\n" ); document.write( "* Each element represents the normalized weight for a test.\r
\n" ); document.write( "\n" ); document.write( "To get the class list of test averages, we can multiply the 'Scores' matrix by the 'Weights' vector:\r
\n" ); document.write( "\n" ); document.write( "* Averages = Scores * Weights\r
\n" ); document.write( "\n" ); document.write( "The result will be an m x 1 matrix (a column vector) where each element represents a student's weighted average.\r
\n" ); document.write( "\n" ); document.write( "Here's how it would look in Python using NumPy:\r
\n" ); document.write( "\n" ); document.write( "```python
\n" ); document.write( "import numpy as np\r
\n" ); document.write( "\n" ); document.write( "# Example: 3 students, 7 tests
\n" ); document.write( "scores = np.array([
\n" ); document.write( " [84, 78, 91, 80, 72, 88, 83], # Min Lee's scores
\n" ); document.write( " [90, 85, 78, 92, 88, 95, 90], # Another student's scores
\n" ); document.write( " [75, 82, 70, 78, 80, 75, 81] # Another student's scores
\n" ); document.write( "])\r
\n" ); document.write( "\n" ); document.write( "weights = np.array([1/8, 1/8, 1/8, 1/8, 1/8, 1/8, 2/8])\r
\n" ); document.write( "\n" ); document.write( "class_averages = np.dot(scores, weights)\r
\n" ); document.write( "\n" ); document.write( "print(\"Class Averages:\", class_averages)
\n" ); document.write( "```\r
\n" ); document.write( "\n" ); document.write( "In essence, matrix multiplication allows the teacher to efficiently calculate the weighted averages for all students in the class with a single operation.
\n" ); document.write( "
\n" ); document.write( "
\n" );