For this assignment, I will be doing math with the following matrices:
For the most part, I used the explanation that was provided through the course announcements as a guide to doing this assignment. To begin, it is important to note that these two matrices above will not produce any inverses.
We can check for inverses by using the det() function which gives us the determinant of a matrix. Entering into R det(A) and det(B), we can see in the console that det(A) will come out with zero while det(B) will give an error because det(B) is not a square matrix.
Now, what is a square matrix exactly? Well, it's a matrix with the same number of rows and columns which allows for one to add and multiply with it. Looking at the structure of the matrix when we transpose the matrices, we can immediately see that the rows greatly outnumber the columns whereas the A matrix does contain the same number of rows and columns (10 rows by 10 columns).
Moving on in the code, we are asked to create two vectors called a and b and since we intend to multiply them by the above matrices, we must make sure that the vector length matches the number of matrix rows. We then create the following vectors:
Moving onto the multiplication of the vectors and matrices, we can execute the following piece of code to perform the calculation:
The calculation is then saved to a table under the following variables:
result_1:
result_2:
The next step is to reassign the vectors a and b to equal the number of rows of the column for the corresponding matrix:
By executing the code, both a and b become of length 10.
Lastly, we are asked to multiply the matrices which can done through the following piece of code:
A taste of the output can be seen in the following image:
Here's a link to the code on GitHub:
~ Katie