SOLUTION: Lets assume that you have a CPU which takes y microseconds to add 2 floating point numbers and z microseconds to multiply 2 floating point numbers. You have an nxm matrix and an mx

Algebra ->  Probability-and-statistics -> SOLUTION: Lets assume that you have a CPU which takes y microseconds to add 2 floating point numbers and z microseconds to multiply 2 floating point numbers. You have an nxm matrix and an mx      Log On


   



Question 869778: Lets assume that you have a CPU which takes y microseconds to add 2 floating point numbers and z microseconds to multiply 2 floating point numbers. You have an nxm matrix and an mxp matrix. What is the time taken (in microseconds) to multiply the matrices?
a) It is not possible to multiply them.
b) 100
c) (m*n*p*(y-z))
d) n*p*e^(y+z)
e) (mz+(m-1)*y)*n*p

Answer by jim_thompson5910(35256) About Me  (Show Source):
You can put this solution on YOUR website!
Call the first matrix A. Matrix A is n x m.
Call the second matrix B. Matrix B is m x p.
Let C = A*B. Matrix C is n x p

Matrix C is defined since you have n x m by m x p. The two 'm's match and the final size of matrix C will be n x p.


There will be n*p elements in matrix C.


For each element, you have to have a combination of multiplication and addition.


To find the element in row1, column1 of matrix C, you are going to multiply m pairs of numbers (the corresponding numbers in row 1 of matrix A with column 1 of matrix B).
So far, the CPU has taken up m*z microseconds.
After you multiply all of those pairs of numbers, you're going to add them. You will have m-1 additions to perform (eg: if you have 10 numbers to add up, you really have 10-1 = 9 addition operations).
Doing these m-1 operations costs you another (m-1)*y microseconds. In total, it takes m*z + (m-1)*y microseconds to calculate the result for the element in row1, column1.


For the element in row1, column2 of matrix C, you do the same number of multiplications and additions. So you take another m*z + (m-1)*y microseconds.
Etc etc


You keep doing this for each of the n*p elements in matrix C. That means you do this n*p times.


So you'll take up a total of (mz+(m-1)*y)*n*p microseconds to multiply matrix A and matrix B to get matrix C.


This is choice E)