Nama = Izza Syahri Muharram || Nim = 220605110073 || Mata kuliah = Linear Algebra || Dosen Pengampu = Prof. Dr. SUHARTONO, M.Kom || Teknik Informatika || Universitas Islam Negeri Malang.

Latihan 1. Misalkan kita memiliki matriks A = 2 4 − −54 5 2 5 0 −5 2 −1 3 5 ; B = 2 4 −2 5 02 − −1 4 3 5 −5 3 5 ; C = 2 4 −14 2 3 5 − −2 4 4 −2 3 5 dan a = 2; b = −1; c = 3. Dengan menggunakan matriks ini, verifikasi Teorema 2.3

# Define the matrices A, B, C and scalar values a, b, c
A <- matrix(c(2, 4, -5, 4, 5, 2, 5, 0, -5, 2, -1, 3), nrow = 4, byrow = TRUE)
B <- matrix(c(2, 4, -2, 5, 0, 2, -1, 4, 3, 5, -5, 3), nrow = 4, byrow = TRUE)
C <- matrix(c(2, -1, 4, 2, 3, 5, -2, 4, 4, -2, 3, 5), nrow = 4, byrow = TRUE)

a <- 2
b <- -1
c <- 3

# Verify Theorem 2.3: a(A + B) = aA + aB

# Compute the left side of the equation
left_side <- a * (A + B)

# Compute the right side of the equation
right_side <- a * A + a * B

# Check if the left side is equal to the right side
if (all.equal(left_side, right_side, tolerance = 1e-8)) {
  print("Theorem 2.3 holds: a(A + B) = aA + aB")
} else {
  print("Theorem 2.3 does not hold: a(A + B) ≠ aA + aB")
}
## [1] "Theorem 2.3 holds: a(A + B) = aA + aB"
  1. Buatlah matriks dasar 4 × 4 sedemikian rupa sehingga:
  2. Baris pertama matriks A 4 × 4 dikalikan dengan −1.
  3. Baris kedua dan baris keempat dari matriks A 4 × 4 ditukar
# Define the matrix A
A <- matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), nrow = 4, byrow = TRUE)

# Construct the elementary matrix for multiplying the first row by -1
E1 <- diag(4)
E1[1, ] <- E1[1, ] * -1

# Construct the elementary matrix for exchanging the second and fourth rows
E2 <- diag(4)
E2[c(2, 4), ] <- E2[c(4, 2), ]

# Apply the elementary matrices to A
A_modified <- E2 %*% E1 %*% A
A_modified
##      [,1] [,2] [,3] [,4]
## [1,]   -1   -2   -3   -4
## [2,]   13   14   15   16
## [3,]    9   10   11   12
## [4,]    5    6    7    8

daftar pustaka 1. Yoshida.Ruriko.2021.Linear Algebra and Its Applications With R.London. CRC Press