MVA Class 3 — Matrices

Technical Issues and Class Start

  • Technical issues were encountered with the video recording and file sharing on Teams, with Jay Verkuilen experiencing difficulties in uploading and sharing files due to permission errors and other issues (00:06:03).
  • Fabio Setti was unable to download the files due to a message stating that the file does not exist, and Jay Verkuilen suspected that something was wrong with his account or Teams in general (00:06:41).
  • Peter Johnson, referred to as the “team’s wizard,” was able to download the files and shared them in the team chat, providing a temporary solution to the issue (00:08:10).
  • Jay Verkuilen considered deleting the code and re-uploading it to resolve the issue, but was unsure of the cause of the problem (00:08:37).
  • The class discussion was delayed due to technical issues, and Jay Verkuilen mentioned that Aisha had sent him an email, but he had not had a chance to check it (00:09:00).
  • The class was waiting for Shemante to arrive, and Jay Verkuilen began the discussion on the topic of matrices in math (00:09:31).
  • Jay Verkuilen introduced the concept of “ways and modes” as a precursor to discussing matrices, and shared his whiteboard or IPad to facilitate the discussion (00:09:46).

Introduction to ANOVA and Matrices

  • One-way Analysis of variance is a data layout where you have one dimension of Classification, with groups such as a control and different treatments, represented by y-bar values (e.g., y-bar 1, y-bar 2, y-bar 3, y-bar 4, y-bar 5) (00:11:05).
  • In one-way ANOVA, comparisons are made between the control and each treatment, or between treatments to identify homogeneous subgroups (00:14:01).
  • Two-way ANOVA involves two dimensions of comparison, such as treatment and another factor like male/female, allowing for the examination of interactions between factors (00:13:00).
  • In a two-way ANOVA layout, the data is organized with means for each combination of factors (e.g., y1M, y1F, y2M, y2F) (00:13:34).
  • Two-way ANOVA typically involves decomposing the data into main effects for each factor and an interaction term (00:14:33).
  • The degrees of freedom (Df) rules for two-way ANOVA involve calculating the number of levels for each factor minus one, and then multiplying these values together (00:14:52).
  • In multivariate analysis, there are similar kinds of things as in other types of analysis, with Classification that can be different dimensions of comparison, such as male versus female and different treatment types (00:15:26).
  • A Correlation with three variables (X, Y, and Z) will have a layout with the variables along the rows and columns, and the correlation of a variable with itself is 1 (00:16:06).
  • Correlations are Symmetry, meaning that the correlation of X with Y is the same as the correlation of Y with X, and this is similar to the concept of distance (00:16:54).
  • A correlation matrix can be thought of as having a layout similar to a matrix of means, but with correlations instead of means (00:17:13).
  • The terminology “modes” and “ways” can be used to describe the dimensions of a comparison, with “modes” referring to dimensions that are not necessarily independent of each other, and “ways” referring to independent dimensions (00:17:39).
  • An example of a two-mode, one-way comparison is a correlation matrix with two variables (X and Y) and a third variable (Z) that is compared to both X and Y (00:17:48).
  • In multivariate analysis, it is common to stop paying attention to redundancies in a correlation matrix, such as the fact that the correlation of X with Y is the same as the correlation of Y with X (00:18:38).
  • A Correlation with four variables (W, X, Y, and Z) will have a larger layout with more correlations, but the same principles of symmetry and redundancy apply (00:18:26).

Analyzing a Matrix and Submatrices

  • A matrix is being analyzed to understand the comparison between two blocks of variables, with block one representing language and block two representing math, and the goal is to identify the relevant part of the matrix for this comparison (00:20:30).
  • The shared variance between variables, such as Y and X compared to Y and Z, is relevant to understanding the comparison between the blocks (00:21:00).
  • The concept of a submatrix is introduced, which refers to the part of the matrix that is informative about the comparison between the blocks (00:21:17).
  • The matrix is partitioned into three pieces, with piece one and two representing the relationships within each block, and piece three representing the relationships between the blocks (00:22:03).
  • Piece three is the relevant part for understanding the shared variability between the blocks, and it can be analyzed using correlations or methods such as canonical Correlation or structural equation modeling (SEM) (00:22:48).
  • The terminology of “mode” is introduced, with the matrix being described as a 2-mode, 1-way matrix, and the importance of keeping track of the different types of comparisons is emphasized (00:23:41).
  • The variables W, X, Y, and Z are used as examples, with W and X representing language variables and Y and Z representing math variables (00:24:23).
  • Matrices can be used to understand the relationships between different variables or data sets, such as the relationship between reading comprehension, grammar, algebra, and geometry (00:24:40).

Data Sets and Matrix Terminology

  • An example of a data set that may be used later in the semester is a set of 5 math tests, with 2 open-book tests, 3 closed-book tests, and 2 tests that are very similar to each other and calculus-based, while the other 2 are more physics-based (00:25:16).
  • When analyzing matrices, it’s essential to keep track of the comparisons being made and understand the terminology used, such as “ways” and “modes” (00:25:57).
  • The terms “ways” and “modes” refer to the labels of the rows and columns in a matrix, which can be independent of each other, and the rows or cases in the columns can be variables (00:26:40).
  • A discrepancy between the number of ways and modes often occurs when data processing has been done, such as when individual observations are processed into means or correlations, resulting in lost information (00:27:13).
  • Losing information is not necessarily bad, as it can be a result of summarizing data to make it more manageable, but it’s essential to be aware of the potential loss of information (00:27:54).

Real-life Application of Pythagorean Theorem

  • The Pythagorean theorem can be used in real-life situations, such as cutting a yard diagonally, to illustrate its practical applications (00:34:26).
  • Jay Verkuilen shares a personal anecdote about people cutting the corner of his family’s yard when he was a kid, and how his dad and stepmom got tired of their rose bushes being run over (00:34:40).
  • In an attempt to stop people from cutting the corner, Jay’s dad and he hammered an iron post into the rose bush, which was bent at a 75-degree angle and covered with oil (00:35:35).
  • The iron post was visible, but not immediately noticeable, especially at night, and it ultimately killed the rose bush when someone’s oil pan contents spilled on it (00:35:54).
  • The incident was effective in stopping people from cutting the corner, but Jay is unsure what happened to the person responsible (00:36:11).
  • The story is used to illustrate the concept of cutting corners and how it can be applied to real-life situations (00:36:33).

Definition and Properties of Matrices

  • A matrix is a rectangular array of numbers, which can also include variables, not just numerical values (00:38:06).
  • Matrices do not have to be filled with numerical values, they can be filled with variables, such as XY and ZW (00:38:14).
  • A triangular table is not a matrix, and it is a different type of data structure that can be analyzed in different ways, but it will not be covered in this discussion (00:38:40).
  • A matrix must be rectangular, meaning it must have the same number of columns for every row, and it must be filled (00:39:20).
  • There are different kinds of special matrices, but the basic definition of a matrix is a rectangular array of numbers (00:39:28).

Introduction to Matrix Algebra

  • Matrix algebra was invented to help manage cognitive load when working with complex formulas and equations, making it easier to understand and work with (00:40:32).
  • Without matrix algebra, working with complex formulas and equations using regular algebra notation can be impossible for the human brain to handle (00:40:29).
  • The concept of matrix algebra is not difficult to understand, but it was not explained clearly when it was first introduced, making it seem more complicated than it actually is (00:40:38).
  • Matrices provide a simple and compact notation for representing complex information, making it easier to understand and work with, especially when compared to using full sums and formulas with multiple indices (00:40:56).
  • While there are times when using full sums and formulas is necessary, matrices offer a more manageable way to handle information overload, and computers can easily process matrices using high-level languages like R or Python (programming language) (00:41:59).
  • The primary reason for using matrices is to reduce cognitive load and make formulas simpler, as algebraic formulas written out in paragraphs can be difficult to cope with (00:42:30).

Matrix Dimensions and Notation

  • The first concept to understand when working with matrices is the matrix dimensions, which involves thinking in terms of rows first, then columns (00:43:35).
  • To understand matrix dimensions, it’s essential to identify the number of rows and columns in a matrix, with rows being listed first, followed by columns (00:44:19).
  • A helpful trick for remembering matrix dimensions is to use a leading subscript for rows and a trailing subscript for columns, as suggested by Johann Van de Ger, a Dutch statistician (00:45:06).
  • Matrices can be represented with dimensions written as a trailing subscript or underneath the matrix, and it’s essential to check the dimensions before working with matrix expressions (00:45:42).
  • When checking dimensions, the first rule is to ensure the number of elements in each row and column agree, which is why a triangular table or other forms cannot be a matrix (00:46:47).
  • Special kinds of matrices have specific names, and some common ones include column vectors (column dimension one) and row vectors (row dimension one) (00:47:29).
  • A column vector has a dimension where the column is one, and a row vector has a dimension where the row is one, as seen in the examples of 3 by 1 and 1 by 3 (00:47:42).
  • In matrix algebra, column and row vectors can be considered as matrices, but some software like R may treat them differently, sometimes as vectors and sometimes as matrices (00:47:55).
  • Functions like as.matrix() or as.vector() can be used to check or convert objects to matrices or vectors, but it’s essential to be aware of the data type stored in the object (00:48:23).
  • The is.matrix() function checks if an object is a matrix, and the as.matrix() function converts an object to a matrix, but it may not always work depending on the data type stored in the object (00:48:43).
  • Matrices have specific requirements, such as having all elements of the same data type, which is why certain data types like text, numerical data, and factors cannot be combined in a matrix (00:49:04).
  • Matrices can only be numerical and cannot mix text and numbers together, as math does not allow for text matrices (00:49:30).
  • Different software, such as R, Python (programming language), and Mathematics, may handle matrices and vectors differently, with some discrepancies in how they treat these data structures (00:49:51).
  • In some software, it is possible to force a vector to be treated as a matrix and vice versa, but the outcome can be unpredictable (00:50:15).

Special Matrices and Transpose Operation

  • A square matrix is a matrix where the number of rows is equal to the number of columns (00:50:56).
  • A famous example of a square matrix is the identity matrix, which has ones on the diagonal and zeros everywhere else (00:51:05).
  • The identity matrix is the matrix generalization of the number one (00:51:20).
  • Matrix operations are often generalizations of operations performed on regular numbers, such as addition and multiplication (00:51:49).
  • There are multiple types of matrix multiplication, but the first operation to be discussed is the transpose operation (00:52:01).
  • The transpose operation swaps the rows and columns of a matrix, effectively flipping it on its side (00:52:28).
  • The transpose of a matrix can be denoted in different ways, including A’, A^T, or A^t (00:53:06).
  • When a matrix is transposed, the rows of the original matrix become the columns of the transposed matrix, and vice versa (00:53:43).
  • A Symmetry matrix is a square matrix where the transpose equals the original matrix, and the elements on the lower diagonal are the same as the elements on the upper diagonal, essentially being mirrored on both sides of the diagonal (00:54:22).
  • Not all square matrices are symmetric, and for a matrix to be symmetric, it must be square (00:54:50).
  • Symmetric matrices show up frequently, especially in distances and Correlation matrices, which have symmetric properties (00:56:03).
  • The ones matrix, also known as the ones vector, is a matrix consisting entirely of ones, denoted by a special font, such as blackboard bold, to distinguish it from a regular number one (00:56:52).
  • The ones matrix is useful for summing things up and creating sums, and its dimensions are indicated to clarify its purpose (00:57:52).
  • The zeros matrix is similar to the ones matrix but consists entirely of zeros (00:58:41).

Element-wise Operations and History of Math

  • Matrix addition is an example of an element-wise operation, which is a generalization of regular old algebra or arithmetic (00:59:34).
  • Element-wise operations include matrix addition, Hadamard product (matrices), and other products named after 19th-century mathematicians such as Heyamard, Kaylee, and Leopold Kronecker (00:59:56).
  • In Mathematics, it is common for concepts to be named after the person who wrote the textbook that popularized the idea, rather than the person who originally invented it (01:00:08).
  • There is a significant amount of reinvention in mathematics, particularly in the 18th and 19th centuries when mathematicians in different parts of the world were working independently of each other (01:00:41).
  • As a result of this reinvention, many mathematical concepts were discovered or developed simultaneously by different people, often in different parts of the world (01:00:55).
  • The history of mathematics is global, with contributions from mathematicians in China, Japan, Europe, and India, among other places (01:01:11).
  • The discovery of archives has revealed that many mathematical concepts were reinvented multiple times, and the person who wrote the most popular textbook often gets credited with the discovery (01:01:55).
  • Mathematical concepts can be rediscovered or redeveloped centuries after they were first invented, and this is a common feature of the history of mathematics (01:02:15).
  • The Babylonians, for example, had knowledge of Pythagoreanism triples, which are related to Pythagoras’s theorem, before Pythagoras (01:02:55).
  • Historically, mathematicians have built upon the work of others, with Pythagoras advertising that he went to Egypt to learn math, and Newton stating that he stood on the shoulders of giants to see farther than others (01:03:32).
  • Math has a competitive aspect, with some mathematicians in the 15th century being obsessed with math and engaging in competitions, such as “math throwdowns” (01:04:46).
  • Mathematicians would sometimes keep their theorems secret, with some stating that they would take their results to their dying bed (01:04:55).

Element-wise Operations and Hadamard Product

  • Element-wise operations in matrices require both dimensions to match, meaning that if matrix A is 3 by 2 and matrix B is 3 by 2, then element-wise operations can be performed (01:05:45).
  • Element-wise operations include addition, subtraction, and multiplication, with the latter also being referred to as the Hadamard product (matrices) (01:07:24).
  • The notation for element-wise operations is not always consistent, with some using a plus symbol with a circle around it to denote element-wise addition (01:06:06).
  • When performing element-wise operations, the corresponding elements in each matrix are interacted with using the specified operator (01:06:40).
  • An example of element-wise addition is the operation of two 2x2 matrices, where the corresponding elements are added together (01:06:46).
  • The Jacques Hadamard product is a type of matrix multiplication used to make interactions, where each element is matched up and multiplied, similar to making interactions by hand in a stat package by multiplying two variables together (01:07:38).
  • The Cayley product, also known as matrix multiplication, will be used in the class instead of the Hadamard product (01:08:03).
  • The Leopold Kronecker product is another type of matrix multiplication that is useful but will not be covered in the class as it is tedious and not necessary for the topics being covered (01:08:11).
  • The Kronecker product is used in certain mathematical operations, such as Analysis of variance, but is not essential for the class (01:08:37).
  • Element-wise operations can be performed on matrices, such as exponentiating or taking the log of every element inside the matrix (01:09:27).
  • Standard math operations have generalizations to matrices, but there may be multiple generalizations, and it’s essential to know which one is being used (01:09:52).

Scalar Product and Vector Conventions

  • The scalar product is a type of Cayley product, also known as matrix multiplication, where a scalar (a single number) is multiplied by a matrix (01:10:55).
  • The scalar product is the simplest form of the Cayley product, and understanding its motivation is crucial, as it may seem confusing at first (01:11:06).
  • The scalar product takes two vectors and generates a scalar from them, hence the name “Scalar product” (01:12:23).
  • By convention, all vectors are considered column vectors, unless explicitly transposed to become row vectors (01:13:06).
  • This convention is not a mathematical fact, but rather a writing convention to maintain consistency and avoid confusion (01:13:01).
  • In some areas of math and statistics, the convention is to treat everything as row vectors, which can be confusing when working with different conventions (01:13:57).
  • In the programming language R, a vector is neither a column nor a row by default, but R defaults to treating things as a column vector (01:14:18).
  • It is essential to keep track of how vectors are arranged and to transpose them when necessary to maintain consistency (01:15:03).
  • The convention of treating all vectors as column vectors will be followed in the class, but it is not a universal truth and may vary in different contexts (01:14:56).
  • Writing vectors as row vectors can be easier, but the convention of using column vectors will be maintained for consistency (01:15:32).
  • When thinking about data sets, it’s natural to consider each row as an individual observed set of observations, which may make rows more natural than columns in certain contexts (01:15:50).

Scalar Product and its Applications

  • The scalar product is defined as the interaction between a row vector and a column vector, where the first element of the row is multiplied by the first element of the column, and then added to the product of the second elements, and so on (01:16:39).
  • The scalar product can be represented as a transpose times B, where the result is the sum of the products of corresponding elements (01:17:27).
  • The scalar product is useful in statistics, as it makes formulas easier to use, such as calculating the sum of squares and the sum of a vector (01:17:54).
  • The sum of squares can be calculated using the scalar product, where a transpose times a equals the sum of the squares of the elements in the vector (01:18:08).
  • The sum of a vector can also be calculated using the scalar product, where a transpose times one equals the sum of the elements in the vector (01:18:46).
  • The scalar product has a geometric meaning, as the square root of the sum of squares is related to the Pythagorean theorem (01:20:11).
  • The Cayley product, also known as the scalar product, helps to simplify calculations and provide a deeper understanding of mathematical concepts (01:20:32).

Cayley Product and Matrix Multiplication

  • Matrices can be combined using scalar products, following compatibility rules, allowing for multiple operations to be performed at once and reducing cognitive load (01:20:38).
  • The formula for matrix multiplication can be simplified by using a transpose and eliminating subscripts, making it easier to work with (01:21:16).
  • A vector is denoted by a symbol with a little arrow over the top, also referred to as a “vector hat,” which is used instead of bold font to distinguish it from scalars and matrices (01:21:28).
  • The notation for vectors, scalars, and matrices is important, with “a” representing a scalar, “a” with no notation representing a matrix, and “a” with a vector hat representing a vector (01:22:10).
  • Notational conventions are crucial in math, and a significant amount of math is knowing the correct notation (01:22:42).
  • Matrix compatibility rules require that the number of columns on the left matrix equals the number of rows on the right matrix to ensure that scalar products are defined (01:22:51).
  • If the number of columns on the left matrix does not equal the number of rows on the right matrix, the scalar product cannot be formed, resulting in undefined operations (01:23:43).
  • The Cayley product can be thought of as a stack of rows, where each row has the same length, and the corresponding elements interact with each other (01:24:36).
  • Matrix multiplication allows for multiple scalar products to be performed at once, abstracting a large amount of arithmetic into a simple formula (01:25:03).
  • This process involves lining up corresponding elements from two matrices and performing arithmetic operations to obtain the resulting matrix (01:25:30).
  • The use of matrix multiplication enables the simplification of complex formulas that would otherwise be difficult to write out and typeset (01:26:22).

Matrix Representation of Linear Systems

  • Matrix algebra provides a compact way to represent systems of equations, which can be written out as linear systems or in a more compact matrix form (01:27:30).
  • A linear system can be rewritten as a matrix by grouping coefficients of variables together and representing them in a matrix format (01:28:29).
  • The matrix representation of a linear system is equivalent to the linear system and vector system, but the choice of representation depends on what information is desired (01:29:06).
  • The linear system is useful for examining each line individually, while the vector system is more suitable for analyzing columns, and the matrix representation provides a compact overview (01:29:15).

Matrix Properties and Inverse

  • Matrices have various properties and concepts, such as colinearity, which involves thinking about the columns of a matrix, and there’s nothing inherently bad about any of these properties - they’re all fine, and it’s just a matter of understanding what you want to achieve (01:29:30).
  • The concept of a matrix inverse is important, where if you know A and B, you want to find X, similar to regular algebra, but with matrices, you try to find a matrix inverse that can effectively divide out by A to reveal X (01:30:02).
  • The goal is to find an A inverse such that A inverse times A equals the identity matrix, which would allow you to solve for X by multiplying both sides of the equation by A inverse (01:31:12).
  • Multiplying by the identity matrix is like multiplying by one, as it doesn’t change the vector, so if you can find A inverse, you can solve for X by multiplying both sides by A inverse (01:31:42).
  • Finding the inverse of a matrix is not always straightforward and can be complex, but the goal is to understand the concept and how it can be used to solve for X (01:32:02).
  • In practice, you may not always find the inverse of a matrix directly, but rather use computational methods to avoid extra work, and there’s more complexity involved in the actual calculation (01:32:20).
  • The homework assignment will involve working with inverses of 2x2 and 3x3 matrices to get a feel for how they work and to understand some of the peculiarities involved (01:33:14).

Matrix Invertibility and 2 Key Mean Difference Matrix

  • Matrix multiplication is a function that takes a vector and makes a new vector, and to be invertible, it means that we can go from that new vector back to the old vector, allowing us to go forward and backwards without losing information (01:34:18).
  • An example of a matrix multiplication is given with the matrix A equals one half, one half, one minus one, which is called the 2 key mean difference matrix, and it gives us the mean and the difference of the 2 elements in the vector (01:34:44).
  • The 2 key mean difference matrix is invertible, meaning we can solve for the 2 data points, and it’s an example of a matrix that can be used to give us formulas (01:35:50).

Matrix Multiplication Compatibility and Homework

  • The big compatibility rule for matrix multiplication is that the inner dimensions must match, and if they don’t, the scalar products aren’t defined (01:36:05).
  • To learn matrix operations, it’s recommended to do homework by hand and using a computer, as it gives a feeling for how the operations work and how they are implemented in a computer (01:36:54).
  • Matrix operations such as defining matrix functions like cbind in R are simple and will be covered quickly (01:37:46).

Matrix Operations in R

  • The cbind function in R is used to glue together 2 vectors, and it applies to matrix operations (01:37:49).
  • Attempting to combine vectors of different lengths into a matrix may result in errors, as demonstrated by trying to glue together vectors 2, 2, and 3, 1, which should not work (01:38:08).
  • The try function in R can be used to run code even if it hits an error, allowing the program to continue running instead of stopping (01:38:44).
  • The try function is useful when writing R code for examples in homework, as some spots may generate errors (01:39:02).
  • The try function can be used by typing “try” and then the expression to be evaluated, allowing for error recovery (01:40:06).
  • Functions like dim give the dimensions of a matrix, and is.matrix checks if an object is a matrix (01:40:42).
  • Vectors do not have row and column dimensions, only a single dimension, which can be checked using the length function (01:41:12).
  • The c function can be used to create a matrix from vectors, but it is essential to understand the difference between vectors and matrices to avoid frustration (01:40:55).
  • The rbind function takes vectors and stacks them as rows to create a matrix (01:41:58).
  • The transpose function, denoted by t, can be used to transpose a matrix (01:42:11).
  • Transposing a vector can convert it into a matrix, as demonstrated by transposing vector B (01:42:30).
  • In R, the array indices are used to identify the dimensions of a matrix, and the transpose of a matrix can have different dimensions than the original matrix (01:43:02).
  • The transpose of B has 2 array indices, whereas B only has 1 array index (01:43:10).
  • When adding two matrices, the dimensions must be the same, but R can sometimes perform operations that are not mathematically correct (01:43:40).
  • A square matrix can be added to its transpose, as the dimensions are the same (01:44:01).
  • A vector can be thought of as a 2 by 1 matrix, and its transpose is a 1 by 2 matrix, but R may not always perform operations correctly with vectors (01:44:25).
  • R can perform element-wise operations, such as multiplication and division, but these are different from matrix multiplication (01:46:03).
  • Element-wise multiplication is not the same as matrix multiplication, and R uses the symbol %*% for matrix multiplication, while some languages use the star symbol (01:46:46).
  • In R, adding a scalar to a matrix is allowed, but this is not mathematically correct, as the dimensions must be the same (01:45:09).
  • R’s behavior can be different from mathematical rules, and it’s essential to understand the differences when working with matrices in R (01:45:55).

Matrix Multiplication and Transpose Properties

  • Matrix multiplication conventions vary across languages, such as MATLAB, where the symbol for matrix multiplication is a star, and a special symbol is required for element-wise multiplication (01:47:12).
  • The transpose of a square matrix is always defined and results in a square matrix (01:47:32).
  • When a matrix is multiplied by its transpose, the result is always a square and Symmetry matrix (01:48:31).
  • The diagonal elements of a matrix multiplied by its transpose are the sums of squares, while the off-diagonal elements are the cross products (01:48:48).
  • The sums of squares and cross products matrices are useful in statistics and can be used to compute distances (01:49:12).
  • Matrix algebra is useful for various applications, including computing distances and performing Gaussian elimination (01:49:29).
  • In R, the function to perform matrix inversion is called “solve,” and it can be used to find the inverse of a matrix (01:50:01).
  • The inverse of a matrix A can be found using the “solve” function in R, and it results in the identity matrix (01:50:17).
  • A non-square matrix, such as G (2x3), cannot be inverted, but G transpose times G and G times G transpose can be inverted (01:50:59).
  • The inverse of G transpose times G and G times G transpose is Symmetry (01:51:40).

Matrix Inversion and Generalized Inverses

  • The inverse of a symmetric matrix is symmetric, and the solve function can be used to find the vector that satisfies a given equation involving a vector and a matrix (01:51:42).
  • Generalized inverse are a generalization of inverses that allow for the creation of something that functions like an inverse, even for non-invertible matrices, and are related to singular value decomposition (01:52:09).
  • The solve function can be used to perform various operations, including solving systems of equations (01:52:43).

Data Visualization and Plotting

  • When working with matrices and vectors, it’s often helpful to visualize the data using plots and graphics, as this can provide a better understanding of the relationships between the data (01:53:08).
  • The truism “you work in algebra, you think in geometry” highlights the importance of visualizing data in a geometric space, even when working with algebraic equations (01:53:22).
  • In R, the arrows function can be used to plot vectors, and the aspect ratio of the plot can be adjusted to ensure that the horizontal and vertical axes are equal (01:54:46).
  • Many plotting functions in R, including ggplot and facto extra, require setting up a coordinate system before plotting data points or vectors (01:55:29).
  • Facto extra is a package that can be used to create nicer-looking plots, and will be used more frequently in the rest of the class (01:55:31).
  • Multiplying a vector by a matrix results in a new vector, as demonstrated by the original vector and the new vector obtained after multiplication (01:56:08).
  • The new vector is calculated by performing the matrix multiplication, which in this case results in a vector with components 5 and 3, representing a point 5 units across and 3 units up (01:56:35).

Vector Operations and Plotting

  • Vectors can be added component-wise, but when plotting, they must be added head to tail, meaning that the tail of the second vector is placed at the head of the first vector (01:56:54).
  • Adding vectors A and B involves translating vector B to the head of vector A and then moving to the resulting point, which can be visualized using a head-to-tail plot (01:57:32).
  • Creating visualizations like this can be challenging, especially when it comes to graphics options and getting the colors correct, but the math itself is often not the hard part (01:58:02).

Ellipses and Covariance Matrices

  • Matrices can also be used to define ellipses, and an ellipse function can be used to draw ellipses by specifying the center and various quantities that define the ellipse, which is effectively a matrix (01:58:50).
  • Ellipses have connections to statistics, particularly variances, and can be used to interpret many common statistical procedures, as discussed in the paper “Elliptical Insights” (01:59:31).
  • Data often tend to look like a cloud or an ellipse when plotted, which is why ellipses are useful in statistics (02:00:00).
  • The topic of covariance matrices, Mahalanobis distance distances, and principal components will be revisited in a later discussion (02:00:44).

Homework and Next Class Topics

  • The instructor encourages students to start working on the homework, which involves different matrix expressions, to gain hands-on experience and understand how to work with vectors and matrices (02:01:14).
  • The homework also involves replicating the matrix expressions in R to see how the software handles errors and to understand what it’s like when the computer fails (02:01:21).
  • The instructor intentionally creates examples that fail to help students understand how to handle errors and to prepare them for real-world scenarios where the computer may fail (02:01:47).
  • The next class will cover topics such as covariance matrices and Correlation matrices, which involve matrix transpose times matrix operations (02:02:50).
  • The instructor aims to help students understand what happens when a matrix is transposed and multiplied by another matrix (02:03:01).
  • The next class will be held at the Grad Center, and students are encouraged to attend if possible (02:02:25).