document.write( "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?
\n" ); document.write( "a) It is not possible to multiply them.
\n" ); document.write( "b) 100
\n" ); document.write( "c) (m*n*p*(y-z))
\n" ); document.write( "d) n*p*e^(y+z)
\n" ); document.write( "e) (mz+(m-1)*y)*n*p
\n" ); document.write( "

Algebra.Com's Answer #524398 by jim_thompson5910(35256)\"\" \"About 
You can put this solution on YOUR website!
Call the first matrix A. Matrix A is n x m.
\n" ); document.write( "Call the second matrix B. Matrix B is m x p.
\n" ); document.write( "Let C = A*B. Matrix C is n x p\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "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. \r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "There will be n*p elements in matrix C.\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "For each element, you have to have a combination of multiplication and addition.\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "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).
\n" ); document.write( "So far, the CPU has taken up m*z microseconds.
\n" ); document.write( "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).
\n" ); document.write( "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. \r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "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. \r
\n" ); document.write( "\n" ); document.write( "Etc etc\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "You keep doing this for each of the n*p elements in matrix C. That means you do this n*p times.\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "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.\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "This is choice E)
\n" ); document.write( "
\n" );