20.1
20.1
[1,] 1 2 3
[2,] 4 5 6
[1,] 6 10
[2,] 8 12
# Matrix Subtraction
Z_sub <- X - Y
print(Z_sub)
Output:
[,1] [,2]
[1,] -4 -4
[2,] -4 -4
[1,] 5 21
[2,] 12 32
Output:
[,1] [,2]
[1,] 1 2
[2,] 3 4
[1,] -2 1
Output:
[1] -2
Output:
$values
[1] 5 0
$vectors
[,1] [,2]
Conclusion:
This experiment provides hands-on experience with matrices in R, covering initialization, and
basic operations. Understanding these fundamentals is essential for data analysis and
machine learning applications in R.