Professional Documents
Culture Documents
Matrices
Matrices
Part I
Introduction
• A matrix is a vector taken to the next level.
• Matrices are highly versatile mathematical objects.
• They can store sets of equations, geometric transformations, the
positions of particles over time, financial records, and myriad other
things.
• In data science, matrices are sometimes called data tables, in which
rows correspond to observations (e.g., customers) and columns
correspond to features (e.g., purchases).
Creating and Visualizing Matrices in NumPy
• Matrices are indicated using bold-faced capital letters, like matrix A or
M.
• The size of a matrix is indicated using (row, column) convention.
• For example, the following matrix is 3 × 5 because it has three rows
and five columns:
Creating and Visualizing Matrices in NumPy
• You can refer to specific elements of a matrix by indexing the row
and column position: the element in the 3rd row and 4th column of
matrix A is indicated as a3,4
• Important reminder: math uses 1-based indexing whereas Python
uses 0-based indexing. Thus, element a3,4 is indexed in Python as
A[2,3]
Creating and Visualizing Matrices in NumPy
• Special Matrices
• matrices can be described using a relatively small number of
characteristics, which creates “families” or categories of matrices
• Classwork
• Using the row-matrix representation, compute AB for the matrices in
the previous example
Partitioned Matrices
Partitioned Matrices
• The definition of the matrix product AB uses the natural partition of
A into rows and B into columns; this form might well be called the
row-column representation of the product.
• We can also partition A into columns and B into rows; this form is
called the column-row representation of the product
Partitioned Matrices
• Definition:
• A square matrix A is symmetric if AT = A that is, if A is equal to its own
transpose
The Transpose of a Matrix
• Example:
Exercises
• Solution: We want to find scalars c1, c2, and c3 such that c1A1 + c2A2 +
c3A3 = B. Thus,
Linear combinations of matrices.
• a)
• The last row implies that there is no solution. Therefore, in this case,
C is not a linear combination of A1, A2, and A3.
Linear combinations of matrices.
• Solution: