To perform matrix multiplication in R, you can use %*% operator.

The following method shows how you can do it with syntax.

Method: Using %*% Operator

matrix1 %*% matrix2

The following example shows how perform multiplication of matrices in R.

Let’s see how we can multiply matrices in R:

# Define matrix
A <- matrix(c(7,8,9,4),ncol=2)

B <- matrix(c(1,2,3,4),ncol=2)

# Multiply matrix 
m <- A%*%B

# Print matrix
print(m)

Output:

 [,1] [,2]
[1,]   25   57
[2,]   16   40

Here the output shows multiplication of matrices using %*% operator.