2

How can I get one single product matrix? Please help!

enter image description here

Now: enter image description here

Aly S.
  • 21
  • 3
  • The trouble is that MatrixForm is only for visualizing the results. Saying c1 = List[{2, 9}, {7, 1}, {7, 8}] is very different than saying c1 = List[{2, 9}, {7, 1}, {7, 8}] // MatrixForm. To fix the issue, don't use MatrixForm when making assignments, only use it for displaying results. – Jason B. Feb 26 '18 at 22:23
  • So if I want to multiply C1 and D1, what command should I use? – Aly S. Feb 26 '18 at 22:25
  • c1 = List[{2, 9}, {7, 1}, {7, 8}]; d1 = List[{4, 0, 9}, {1, 4, 5}]; result = d1.c1; (* now use MatrixForm to print the result *) MatrixForm @ result – Jason B. Feb 26 '18 at 22:27
  • I typed in the exact same thing, and still got the two matrices. Why is that? Thank you so much Jason! – Aly S. Feb 26 '18 at 22:33

1 Answers1

4

MatrixForm wraps the matrix for display, preventing other operations from seeing it as a matrix. This is actually quite handy: you can display matrix calculations unevaluated. To allow them to proceed, just remove the wrapper:

c1.d1 /. MatrixForm -> Identity
(* {{17, 36, 63}, {29, 4, 68}, {36, 32, 103}} *)

Re-wrap the result in MatrixForm if you want it pretty.

John Doty
  • 13,712
  • 1
  • 22
  • 42