Week 5: Matrix Operations and a bit of Data Manipulation
Objective
This week’s assignment focused on matrix operations, specifically finding the inverse and determinant of matrices. Additionally, I explored some data manipulation techniques, which I will summarize below.
Part 1: Matrix Operations
Matrix Creation
I created two matrices:
- Matrix A: A 10x10 matrix containing values from 1 to 100.
- Matrix B: A 10x100 matrix containing values from 1 to 1000.
Determinant and Inverse of Matrix A
- The determinant of Matrix A was found to be
0
, indicating that it is singular and does not have an inverse. - Matrix B is non-square (10x100), so it cannot have a determinant or an inverse.
Error Handling
When attempting to compute the inverse of Matrix A using the solve()
function, R returned an error indicating that the matrix is singular.
This message means that the matrix does not have an inverse because its determinant is zero, confirming its singularity.
Similarly, for Matrix B, R returned a different error when I tried to calculate the determinant, stating that the matrix is not square
This highlights that only square matrices can have determinants and inverses, which are fundamental properties in linear algebra.
Key Learnings
- Determinants are critical for assessing whether a matrix is invertible.
- A determinant of
0
signifies a singular matrix, which means it lacks an inverse. - Non-square matrices do not possess determinants or inverses.
Part 2: Summary of Data Manipulation
In addition to matrix operations, I worked with the heights
dataset using functions from the data.table
and dplyr
packages. Here are some of the techniques I applied:
- Filtering: Extracting subsets of data based on specific conditions.
- Summarizing: Calculating means, counts, and other summary statistics.
- Creating New Columns: Adding derived variables to the dataset.
For a more detailed exploration of the data manipulation techniques and code examples, you can find everything in my GitHub repository.
Comments
Post a Comment