Question: Workout 1) Matrix Multiplication Matrix multiplication involves quite a few math operations. Write a function to do this for you that takes in four inputs:


Workout 1) Matrix Multiplication Matrix multiplication involves quite a few math operations. Write a function to do this for you that takes in four inputs: matrix A, matrix B, an output matrix and a size (again assume square matrices). For this problem assume the size is always 3 (so 3x3 matrices). Ask the user to input both matrices A and B, then display the output matrix. Assume it is always A*B with matrix A on the left (the first input matrix). To do matrix multiplication, any given output spot is computed using the whole row of A at the spot and the whole column of B at the spot. The first number in the row is multiplied by the first number in the col- umn, then the second number in the row is multiplied with the second number in the column, and so on. All 3 these values are added together to get the final value for the spot. For example, the top middle spot in the output is shown in the example below: [1 2 3 [10 11 12 [ ? 90 4 5 6. 13 14 15 ? ? 8 9 16 17 18 ? ? 2. aa This is computed as: 1*11+ 2*14+3*17 = 90 If you are still uncertain how matrix multiplication works, here are a few links (or ask a TA): https://www.mathsisfun.com/algebra/matrix-multiplying.html https://en.wikipedia.org/wiki/Matrix_multiplication Activate Go to Sett Example: Input first matrix 1 2 3 4 5 6 7 8 9 Input second matrix: 10 11 12 13 14 15 16 17 18 Output matrix: 84 90 96 201 216 231 318 342 366 Activate Go to Settir
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
