Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to transpose matrix m.
R Programming
t_m <- [1](m) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using solve() instead of t() for transpose
Using inv() which is not a base R function
✗ Incorrect
The t() function transposes a matrix in R.
2fill in blank
mediumComplete the code to find the inverse of matrix m.
R Programming
inv_m <- [1](m) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using t() which transposes, not inverts
Using inv() which is not a base R function
✗ Incorrect
The solve() function computes the inverse of a matrix in R.
3fill in blank
hardFix the error in the code to correctly compute the inverse of matrix m.
R Programming
inverse_m <- [1](m) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using inv() which is not defined
Using t() which transposes instead of inverts
✗ Incorrect
Only solve() correctly computes the inverse in base R.
4fill in blank
hardFill both blanks to create a matrix m and then transpose it.
R Programming
m <- matrix(c(1, 2, 3, 4), nrow = [1], ncol = [2]) t_m <- t(m)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting nrow or ncol incorrectly causing dimension mismatch
✗ Incorrect
The matrix has 2 rows and 2 columns as per the data vector length.
5fill in blank
hardFill all three blanks to create a matrix, find its inverse, and then transpose the inverse.
R Programming
m <- matrix(c(4, 7, 2, 6), nrow = [1], ncol = [2]) inv_m <- [3](m) t_inv_m <- t(inv_m)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong dimensions for the matrix
Using
t() instead of solve() for inversion✗ Incorrect
The matrix is 2x2, solve() finds its inverse, then t() transposes it.