Search code examples
rmatrix-multiplication

Matrix multiplication Error: non-conformable arguments. Im wondering why I get this error while trying to solve c%*%b if b%*c works


> b
       [,1] [,2]
 [1,]    7    4
 [2,]    1    2

> c
 [,1] [,2] [,3]
 [1,]    3    8    1
 [2,]    2    0    4

> b%*%c
     [,1] [,2] [,3]
     [1,]   29   56   23
     [2,]    7    8    9
  
> c%*%b
Error in c %*% b : non-conformable arguments

I am just trying to do simple matrix multiplication for my linear algebra class. I understand how to do it by hand but for some reason, I get an error when trying to multiply c%%b even though b%% works


Solution

  • Matrix c is of size 2x3, while b is of 2x2.

    I am not sure if you want t(c) %*% b, where t() is matrix transpose.